-
Notifications
You must be signed in to change notification settings - Fork 170
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
Metadata #293
Comments
Hmmm this kinda concerns me: If main is a matrix job with FOO: [1,2] main triggers deploy. Then inside deploy, [edit] example |
Yup, it's inspired by GoLang maps. For us to pass metadata consistently between jobs, we need to have an approach that's the same regardless if you're running a matrix build or not. The only option is merging the result. If we don't pick a policy for this, then it will become an undocumented side-effect. But any policy I thought of seemed hard to explain (e.g. merged based on alphabetical serialization of the sorted keys from your matrix builds). So I thought back to the GoLang thing that @jer explained to me and it occurred to me this would be excellent for this problem. If we enforce (and document) randomness, then users must make their own decisions about how to namespace their metadata in matrix builds such that they can retrieve it in later jobs. |
@catto How would you like to approach working on this? I'm assuming you'll need a new repo for the meta go binary. Would you like:
I created |
@stjohnjohnson Thanks, I'll contact you on the Slack channel |
I have a question about format of
@minz1027 commented screwdriver-cd/launcher#108 (comment):
We need newline or not? |
@tk3fftk I think it should not include the newline in the value since user will probably assign the value to some variables. Just need to document it somewhere so that user won't get confused when they do |
@tk3fftk @minz1027 it sounds like it's a bug if not outputting a newline will result in no log. We should force a newline when we run steps (in the writing of the shell script). But meta should not return a newline, that will allow it to work like a normal unix command. |
@minz1027 @stjohnjohnson I understood. You mean that the result is like this image when only run |
@tk3fftk yes! That's what I mean. @stjohnjohnson you are right, we don't have a newline for sourcing the step file. The meta get results get printed with the next command https://github.com/screwdriver-cd/launcher/blob/master/executor/executor.go#L77 |
@minz1027 also related #488 |
@stjohnjohnson @minz1027 To show log, I changed these lines to |
@tk3fftk good caught! can u help review the pr? And there is a bug in the launcher code for meta, |
@tk3fftk I was writing the docs for meta-cli and found another bug for the meta-cli..
The whole get argument is treated as a string key and the key 'foo.bar' maps to nothing. |
@minz1027 I only implemented
|
@minz1027 I fixed |
Blog post: http://blog.screwdriver.cd/post/158718077352/build-metadata |
Currently, there are almost no built-in ways to pass information between builds. The most common way is to use the value of the current Git tag. But that data cannot be guaranteed to be correct.
Given this simple pipeline:
The
deploy
job would need to know the version of the application that was published in themain
job, while thepromote
job would need to know the version that was tested in thedeploy
job. This information is not available with just that git tag.Instead, Screwdriver should provide a simple interface for reading/writing values that can be passed between builds in the same event.
Rules:
meta
is a command-line client (written in go) that is made available to the build container.meta set
should not output anything, except during failures (STDERR
).meta get
should output in string representation with no newlines (see appendix C).Stretch (gold bar):
meta
can read in from a file or STDIN.meta get --previous
can read from the previous successful event.Work
Preparation
Implementation
Outcome
Appendix
A - Metadata passing
Example pipeline:
main
{}
$ meta set coverage 99.52
{ "coverage": 99.52 }
package
{ "coverage": 99.52 }
$ meta set version v3.1.2
{ "coverage": 99.52, "version": "v3.1.2" }
deploy
{ "coverage": 99.52, "version": "v3.1.2" }
$ meta set url http://example.com
{ "coverage": 99.52, "url": "http://example.com", "version": "v3.1.2" }
B - Input Interface Suggestions
note: the json structure below each line is just showing internal representation, not output
C - Output Interface Suggestions
note: the json structure above each line is just showing internal representation, not output
The text was updated successfully, but these errors were encountered: