File tree Expand file tree Collapse file tree 11 files changed +94
-43
lines changed
Expand file tree Collapse file tree 11 files changed +94
-43
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
1312 permissions :
1413 contents : read
2019 uses : actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
2120
2221 - name : The malicious step
22+ env :
23+ IMAGE_NAME : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
2324 run : |
2425 make build-malicious-image
2526
@@ -41,23 +42,25 @@ jobs:
4142 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
4243 with :
4344 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+ tags : |
46+ type=raw,value=latest
47+ type=raw,value=daily
4448
4549 - name : Build and push Docker image
4650 id : build-and-push
4751 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
4852 with :
4953 context : .
5054 push : ${{ github.event_name != 'pull_request' }}
51- tags : ghcr.io/ ${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:daily
55+ tags : ${{ steps.meta.outputs.tags }}
5256 labels : ${{ steps.meta.outputs.labels }}
5357 cache-from : type=gha
5458 cache-to : type=gha,mode=max
5559
56-
5760 - name : Sign the published Docker image
5861 env :
62+ TAGS : ${{ steps.meta.outputs.tags }}
5963 DIGEST : ${{ steps.build-and-push.outputs.digest }}
6064 run : |
6165 cosign version
62- echo "ghcr.io/${{ github.repository }}:daily" | xargs -I {} cosign sign --yes {}@${DIGEST}
63- echo "ghcr.io/${{ github.repository }}:latest" | xargs -I {} cosign sign --yes {}@${DIGEST}
66+ echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
1312 permissions :
1413 contents : read
@@ -37,20 +36,22 @@ jobs:
3736 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
3837 with :
3938 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+ tags : |
40+ type=raw,value=static
4041
4142 - name : Build and push Docker image
4243 id : build-and-push
4344 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
4445 with :
4546 push : true
46- tags : ghcr.io/ ${{ github.repository }}:static
47+ tags : ${{ steps.meta.outputs.tags }}
4748 context : .
48- file : Dockerfile.static
49-
49+ file : Dockerfile.static
5050
5151 - name : Sign the published Docker image
5252 env :
53+ TAGS : ${{ steps.meta.outputs.tags }}
5354 DIGEST : ${{ steps.build-and-push.outputs.digest }}
5455 run : |
5556 cosign version
56- echo "ghcr.io/${{ github.repository }}:static " | xargs -I {} cosign sign --yes {}@${DIGEST}
57+ echo "${TAGS} " | xargs -I {} cosign sign --yes {}@${DIGEST}
Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
1312 permissions :
1413 contents : read
@@ -37,20 +36,22 @@ jobs:
3736 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
3837 with :
3938 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+ tags : |
40+ type=raw,value=static
4041
4142 - name : Build and push Docker image
4243 id : build-and-push
4344 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
4445 with :
4546 push : true
46- tags : ghcr.io/ ${{ github.repository }}:static
47+ tags : ${{ steps.meta.outputs.tags }}
4748 context : .
48- file : Dockerfile.static
49-
49+ file : Dockerfile.static
5050
5151 - name : Sign the published Docker image
5252 env :
53+ TAGS : ${{ steps.meta.outputs.tags }}
5354 DIGEST : ${{ steps.build-and-push.outputs.digest }}
5455 run : |
5556 cosign version
56- echo "ghcr.io/${{ github.repository }}:static " | xargs -I {} cosign sign --yes {}@${DIGEST}
57+ echo "${TAGS} " | xargs -I {} cosign sign --yes {}@${DIGEST}
Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
1312 permissions :
1413 contents : read
@@ -37,23 +36,25 @@ jobs:
3736 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
3837 with :
3938 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+ tags : |
40+ type=raw,value=latest
41+ type=raw,value=daily
4042
4143 - name : Build and push Docker image
4244 id : build-and-push
4345 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
4446 with :
4547 context : .
4648 push : ${{ github.event_name != 'pull_request' }}
47- tags : ghcr.io/ ${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:daily
49+ tags : ${{ steps.meta.outputs.tags }}
4850 labels : ${{ steps.meta.outputs.labels }}
4951 cache-from : type=gha
5052 cache-to : type=gha,mode=max
5153
52-
5354 - name : Sign the published Docker image
5455 env :
56+ TAGS : ${{ steps.meta.outputs.tags }}
5557 DIGEST : ${{ steps.build-and-push.outputs.digest }}
5658 run : |
5759 cosign version
58- echo "ghcr.io/${{ github.repository }}:daily" | xargs -I {} cosign sign --yes {}@${DIGEST}
59- echo "ghcr.io/${{ github.repository }}:latest" | xargs -I {} cosign sign --yes {}@${DIGEST}
60+ echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ name: image-signed-ghat(latest)-malicious
22on :
33 workflow_dispatch :
44
5+ env :
6+ REGISTRY : ghcr.io
7+ IMAGE_NAME : ${{ github.repository }}
8+
59jobs :
610 build :
711 runs-on : ubuntu-latest
1620 uses : actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
1721
1822 - name : The malicious step
23+ env :
24+ IMAGE_NAME : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
1925 run : |
2026 make build-malicious-image
2127
@@ -26,12 +32,20 @@ jobs:
2632 username : ${{ github.actor }}
2733 password : ${{ secrets.GITHUB_TOKEN }}
2834
35+ - name : Extract Docker metadata
36+ id : meta
37+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
38+ with :
39+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+ tags : |
41+ type=raw,value=latest
42+
2943 - name : Build and push image
3044 id : push-step
3145 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
3246 with :
3347 push : true
34- tags : ghcr.io/ ${{ github.repository }}:latest
48+ tags : ${{ steps.meta.outputs.tags }}
3549 context : .
3650
3751 - name : Attest image
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ name: image-signed-ghat(static)-copied
22on :
33 workflow_dispatch :
44
5+ env :
6+ REGISTRY : ghcr.io
7+ IMAGE_NAME : ${{ github.repository }}
8+
59jobs :
610 build :
711 runs-on : ubuntu-latest
@@ -22,14 +26,22 @@ jobs:
2226 username : ${{ github.actor }}
2327 password : ${{ secrets.GITHUB_TOKEN }}
2428
29+ - name : Extract Docker metadata
30+ id : meta
31+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
32+ with :
33+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+ tags : |
35+ type=raw,value=static
36+
2537 - name : Build and push image
2638 id : push-step
2739 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
2840 with :
2941 push : true
30- tags : ghcr.io/ ${{ github.repository }}:static
42+ tags : ${{ steps.meta.outputs.tags }}
3143 context : .
32- file : Dockerfile.static
44+ file : Dockerfile.static
3345
3446 - name : Attest image
3547
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ name: image-signed-ghat(static)
22on :
33 workflow_dispatch :
44
5+ env :
6+ REGISTRY : ghcr.io
7+ IMAGE_NAME : ${{ github.repository }}
8+
59jobs :
610 build :
711 runs-on : ubuntu-latest
@@ -22,14 +26,22 @@ jobs:
2226 username : ${{ github.actor }}
2327 password : ${{ secrets.GITHUB_TOKEN }}
2428
29+ - name : Extract Docker metadata
30+ id : meta
31+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
32+ with :
33+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+ tags : |
35+ type=raw,value=static
36+
2537 - name : Build and push image
2638 id : push-step
2739 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
2840 with :
2941 push : true
30- tags : ghcr.io/ ${{ github.repository }}:static
42+ tags : ${{ steps.meta.outputs.tags }}
3143 context : .
32- file : Dockerfile.static
44+ file : Dockerfile.static
3345
3446 - name : Attest image
3547
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ name: image-signed-ghat(latest)
22on :
33 workflow_dispatch :
44
5+ env :
6+ REGISTRY : ghcr.io
7+ IMAGE_NAME : ${{ github.repository }}
8+
59jobs :
610 build :
711 runs-on : ubuntu-latest
@@ -22,12 +26,20 @@ jobs:
2226 username : ${{ github.actor }}
2327 password : ${{ secrets.GITHUB_TOKEN }}
2428
29+ - name : Extract Docker metadata
30+ id : meta
31+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
32+ with :
33+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+ tags : |
35+ type=raw,value=latest
36+
2537 - name : Build and push image
2638 id : push-step
2739 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
2840 with :
2941 push : true
30- tags : ghcr.io/ ${{ github.repository }}:latest
42+ tags : ${{ steps.meta.outputs.tags }}
3143 context : .
3244
3345 - name : Attest image
Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
1312 permissions :
1413 contents : read
1918 - name : Checkout repository
2019 uses : actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
2120
22- # - name: Install Cosign
23- # uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
24- # with:
25- # cosign-release: 'v2.1.1'
26-
2721 - name : Setup Docker buildx
2822 uses : docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
2923
@@ -39,21 +33,17 @@ jobs:
3933 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
4034 with :
4135 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+ tags : |
37+ type=raw,value=latest
38+ type=raw,value=daily
4239
4340 - name : Build and push Docker image
4441 id : build-and-push
4542 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
4643 with :
4744 context : .
4845 push : ${{ github.event_name != 'pull_request' }}
49- tags : ghcr.io/ ${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:daily
46+ tags : ${{ steps.meta.outputs.tags }}
5047 labels : ${{ steps.meta.outputs.labels }}
5148 cache-from : type=gha
5249 cache-to : type=gha,mode=max
53-
54- # - name: Sign the published Docker image
55- # env:
56- # DIGEST: ${{ steps.build-and-push.outputs.digest }}
57- # run: |
58- # echo "ghcr.io/${{ github.repository }}:daily" | xargs -I {} cosign sign --yes {}@${DIGEST}
59- # echo "ghcr.io/${{ github.repository }}:latest" | xargs -I {} cosign sign --yes {}@${DIGEST}
Original file line number Diff line number Diff line change 11# Replace this with your image name, i.e. ghcr.io/<your-username>/demo-repo-js:latest
22IMAGE_NAME? =ghcr.io/stacklok/demo-repo-js:latest
33
4+ # Lowercase the image name to handle mixed-case GitHub org/repo names
5+ IMAGE_NAME := $(shell echo $(IMAGE_NAME ) | tr '[:upper:]' '[:lower:]')
6+
47# Replace this with your GitHub username and PAT.
58# This is used to authenticate with GitHub Container Registry (GHCR)
69# and push the image to your repository.
You can’t perform that action at this time.
0 commit comments