Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure to generate file creation URL #635

Merged
merged 2 commits into from
Aug 17, 2020
Merged

Ensure to generate file creation URL #635

merged 2 commits into from
Aug 17, 2020

Conversation

nakabonne
Copy link
Member

@nakabonne nakabonne commented Aug 17, 2020

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
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
Member Author

/todo skip

@nakabonne
Copy link
Member Author

/cc @cakecatz

@pipecd-bot pipecd-bot requested a review from cakecatz August 17, 2020 07:00
@pipecd-bot
Copy link
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%

@@ -331,6 +332,8 @@ message DeploymentConfigTemplate {
string name = 2 [(validate.rules).string.min_len = 1];
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
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

}
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
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
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
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
Copy link
Member

nghialv commented Aug 17, 2020

Very nice feature.
Just left some nits.
LGTM

@nakabonne
Copy link
Member Author

Fixed

@nghialv
Copy link
Member

nghialv commented Aug 17, 2020

Thank you.
/approve

@pipecd-bot
Copy link
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
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
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