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

fix: instantiated pipeline vars #149

Closed

Conversation

jamiegosling
Copy link

@jamiegosling jamiegosling commented Feb 18, 2024

Pipeline variables for instantiated pipelines should be encoded as a sequence of URL parameters in the format like

?vars.variableName1=variableValue1&vars.variableName2=variableValue2

Closes #148

@marco-m-pix4d
Copy link
Contributor

marco-m-pix4d commented Feb 21, 2024

Thanks @jamiegosling! This actually shows me that I missed the details of the encoding of "instance vars". I appreciate that you found and expanded the existing tests. One thing to change is the panic, we do not panic in Cogito.

Rummaging in the Concourse source code, I finally arrived at the source of truth, file https://github.com/concourse/concourse/blob/master/atc/pipeline.go.

We will need to transplant some code and cover it with tests.

If you want to iterate here, fine. Otherwise, I will take care of this (although I cannot guarantee a timeline).

@jamiegosling
Copy link
Author

Thanks @marco-m-pix4d,

I don't really know Go so if I get the time I'll iterate here as a learning experience, but if you fix it before then then that's great. Thanks for your time building this and looking at my issue!

Jamie

@@ -345,13 +345,19 @@ func TestConcourseBuildURL(t *testing.T) {
name: "instanced vars 1",
env: testhelp.MergeStructs(baseEnv,
Environment{BuildPipelineInstanceVars: `{"branch":"stable"}`}),
want: "https://ci.example.com/teams/devs/pipelines/magritte/jobs/paint/builds/42?vars=%7B%22branch%22%3A%22stable%22%7D",
want: "https://ci.example.com/teams/devs/pipelines/magritte/jobs/paint/builds/42?vars.branch=%22stable%22",
Copy link
Contributor

@aliculPix4D aliculPix4D Feb 22, 2024

Choose a reason for hiding this comment

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

@marco-m-pix4d should we start using go-vcr pkg in these tests?

I wonder if we could have catch'ed this sooner if we used it already.

Copy link
Contributor

Choose a reason for hiding this comment

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

should we start using go-vcr pkg in these tests?

Probably.

I wonder if we could have catch'ed this sooner if we used it already.

This is the part I don't understand. I think that I tested against https://github.com/marco-m/concourse-in-a-box, so I don't understand why this now fails. True in any case that if we had a go-vcr trace, we could answer this question...

@aliculPix4D
Copy link
Contributor

aliculPix4D commented Mar 22, 2024

@jamiegosling see: #153

EDIT: I forgot to mention: you can already test my changes by using: pix4d/cogito:pci-3688-cogito-encode-url docker image
https://hub.docker.com/layers/pix4d/cogito/pci-3688-cogito-encode-url/images/sha256-e9bbc1f3b516d95fff5c3e283c0e5d7c01570c2316cf17052631cf72682b8905?context=explore
Can you please confirm that this solves your issue?

@aliculPix4D
Copy link
Contributor

@jamiegosling I am closing this PR as this was fixed in: #153

Thanks for your contribution and reporting the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build links for instanced pipelines don't work
3 participants