concourse / concourse/github-release-resource
Feature: Invalidate caches when a put is done to a version
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 57
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
The idea behind the following pipeline is that each subsequent job updates the body of the same pre-release until the final job does its update and makes that pre-release to become a normal release:
pipeline.yaml
resources:
- name: github-pre-release
type: github-release
source:
owner: foo
repository: bar
access_token: ((token))
release: false
pre_release: true
- name: github-release
type: github-release
source:
owner: foo
repository: bar
access_token: ((token))
release: true
pre_release: false
jobs:
- name: job1
serial: true
plan:
- get: github-pre-release
trigger: true
- task: update-release-body
config:
platform: linux
image_resource:
type: docker-image
source:
repository: alpine
inputs:
- name: github-pre-release
outputs:
- name: github-pre-release
run:
path: /bin/sh
args:
- -c
- |
echo "this is an update from job1" >> github-pre-release/body
- put: github-pre-release
inputs:
- github-pre-release
params:
name: github-pre-release/tag
tag: github-pre-release/tag
commitish: github-pre-release/commit_sha
body: github-pre-release/body
- name: job2
serial: true
plan:
- get: github-pre-release
trigger: true
passed:
- job1
- task: update-release-body
config:
platform: linux
image_resource:
type: docker-image
source:
repository: alpine
inputs:
- name: github-pre-release
outputs:
- name: github-pre-release
run:
path: /bin/sh
args:
- -c
- |
echo "this is an update from job2" >> github-pre-release/body
- put: github-pre-release
inputs:
- github-pre-release
params:
name: github-pre-release/tag
tag: github-pre-release/tag
commitish: github-pre-release/commit_sha
body: github-pre-release/body
- name: job3
serial: true
plan:
- get: github-pre-release
trigger: true
passed:
- job2
- task: update-release-body
config:
platform: linux
image_resource:
type: docker-image
source:
repository: alpine
inputs:
- name: github-pre-release
outputs:
- name: github-pre-release
run:
path: /bin/sh
args:
- -c
- |
echo "this is an update from job3" >> github-pre-release/body
- put: github-pre-release
inputs:
- github-pre-release
params:
name: github-pre-release/tag
tag: github-pre-release/tag
commitish: github-pre-release/commit_sha
body: github-pre-release/body
- name: job4
serial: true
plan:
- get: github-pre-release
trigger: true
passed:
- job3
- task: update-release-body
config:
platform: linux
image_resource:
type: docker-image
source:
repository: alpine
inputs:
- name: github-pre-release
outputs:
- name: github-pre-release
run:
path: /bin/sh
args:
- -c
- |
echo "this is a final update from job4" >> github-pre-release/body
- put: github-release
inputs:
- github-release
params:
name: github-pre-release/tag
tag: github-pre-release/tag
commitish: github-pre-release/commit_sha
body: github-pre-release/body
However, it doesn't work as expected. The subsequent jobs don't get the updated body of the release most of the time (depending on cache accessibility/worker used, afaics), which results into a body like this:
this is an update from job2
this is a final update from job4
(in various combinations, but never a complete one from all 4 jobs).
I believe it matches the explanation from https://github.com/concourse/github-release-resource/issues/61#issuecomment-360503706:
This is working as expected of the caching semantics. When a resource version changes in-place, there's no way for Concourse to know that that same version is technically different now. I don't think it's an issue specific to this resource, but you could open a general issue to invalidate caches when a put is done to a version; that may be a route we can explore.
And is also similar to https://github.com/concourse/github-release-resource/issues/69.
Would storing more release metadata in Concourse solve the problem? E.g. not only the id, tag and timestamp, but also body, commit_sha, etc. Or perhaps some extra timestamp/hash value of the result of the last update of a resource by Concourse's put.
Concourse version: 7.6.0, resource version: bundled with Concourse (v1.6.4).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pipeline.yaml example and the linked cache-semantics discussions in issues #61 and #69. Trace how a put of an unchanged version is fetched by subsequent jobs; done means the intended cache behavior and any required metadata or invalidation mechanism are specified and validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, go
- Domain
- backend, ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100