From e5d5d2e9689327e76cad32dc960bc8d7f3af4bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Mon, 19 Aug 2024 17:42:56 +0200 Subject: [PATCH] draft ci --- .github/workflows/test.yml | 60 ++++++++++++++++++++++++++++++++++++++ builder.dockerfile | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d1c62f9..0fe98dca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,34 @@ on: branches: - "*" +env: + GOPRIVATE: github.com/jetstack/venafi-connection-lib + jobs: vet: name: vet runs-on: ubuntu-22.04 container: golang:1.22 steps: + - name: Configure jetstack/venafi-connection-lib repo pull access + run: | + mkdir ~/.ssh + chmod 700 ~/.ssh + + echo "${{ secrets.DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB }}" > ~/.ssh/venafi_connection_lib_id + chmod 600 ~/.ssh/venafi_connection_lib_id + + cat <> ~/.ssh/config + Host venafi-connection-lib.github.com + HostName github.com + IdentityFile ~/.ssh/venafi_connection_lib_id + IdentitiesOnly yes + EOT + + cat <> ~/.gitconfig + [url "git@venafi-connection-lib.github.com:jetstack/venafi-connection-lib"] + insteadOf = https://github.com/jetstack/venafi-connection-lib + EOT - uses: actions/checkout@v4 - run: make vet shell: bash @@ -23,6 +45,25 @@ jobs: runs-on: ubuntu-22.04 container: golang:1.22 steps: + - name: Configure jetstack/venafi-connection-lib repo pull access + run: | + mkdir ~/.ssh + chmod 700 ~/.ssh + + echo "${{ secrets.DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB }}" > ~/.ssh/venafi_connection_lib_id + chmod 600 ~/.ssh/venafi_connection_lib_id + + cat <> ~/.ssh/config + Host venafi-connection-lib.github.com + HostName github.com + IdentityFile ~/.ssh/venafi_connection_lib_id + IdentitiesOnly yes + EOT + + cat <> ~/.gitconfig + [url "git@venafi-connection-lib.github.com:jetstack/venafi-connection-lib"] + insteadOf = https://github.com/jetstack/venafi-connection-lib + EOT - uses: actions/checkout@v4 - run: make test docker_build: @@ -39,6 +80,25 @@ jobs: DOCKER_DRIVER: overlay DOCKER_HOST: tcp://localhost:2375 steps: + - name: Configure jetstack/venafi-connection-lib repo pull access + run: | + mkdir ~/.ssh + chmod 700 ~/.ssh + + echo "${{ secrets.DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB }}" > ~/.ssh/venafi_connection_lib_id + chmod 600 ~/.ssh/venafi_connection_lib_id + + cat <> ~/.ssh/config + Host venafi-connection-lib.github.com + HostName github.com + IdentityFile ~/.ssh/venafi_connection_lib_id + IdentitiesOnly yes + EOT + + cat <> ~/.gitconfig + [url "git@venafi-connection-lib.github.com:jetstack/venafi-connection-lib"] + insteadOf = https://github.com/jetstack/venafi-connection-lib + EOT - name: Install Tools run: apk add --update make git jq rsync curl - name: Adding github workspace as safe directory diff --git a/builder.dockerfile b/builder.dockerfile index 32c6ed70..4496a10d 100644 --- a/builder.dockerfile +++ b/builder.dockerfile @@ -7,6 +7,9 @@ WORKDIR /go/github.com/jetstack/preflight COPY ./go.mod . COPY ./go.sum . +# Due to https://github.com/jetstack/venafi-connection-lib being private. +COPY ~/.ssh/ ~/.gitconfig /root/ + RUN go mod download ## Bring in everything else @@ -22,7 +25,6 @@ RUN make build-all-platforms \ OAUTH_CLIENT_SECRET=${oauth_client_secret} \ OAUTH_AUTH_SERVER_DOMAIN=${oauth_auth_server_domain} - RUN go install github.com/google/go-licenses@v1.6.0 # We need this '|| true' because go-licenses could fail to find a license so