简体   繁体   中英

Concourse CI and Build number

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.

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM