Concourse CI and Build number

瘦欲@ 提交于 2019-12-23 15:23:01

问题


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.


回答1:


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?




回答2:


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



来源:https://stackoverflow.com/questions/39771347/concourse-ci-and-build-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!