Skip to content

Commit 161b8b0

Browse files
Merge pull request #2014 from Devils-Knight/issue-docker
Update Format for Pinning Docker Actions
2 parents b9b32d3 + 25f90b0 commit 161b8b0

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

remediation/workflow/pin/pindocker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ func pinDocker(action, jobName, inputYaml string) (string, bool) {
6666
return inputYaml, updated
6767
}
6868

69-
pinnedAction := fmt.Sprintf("%s:%s@%s # %s", leftOfAt[0], leftOfAt[1], imghash.String(), tag)
69+
pinnedAction := fmt.Sprintf("%s:%s:%s@%s", leftOfAt[0], leftOfAt[1], tag, imghash.String())
7070
inputYaml = strings.ReplaceAll(inputYaml, action, pinnedAction)
7171
// Revert the extra hash for already pinned docker actions
7272
inputYaml = strings.ReplaceAll(inputYaml, pinnedAction+"@", action+"@")
73+
inputYaml = strings.ReplaceAll(inputYaml, pinnedAction+":", action+":")
7374
updated = !strings.EqualFold(action, pinnedAction)
7475
return inputYaml, updated
7576
}

testfiles/pindockers/input/dockeraction.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
args: sh -c "cd conker && make --jobs"
4040
- name: Perform make replace
41-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
41+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
4242
with:
4343
args: sh -c "cd conker && make replace"
4444

testfiles/pindockers/output/dockeraction.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,30 @@ jobs:
2525
run: echo ${{ secrets.CONKER_BASEROM_US }} | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom/baserom.us.z64.aes -out baserom.us.z64
2626

2727
- name: Perform make extract (rom)
28-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
28+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
2929
with:
3030
args: make extract
3131

3232
- name: Perform make extract (code)
33-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
33+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
3434
with:
3535
args: sh -c "cd conker && make extract"
3636
- name: Perform make (code)
37-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
37+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
3838
with:
3939
args: sh -c "cd conker && make --jobs"
4040
- name: Perform make replace
41-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
41+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
4242
with:
4343
args: sh -c "cd conker && make replace"
4444

4545
- name: Perform make
46-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
46+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
4747
with:
4848
args: make --jobs
4949

5050
- name: Create progress.csv
51-
uses: docker://docker.io/markstreet/conker@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0 # latest
51+
uses: docker://docker.io/markstreet/conker:latest@sha256:1efef3bbdd297d1b321b9b4559092d3131961913bc68b7c92b681b4783d563f0
5252
with:
5353
args: sh -c "cd conker && make progress"
5454

testfiles/pindockers/output/gcraction.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
go-version: ${{ env.GO_VERSION }}
2020

2121
- name: Container structure test (scratch)
22-
uses: docker://gcr.io/gcp-runtimes/container-structure-test@sha256:4affda1c8f058f8d6c86dcad965cdb438a3d1d9a982828ff6737ea492b6bc8ce # latest
22+
uses: docker://gcr.io/gcp-runtimes/container-structure-test:latest@sha256:4affda1c8f058f8d6c86dcad965cdb438a3d1d9a982828ff6737ea492b6bc8ce
2323
with:
2424
args: 'test --image ffurrer/semver:latest --config test/semver_container_test.yml'
2525

2626
- name: Container structure test (alpine)
27-
uses: docker://gcr.io/gcp-runtimes/container-structure-test@sha256:4affda1c8f058f8d6c86dcad965cdb438a3d1d9a982828ff6737ea492b6bc8ce # latest
27+
uses: docker://gcr.io/gcp-runtimes/container-structure-test:latest@sha256:4affda1c8f058f8d6c86dcad965cdb438a3d1d9a982828ff6737ea492b6bc8ce
2828
with:
2929
args: 'test --image ffurrer/semver:alpine --config test/semver_alpine_container_test.yml'
3030

testfiles/pindockers/output/ghcraction.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v1
1414
- name: Integration test
15-
uses: docker://ghcr.io/step-security/integration-test/int@sha256:f1f95204dc1f12a41eaf41080185e2d289596b3e7637a8c50a3f6fbe17f99649 # latest
15+
uses: docker://ghcr.io/step-security/integration-test/int:latest@sha256:f1f95204dc1f12a41eaf41080185e2d289596b3e7637a8c50a3f6fbe17f99649
1616
env:
1717
PAT: ${{ secrets.PAT }}

0 commit comments

Comments
 (0)