Starter Pipeline with SemVer
Concourse Pipeline with Semantic Versioning (SemVer)
code-repo
- repo with the code to build and testartifact
- s3 location to which a built tarball will goversion
- s3 file containing the version number associated with the code
This pipeline
- "performs a build" and, if the build is successful, the pipeline bumps its patch-level semver number
- creates a tarball with the build artifact and includes the semver in the name
- uploads the resulting tarball to S3
resources:- name: versiontype: semversource:driver: s3initial_version: 0.0.0access_key_id: ((aws_access))secret_access_key: ((aws_secret))bucket: trullla-artifactskey: semver-example/version- name: code-repotype: gitsource:branch: masterprivate_key: ((deploy_key))uri: git@gitlab.com:myrepo/ci-repo.git- name: artifacttype: s3source:access_key_id: ((aws_access))secret_access_key: ((aws_secret))bucket: trullla-artifactsregexp: mypackage/mypackage-(.*).tar.gzregion_name: ((aws_region))jobs:- name: buildplan:- get: code-repo- get: versionparams:bump: patch- task: buildconfig:platform: linuximage_resource:type: docker-imagesource:repository: alpineparams:PACKAGE_NAME: mypackageinputs:- name: code-repo- name: versionrun:path: /bin/shargs:- -c- |set -ecd code-repo# do the building, e.g.mkdir buildtouch build/outputcd -- put: versionparams: {file: version/version}- name: packageplan:- get: versionpassed: [ build ]- get: code-repotrigger: truepassed: [ build ]- task: buildconfig:platform: linuximage_resource:type: docker-imagesource:repository: alpineparams:PACKAGE_NAME: mypackageinputs:- name: code-repo- name: versionoutputs:- name: tarballrun:path: /bin/shargs:- -c- |set -eVERSION="$(cat version/version)"PACKAGE="${PACKAGE_NAME}-${VERSION}"cd code-repo# do the building, e.g.mkdir buildcp *.* buildcd -cp -a code-repo/build "${PACKAGE}"tar czf tarball/"${PACKAGE}.tar.gz" "${PACKAGE}"- put: artifactparams:file: tarball/*.tar.gz