Skip to content

Commit

Permalink
Fix signing Dockerfile
Browse files Browse the repository at this point in the history
Fix the path to the sign-file binary.
Build the signing image in CI.
  • Loading branch information
qbarrand committed Mar 2, 2023
1 parent 4343445 commit 503fa11
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ jobs:
path: kmm_local.tar
retention-days: 1

build-signing-image:
runs-on: ubuntu-latest

name: Build the signing image

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build the image
run: make signimage-build SIGNER_IMG=kmm-signimage:local

- name: Export the image
run: docker save -o kmm-signimage_local.tar kmm-signimage:local

- name: Upload the image
uses: actions/upload-artifact@v3
with:
name: ci-images
if-no-files-found: error
path: kmm-signimage_local.tar
retention-days: 1

in-cluster-build:

runs-on: ubuntu-latest
Expand All @@ -56,8 +79,10 @@ jobs:
with:
name: ci-images

- name: Import the KMMO image into minikube
run: minikube image load kmm_local.tar
- name: Import the KMM images into minikube
run: |
minikube image load kmm_local.tar
minikube image load kmm-signimage_local.tar
- name: Cache binaries needed by Makefile
id: cache-bin
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ catalog-push: ## Push a catalog image.

.PHONY: signimage-build
signimage-build: ## Build docker image with the signer.
docker build -f Dockerfile.signimage -t $(SIGNER_IMG)
docker build -f Dockerfile.signimage -t $(SIGNER_IMG) .

include docs.mk

3 changes: 3 additions & 0 deletions ci/install-ci/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ patchesStrategicMerge:
containers:
- name: manager
imagePullPolicy: Never
env:
- name: RELATED_IMAGES_SIGN
value: kmm-signimage:local
4 changes: 2 additions & 2 deletions internal/sign/job/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ USER 0
RUN ["mkdir", "/signroot"]
COPY --from=source /modules/simple-kmod.ko /signroot/modules/simple-kmod.ko
RUN /sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot/modules/simple-kmod.ko
RUN /usr/local/bin/sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot/modules/simple-kmod.ko
COPY --from=source /modules/simple-procfs-kmod.ko /signroot/modules/simple-procfs-kmod.ko
RUN /sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot/modules/simple-procfs-kmod.ko
RUN /usr/local/bin/sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot/modules/simple-procfs-kmod.ko
FROM source
Expand Down
2 changes: 1 addition & 1 deletion internal/sign/job/templates/Dockerfile.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ USER 0
RUN ["mkdir", "/signroot"]
{{ range .FilesToSign }}
COPY --from=source {{ . }} /signroot{{ . }}
RUN /sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot{{ . }}
RUN /usr/local/bin/sign-file sha256 /run/secrets/key/key.pem /run/secrets/cert/cert.pem /signroot{{ . }}
{{- end }}

FROM source
Expand Down

0 comments on commit 503fa11

Please sign in to comment.