Skip to content

Commit 3aa1b08

Browse files
Add gokakashi scanning in CI (#54)
1 parent 7c1f637 commit 3aa1b08

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

.github/workflows/ndc-nodejs-lambda-connector.yaml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ jobs:
7575
steps:
7676
- uses: actions/checkout@v4
7777

78+
- name: Set up containerd
79+
uses: crazy-max/ghaction-setup-containerd@v3
80+
81+
- name: Fix containerd socket permissions
82+
run: |
83+
sudo chgrp docker /run/containerd/containerd.sock
84+
7885
- name: Set up QEMU
7986
uses: docker/setup-qemu-action@v3
8087

@@ -102,15 +109,58 @@ jobs:
102109
shell: bash
103110
working-directory: ./ndc-lambda-sdk
104111

105-
- uses: docker/build-push-action@v6
112+
- name: Build docker image
113+
uses: docker/build-push-action@v6
114+
with:
115+
context: .
116+
build-args: |
117+
CONNECTOR_VERSION=${{ steps.get-npm-package-version.outputs.package_version }}
118+
platforms: linux/amd64,linux/arm64
119+
tags: ${{ steps.docker-metadata.outputs.tags }}
120+
labels: ${{ steps.docker-metadata.outputs.labels }}
121+
outputs: type=oci,dest=/tmp/image.tar # Export the image to a tar so it can be imported into containerd so gokakashi can scan it
122+
123+
- name: Import docker image into containerd store
124+
run: |
125+
ctr images import --base-name ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} --digests --all-platforms /tmp/image.tar
126+
127+
- name: Get first docker tag for gokakashi
128+
id: first-docker-tag
129+
run: |
130+
FIRST_TAG=$(echo "${{ steps.docker-metadata.outputs.tags }}" | head -n 1)
131+
echo "First docker tag: $FIRST_TAG"
132+
echo "tag=$FIRST_TAG" >> $GITHUB_OUTPUT
133+
134+
- name: Scan docker image with gokakashi
135+
uses: shinobistack/[email protected]
136+
with:
137+
image: ${{ steps.first-docker-tag.outputs.tag }}
138+
labels: agentKey=${{ github.run_id }}
139+
policy: ci-platform
140+
server: https://gokakashi-server.hasura-app.io
141+
token: ${{ secrets.GOKAKASHI_API_TOKEN }}
142+
cf_client_id: ${{ secrets.CF_ACCESS_CLIENT_ID }}
143+
cf_client_secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
144+
interval: 10
145+
retries: 8
146+
147+
- name: Upload Trivy report as artifact
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: trivy-report
151+
path: /tmp/trivy-report-*.json
152+
153+
- name: Push docker image
154+
uses: docker/build-push-action@v6
155+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
106156
with:
107157
context: .
108158
build-args: |
109159
CONNECTOR_VERSION=${{ steps.get-npm-package-version.outputs.package_version }}
110-
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
111160
platforms: linux/amd64,linux/arm64
112161
tags: ${{ steps.docker-metadata.outputs.tags }}
113162
labels: ${{ steps.docker-metadata.outputs.labels }}
163+
push: true
114164

115165
release-connector:
116166
name: Release connector

0 commit comments

Comments
 (0)