Capitalization

This commit is contained in:
Ed
2018-12-19 18:00:10 -05:00
parent 267cf61ef9
commit 7cab700694
4 changed files with 16 additions and 16 deletions

View File

@@ -93,7 +93,7 @@ Also creates the following files:
### `out`: Publish a release. ### `out`: Publish a release.
Given a `commitish` and `tag`, this tags the commit and creates a release on GitLab, then uploads the files Given a `commit_sha` and `tag`, this tags the commit and creates a release on GitLab, then uploads the files
matching the patterns in `globs` to the release. matching the patterns in `globs` to the release.
#### Parameters #### Parameters

View File

@@ -31,14 +31,14 @@ type GitLab interface {
DownloadProjectFile(url, file string) error DownloadProjectFile(url, file string) error
} }
type gitlabClient struct { type GitlabClient struct {
client *gitlab.Client client *gitlab.Client
accessToken string accessToken string
repository string repository string
} }
func NewGitLabClient(source Source) (*gitlabClient, error) { func NewGitLabClient(source Source) (*GitlabClient, error) {
var httpClient = &http.Client{} var httpClient = &http.Client{}
var ctx = context.TODO() var ctx = context.TODO()
@@ -51,23 +51,23 @@ func NewGitLabClient(source Source) (*gitlabClient, error) {
client := gitlab.NewClient(httpClient, source.AccessToken) client := gitlab.NewClient(httpClient, source.AccessToken)
if source.GitlabAPIURL != "" { if source.GitLabAPIURL != "" {
var err error var err error
baseUrl, err := url.Parse(source.GitlabAPIURL) baseUrl, err := url.Parse(source.GitLabAPIURL)
if err != nil { if err != nil {
return nil, err return nil, err
} }
client.SetBaseURL(baseUrl.String()) client.SetBaseURL(baseUrl.String())
} }
return &gitlabClient{ return &GitlabClient{
client: client, client: client,
repository: source.Repository, repository: source.Repository,
accessToken: source.AccessToken, accessToken: source.AccessToken,
}, nil }, nil
} }
func (g *gitlabClient) ListTags() ([]*gitlab.Tag, error) { func (g *GitlabClient) ListTags() ([]*gitlab.Tag, error) {
var allTags []*gitlab.Tag var allTags []*gitlab.Tag
opt := &gitlab.ListTagsOptions{ opt := &gitlab.ListTagsOptions{
@@ -97,7 +97,7 @@ func (g *gitlabClient) ListTags() ([]*gitlab.Tag, error) {
return allTags, nil return allTags, nil
} }
func (g *gitlabClient) ListTagsUntil(tag_name string) ([]*gitlab.Tag, error) { func (g *GitlabClient) ListTagsUntil(tag_name string) ([]*gitlab.Tag, error) {
var allTags []*gitlab.Tag var allTags []*gitlab.Tag
opt := &gitlab.ListTagsOptions{ opt := &gitlab.ListTagsOptions{
@@ -138,7 +138,7 @@ func (g *gitlabClient) ListTagsUntil(tag_name string) ([]*gitlab.Tag, error) {
return allTags, nil return allTags, nil
} }
func (g *gitlabClient) GetTag(tag_name string) (*gitlab.Tag, error) { func (g *GitlabClient) GetTag(tag_name string) (*gitlab.Tag, error) {
tag, res, err := g.client.Tags.GetTag(g.repository, tag_name) tag, res, err := g.client.Tags.GetTag(g.repository, tag_name)
if err != nil { if err != nil {
return &gitlab.Tag{}, err return &gitlab.Tag{}, err
@@ -152,7 +152,7 @@ func (g *gitlabClient) GetTag(tag_name string) (*gitlab.Tag, error) {
return tag, nil return tag, nil
} }
func (g *gitlabClient) CreateTag(ref string, tag_name string) (*gitlab.Tag, error) { func (g *GitlabClient) CreateTag(ref string, tag_name string) (*gitlab.Tag, error) {
opt := &gitlab.CreateTagOptions{ opt := &gitlab.CreateTagOptions{
TagName: gitlab.String(tag_name), TagName: gitlab.String(tag_name),
Ref: gitlab.String(ref), Ref: gitlab.String(ref),
@@ -172,7 +172,7 @@ func (g *gitlabClient) CreateTag(ref string, tag_name string) (*gitlab.Tag, erro
return tag, nil return tag, nil
} }
func (g *gitlabClient) CreateRelease(tag_name string, description string) (*gitlab.Release, error) { func (g *GitlabClient) CreateRelease(tag_name string, description string) (*gitlab.Release, error) {
opt := &gitlab.CreateReleaseOptions{ opt := &gitlab.CreateReleaseOptions{
Description: gitlab.String(description), Description: gitlab.String(description),
} }
@@ -196,7 +196,7 @@ func (g *gitlabClient) CreateRelease(tag_name string, description string) (*gitl
return release, nil return release, nil
} }
func (g *gitlabClient) UpdateRelease(tag_name string, description string) (*gitlab.Release, error) { func (g *GitlabClient) UpdateRelease(tag_name string, description string) (*gitlab.Release, error) {
opt := &gitlab.UpdateReleaseOptions{ opt := &gitlab.UpdateReleaseOptions{
Description: gitlab.String(description), Description: gitlab.String(description),
} }
@@ -214,7 +214,7 @@ func (g *gitlabClient) UpdateRelease(tag_name string, description string) (*gitl
return release, nil return release, nil
} }
func (g *gitlabClient) UploadProjectFile(file string) (*gitlab.ProjectFile, error) { func (g *GitlabClient) UploadProjectFile(file string) (*gitlab.ProjectFile, error) {
projectFile, res, err := g.client.Projects.UploadFile(g.repository, file) projectFile, res, err := g.client.Projects.UploadFile(g.repository, file)
if err != nil { if err != nil {
return &gitlab.ProjectFile{}, err return &gitlab.ProjectFile{}, err
@@ -228,7 +228,7 @@ func (g *gitlabClient) UploadProjectFile(file string) (*gitlab.ProjectFile, erro
return projectFile, nil return projectFile, nil
} }
func (g *gitlabClient) DownloadProjectFile(filePath, destPath string) error { func (g *GitlabClient) DownloadProjectFile(filePath, destPath string) error {
out, err := os.Create(destPath) out, err := os.Create(destPath)
if err != nil { if err != nil {
return err return err

View File

@@ -7,7 +7,7 @@ func metadataFromTag(tag *gitlab.Tag) []MetadataPair {
if tag.Name != "" { if tag.Name != "" {
nameMeta := MetadataPair{ nameMeta := MetadataPair{
Name: "name", Name: "tag",
Value: tag.Name, Value: tag.Name,
} }

View File

@@ -3,7 +3,7 @@ package resource
type Source struct { type Source struct {
Repository string `json:"repository"` Repository string `json:"repository"`
GitlabAPIURL string `json:"gitlab_api_url"` GitLabAPIURL string `json:"gitlab_api_url"`
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
Insecure bool `json:"insecure"` Insecure bool `json:"insecure"`