Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Use instance vars to format message #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aoldershaw
Copy link

@aoldershaw aoldershaw commented Jan 22, 2021

Follow-up to (and depends on) mockersf/concourse-resource-rs#1, which adds a pipeline instance vars to the BuildMetadata. For context, I'll copy the PR description:

I'm a member of the Concourse team, and one feature we're adding to Concourse v7.0.0 is pipeline instances. The RFC outlines the motivations for the feature/how it works at a high-level. One implication of pipeline instances is that the team name + pipeline name is no longer sufficient to uniquely identify a pipeline in general - pipeline instances are also identified by their "instance vars", which is some JSON object. For instance, you may have an instance group called release, and several pipeline instances for different versions, e.g.
{"version": "6.7.x"} {"version": "7.0.x"} ...
Accordingly, resources are now given the instance vars as a JSON encoded string in BUILD_PIPELINE_INSTANCE_VARS. Regular pipelines will have this env var unset.


This updates the job+build name in the message to display the instance vars in the job reference, and updates the build URL with the appropriate query params. e.g.

Screen Shot 2021-01-22 at 11 25 31 AM

Note that the format of the pipeline/job reference is meant to mimic how you interact with pipeline instances in fly. For the above example, we could say:

$ fly -t ci trigger-job -j 'release/type:"hg"/build-alpine'
# the quotes are optional here
$ fly -t ci trigger-job -j release/type:hg/build-alpine

Of course open to any/all feedback! I'm very much a rust novice, so if I did something in a stupid way, please let me know (I'd love to learn best practices!)

related: mockersf/concourse-resource-rs#1

Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
Cargo.toml Outdated Show resolved Hide resolved
@@ -20,6 +21,7 @@ pub(crate) struct Build {
// job_name: String,
// api_url: String,
// pipeline_name: String,
// pipeline_instance_vars: Option<Map<String, Value>>,
Copy link
Author

Choose a reason for hiding this comment

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

Question: does serde_json actually use this in some magical way, or is it just there for internal documentation?

Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
@RCM7
Copy link

RCM7 commented Oct 21, 2021

👍 We started using instanced pipelines and this PR would come really handy!

@aoldershaw
Copy link
Author

@RCM7 in the meantime, you can use the resource type built from this PR, as the Concourse team has been doing: https://github.com/concourse/ci/blob/db479438ca5b181afda962571ed9f243529f4df4/pipelines/release.yml#L41-L45

@RCM7
Copy link

RCM7 commented Oct 21, 2021

thank you @aoldershaw 🙌

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

Successfully merging this pull request may close these issues.

None yet

2 participants