Skip to content

Add Timestamp git metadata file#329

Merged
jamieklassen merged 4 commits intoconcourse:masterfrom
ngehrsitz:git-timestamp
Aug 12, 2020
Merged

Add Timestamp git metadata file#329
jamieklassen merged 4 commits intoconcourse:masterfrom
ngehrsitz:git-timestamp

Conversation

@ngehrsitz
Copy link
Contributor

This pull request improves upon #306.

It adds generation of a timestamp metadata file that can be used to tag builds. The output format can also be specified. This is useful when running parallel builds of a pipeline to determine which version is more up to date after pushing to a build storage like artifactory.

Signed-off-by: Norman Gehrsitz <gehrsitz.norman@student.dhbw-karlsruhe.de>
Signed-off-by: Norman Gehrsitz <gehrsitz.norman@student.dhbw-karlsruhe.de>
Signed-off-by: Norman Gehrsitz <gehrsitz.norman@student.dhbw-karlsruhe.de>
Signed-off-by: Norman Gehrsitz <gehrsitz.norman@student.dhbw-karlsruhe.de>
Copy link
Member

@jamieklassen jamieklassen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really excellent PR! I was able to test it out by using the following pipeline.yml:

---
resource_types:
- name: git
  type: registry-image
  source:
    repository: concourse/git-resource
    tag: pr-ubuntu-329
resources:
- name: ft
  type: git
  source:
    uri: https://github.com/concourse/ft
jobs:
- name: check-timestamp
  plan:
  - get: ft
    params:
      timestamp_format: ((format))
  - task: read-timestamp
    config:
      platform: linux
      image_resource:
        type: registry-image
        source: {repository: busybox}
      inputs:
      - name: ft
      run:
        path: cat
        args: ["ft/.git/commit_timestamp"]

so that doing stuff like fly -t dev sp -n -p manual-test -c pipeline.yml -v format=rfc gives me something like

% fly -t dev tj -w -j manual-test/check-timestamp
started manual-test/check-timestamp #7

Cloning into '/tmp/build/get'...
6d13a0d publish continuously
initializing
running cat ft/.git/commit_timestamp
Wed, 5 Aug 2020 12:13:29 -0400
succeeded

The tests are good, as is the documentation!

@jamieklassen jamieklassen merged commit 3c68b5f into concourse:master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants