Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concourse CI and Build number

Tags:

I'm moving from Jenkins to using using Concourse CI to run my Sauce labs e2e tests. Sauce labs groups tests together that have the same build number string:

        name: 'Chrome XS',
        browserName: 'chrome',
        tunnelIdentifier: process.env.TUNNEL_IDENTIFIER,
        build: process.env.JENKINS_BUILD_NUMBER,
        platform: 'Windows 10',
        shardTestFiles: true,
        maxInstances: 20,

How can I pass the build number to my script using an environment variable as shown above. The Concourse GUI uses name #number. Is there any way to retrieve this. I tried printing all the environment variables in the docker container but it's not set by default.

like image 702
retroman Avatar asked Sep 29 '16 13:09

retroman


People also ask

What is a concourse build?

A Concourse pipeline is like a distributed, continuous Makefile . Each job has a build plan declaring the job's input resources and what to run with them when they change. Your pipeline is then visualized in the web UI, taking only one click to get from a failed job to seeing why it failed.

What is Concourse CI?

Concourse is a pipeline-based continuous thing-doer. The word "pipeline" is all the rage in CI these days, so being more specific about this term is kind of important; Concourse's pipelines are significantly different from the rest.

How do I know what version of Concourse I have?

/api/v1/info should tell you the version of Concourse (which goes in lockstep with the version of the fly CLI). Note that the fly cli will warn you if you are using a version of the CLI that's out of sync with the version of Concourse you are targetting.


2 Answers

Metadata like the build number/ID are intentionally not provided to tasks. See https://concourse-ci.org/implementing-resources.html#resource-metadata

This sounds like potentially a use case for a Sauce Labs resource?

like image 87
Alex Suraci Avatar answered Sep 22 '22 17:09

Alex Suraci


In Concourse, build metadata is only available for resources, not tasks.

An example on using build metadata with resources is to include it as part of build results notification emails. The following blog entry contains more information about it: http://lmpsilva.typepad.com/cilounge/2016/10/how-to-insert-build-metadata-into-user-notifications-in-concourse.html

If you really want to use build number for versioning, you could try to create your own Concourse resource that would return the version number, however, I would use your code commit number instead. Another alternative would be to use the Semver resource in Concourse: https://github.com/concourse/semver-resource

like image 45
L Silva Avatar answered Sep 26 '22 17:09

L Silva