Skip to content

Ensure to generate file creation URL - #635

Merged
pipecd-bot merged 2 commits into
masterfrom
file-link
Aug 17, 2020
Merged

pipecd-bot merged 2 commits into
masterfrom
file-link

Conversation

@nakabonne

@nakabonne nakabonne commented Aug 17, 2020 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:
Each deployment config template comes with a file creation URL, which is for creating a new file under the git path, with template content as default value. Something like:
https://github.com/pipe-cd/debug/new/master/kubernetes/analysis-by-metrics?filename=.pipe.yaml&value=%23+This+configures+a+non-progressive+delivery.%0AapiVersion%3A+pipecd.dev%2Fv1beta1%0Akind%3A+KubernetesApp%0Aspec%3A%0A++input%3A%0A++++manifests%3A%0A++++++-+deployment.yaml%0A++++++-+service.yaml%0A++++kubectlVersion%3A+2.1.1

Whereas, I'm getting an issue about specifying filename: isaacs/github#1527. I'll be glad to address it later.

Which issue(s) this PR fixes:

Fixes #627

Does this PR introduce a user-facing change?:

NONE

@pipecd-bot

Copy link
Copy Markdown
Collaborator

TODO

The following ISSUES will be created once got merged. If you want me to skip creating the issue, you can use /todo skip command.

Details

1. Allow users to specify git host

https://github.com/pipe-cd/pipe/blob/45fe033e3d38c4d0a55790f24206e5150e7bd0b7/pkg/git/url.go#L118-L121

This was created by todo plugin since "TODO:" was found in 45fe033 when #635 was merged. cc: @nakabonne.

@nakabonne

Copy link
Copy Markdown
Member Author

/todo skip

@nakabonne

Copy link
Copy Markdown
Member Author

/cc @cakecatz

@pipecd-bot
pipecd-bot requested a review from cakecatz August 17, 2020 07:00
@pipecd-bot

Copy link
Copy Markdown
Collaborator

COVERAGE

Code coverage for golang is 21.59%. This pull request increases coverage by 0.21%.

File Function Base Head Diff
pkg/git/url.go MakeFileCreationURL -- 100.00% +100.00%
pkg/app/api/api/web_api.go WebAPI.ListDeploymentConfigTemplates 0.00% 0.00% +0.00%

repeated DeploymentConfigTemplateLabel labels = 3;
string content = 4 [(validate.rules).string.min_len = 1];
// An HTML link to create a new file under the git path, with template content as default value.
string file_creation_link = 5;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: file_creation_url

Comment thread pkg/app/api/api/web_api.go Outdated
}
for _, t := range templates {
g := app.GetGitPath()
t.FileCreationLink, err = git.MakeFileCreationURL(g.GetRepo().GetRemote(), g.GetPath(), g.GetRepo().GetBranch(), ".pipe.yaml", t.Content)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: g.Repo.Remote, g.Repo.Branch, g.Path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name should be the specified one if config_file_name was not nil.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly! thanks!

@nghialv

nghialv commented Aug 17, 2020

Copy link
Copy Markdown
Member

Very nice feature.
Just left some nits.
LGTM

@nakabonne

Copy link
Copy Markdown
Member Author

Fixed

@nghialv

nghialv commented Aug 17, 2020

Copy link
Copy Markdown
Member

Thank you.
/approve

@pipecd-bot

Copy link
Copy Markdown
Collaborator

APPROVE

This pull request is APPROVED by nghialv.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot

Copy link
Copy Markdown
Collaborator

COVERAGE

Code coverage for golang is 21.58%. This pull request increases coverage by 0.20%.

File Function Base Head Diff
pkg/git/url.go MakeFileCreationURL -- 100.00% +100.00%
pkg/app/api/api/web_api.go WebAPI.ListDeploymentConfigTemplates 0.00% 0.00% +0.00%

@pipecd-bot
pipecd-bot merged commit 0891c80 into master Aug 17, 2020
@pipecd-bot
pipecd-bot deleted the file-link branch August 17, 2020 07:52
@pipecd-bot

Copy link
Copy Markdown
Collaborator

TEMPLATE

failed to handle template rule examples

Details
Error: unabled to push rendered files to destination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contain git host link within ListDeploymentConfigTemplates response

3 participants