concourse / semver-resource

automated semantic version bumping
Apache License 2.0
97 stars 105 forks source link

[Question] How to use bumped version in image tag file? (as opposed to version when the job started) #120

Closed jewbetcha closed 3 years ago

jewbetcha commented 3 years ago

We're using semver to bump versions of our project, the version file is then used as the tag for our image outputs. Config is pretty standard:

resources:
- name: version
    type: semver
    source:
      driver: git
      branch: master
      uri: repo.git
      file: path/to/version

jobs:
  - name: build
    plan:
      - get: version
        params:
          bump: minor
  - get: repo
     trigger: true
   ...
  - put: version
     params:
        bump: minor
  - inputs:
        - repo
        - assets
        - version
      params:
          build: assets
          tag_file: path/to/version
        put: image

(sorry for bad YAML formatting!)

As it stands, the version bumps correctly and commits the change, however the tag file for the image is always the version that the repo contained when the job started.

i.e. job starts with v 0.0.1 -> bumps to 0.0.2 -> commits 0.0.2 -> image pushed with 0.0.1

Is there a way for concourse to use the new bumped version for the tag file?

Thank you!

jewbetcha commented 3 years ago

Ended up solving this with the help of fly hijack. After poking around the build containers, I discovered that during the version put step, the new file will live under a put/ directory, which you can then use for tag_file

i.e. tag_file: /tmp/build/put/version/version

Closing!