Skip to content

Commit

Permalink
Fix bug in Scorecard tag Docker image creation (#1890)
Browse files Browse the repository at this point in the history
Co-authored-by: Azeem Shaikh <azeems@google.com>
  • Loading branch information
azeemshaikh38 and azeemsgoogle authored May 6, 2022
1 parent 8c97d46 commit 5758364
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions cloudbuild/scorecard-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,28 @@
# limitations under the License.

steps:
- id: 'Get Git history'
name: 'gcr.io/cloud-builders/git'
args: ['fetch', '--unshallow', '--tags', 'origin', '$COMMIT_SHA']
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '.',
'-t', 'gcr.io/openssf/scorecard:stable',
'-t', 'gcr.io/openssf/scorecard:$TAG_NAME',
'-f', 'Dockerfile']
- id: Get Git history
name: gcr.io/cloud-builders/git
args:
- fetch
- '--unshallow'
- '--tags'
- origin
- $COMMIT_SHA
- id: Get tag commit
name: gcr.io/cloud-builders/git
entrypoint: bash
args:
- '-c'
- >-
git rev-list -n 1 tags/$TAG_NAME > /workspace/commit-sha.txt
- id: Push docker tag
name: gcr.io/cloud-builders/docker
entrypoint: bash
args:
- '-c'
- >-
docker pull gcr.io/openssf/scorecard:$(cat /workspace/commit-sha.txt) &&
docker tag gcr.io/openssf/scorecard:$(cat /workspace/commit-sha.txt) gcr.io/openssf/scorecard:$TAG_NAME &&
docker push gcr.io/openssf/scorecard:$TAG_NAME
images: ['gcr.io/openssf/scorecard']

0 comments on commit 5758364

Please sign in to comment.