Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize: do not build go application and docker image each time #36

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 48 additions & 26 deletions .github/workflows/caname-id-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
type: string
description: "Version of Go used to build ncm-issuer image"
required: true
image-artifact-name:
type: string
description: "Name of the ncm-issuer image artifact"
required: true

jobs:
ca-id-test:
Expand All @@ -28,11 +32,14 @@ jobs:
- name: Set KUBECONFIG for MicroK8s
run: echo "KUBECONFIG=/var/snap/microk8s/current/credentials/client.config" >> $GITHUB_ENV

- name: "build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer.tar
sudo microk8s ctr image import ncm-issuer.tar
- name: "Download ncm-issuer image"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: .

- name: "Load ncm-issuer image"
run: sudo microk8s ctr image import ${{ inputs.image-artifact-name }}.tar

- name: "install cert-manager charts"
run: |
Expand Down Expand Up @@ -98,10 +105,13 @@ jobs:
sudo microk8s.kubectl apply -f data/ncm-issuer.yml
sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for ncm-issuer readiness"
run: |
while [[ $(sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer -o jsonpath="{.items[0].status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for ncm-issuer to be ready..."
sleep 1
done
echo "ncm-issuer is ready"

- name: "check issuer status"
run: |
Expand All @@ -114,10 +124,13 @@ jobs:
run: |
sudo microk8s.kubectl apply -f data/cert-resource.yml

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for certificate readiness"
run: |
while [[ $(sudo microk8s.kubectl get certificate.cert-manager.io/ncm-cert -n ncm-issuer -o jsonpath="{.status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for certificate to be ready..."
sleep 1
done
echo "Certificate is ready"

- name: "check certificate resource"
run: |
Expand Down Expand Up @@ -179,11 +192,14 @@ jobs:
- name: Set KUBECONFIG for MicroK8s
run: echo "KUBECONFIG=/var/snap/microk8s/current/credentials/client.config" >> $GITHUB_ENV

- name: "build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer.tar
sudo microk8s ctr image import ncm-issuer.tar
- name: "Download ncm-issuer image"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: .

- name: "Load ncm-issuer image"
run: sudo microk8s ctr image import ${{ inputs.image-artifact-name }}.tar

- name: "install cert-manager charts"
run: |
Expand Down Expand Up @@ -246,10 +262,13 @@ jobs:
sudo microk8s.kubectl apply -f data/ncm-issuer.yml
sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for ncm-issuer readiness"
run: |
while [[ $(sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer -o jsonpath="{.items[0].status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for ncm-issuer to be ready..."
sleep 1
done
echo "ncm-issuer is ready"

- name: "check issuer status"
run: |
Expand All @@ -262,10 +281,13 @@ jobs:
run: |
sudo microk8s.kubectl apply -f data/cert-resource.yml

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for certificate readiness"
run: |
while [[ $(sudo microk8s.kubectl get certificate.cert-manager.io/ncm-cert -n ncm-issuer -o jsonpath="{.status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for certificate to be ready..."
sleep 1
done
echo "Certificate is ready"

- name: "check certificate resource"
run: |
Expand Down
39 changes: 26 additions & 13 deletions .github/workflows/clientauth-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
type: string
description: "Version of Go used to build ncm-issuer image"
required: true
image-artifact-name:
type: string
description: "Name of the ncm-issuer image artifact"
required: true

jobs:
client-auth-test:
Expand Down Expand Up @@ -33,11 +37,14 @@ jobs:
- name: Set KUBECONFIG for MicroK8s
run: echo "KUBECONFIG=/var/snap/microk8s/current/credentials/client.config" >> $GITHUB_ENV

- name: "build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer.tar
sudo microk8s ctr image import ncm-issuer.tar
- name: "Download ncm-issuer image"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: .

- name: "Load ncm-issuer image"
run: sudo microk8s ctr image import ${{ inputs.image-artifact-name }}.tar

- name: "install cert-manager charts"
run: |
Expand Down Expand Up @@ -113,10 +120,13 @@ jobs:
sudo microk8s.kubectl apply -f data/ncm-issuer.yml
sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer

- name: "sleep for 15s"
uses: juliangruber/sleep-action@v1
with:
time: 15s
- name: "wait for ncm-issuer readiness"
run: |
while [[ $(sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer -o jsonpath="{.items[0].status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for ncm-issuer to be ready..."
sleep 1
done
echo "ncm-issuer is ready"

- name: "check issuer status"
run: |
Expand All @@ -129,10 +139,13 @@ jobs:
run: |
sudo microk8s.kubectl apply -f data/cert-resource.yml

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for certificate readiness"
run: |
while [[ $(sudo microk8s.kubectl get certificate.cert-manager.io/ncm-cert -n ncm-issuer -o jsonpath="{.status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for certificate to be ready..."
sleep 1
done
echo "Certificate is ready"

- name: "check certificate resource"
run: |
Expand Down
33 changes: 28 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,66 @@ jobs:
- uses: actions/checkout@v4
- uses: arnested/go-version-action@v1
id: versions
build-image:
name: "Build ncm-issuer image"
runs-on: ubuntu-latest
needs: go-versions
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- run: go version
- name: "Build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer-image.tar
echo "ncm-issuer image built and saved to ncm-issuer-image.tar"
- name: "Upload ncm-issuer image"
uses: actions/upload-artifact@v3
with:
name: ncm-issuer-image
path: ncm-issuer-image.tar

clientauth:
name: "clientauth test"
needs: go-versions
needs: [go-versions, build-image]
uses: ./.github/workflows/clientauth-test.yml
secrets: inherit
with:
go-version: ${{ fromJSON(needs.go-versions.outputs.go-mod-version) }}
image-artifact-name: ncm-issuer-image

caname-id:
name: "ca name/id tests"
needs: go-versions
needs: [go-versions, build-image]
uses: ./.github/workflows/caname-id-test.yml
secrets: inherit
with:
go-version: ${{ fromJSON(needs.go-versions.outputs.go-mod-version) }}
image-artifact-name: ncm-issuer-image

signer:
name: "signer test"
needs: go-versions
needs: [go-versions, build-image]
uses: ./.github/workflows/signer-tests.yml
secrets: inherit
with:
go-version: ${{ fromJSON(needs.go-versions.outputs.go-mod-version) }}
image-artifact-name: ncm-issuer-image

pkey:
name: "pkey tests"
needs: go-versions
needs: [go-versions, build-image]
uses: ./.github/workflows/pkey-tests.yml
secrets: inherit
with:
go-version: ${{ fromJSON(needs.go-versions.outputs.go-mod-version) }}
image-artifact-name: ncm-issuer-image

san:
name: "san test"
needs: go-versions
needs: [go-versions, build-image]
uses: ./.github/workflows/san-test.yml
secrets: inherit
with:
go-version: ${{ fromJSON(needs.go-versions.outputs.go-mod-version) }}
image-artifact-name: ncm-issuer-image
74 changes: 48 additions & 26 deletions .github/workflows/pkey-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
type: string
description: "Version of Go used to build ncm-issuer image"
required: true
image-artifact-name:
type: string
description: "Name of the ncm-issuer image artifact"
required: true

jobs:
ecdsa-test:
Expand All @@ -31,11 +35,14 @@ jobs:
- name: Set KUBECONFIG for MicroK8s
run: echo "KUBECONFIG=/var/snap/microk8s/current/credentials/client.config" >> $GITHUB_ENV

- name: "build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer.tar
sudo microk8s ctr image import ncm-issuer.tar
- name: "Download ncm-issuer image"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: .

- name: "Load ncm-issuer image"
run: sudo microk8s ctr image import ${{ inputs.image-artifact-name }}.tar

- name: "install cert-manager charts"
run: |
Expand Down Expand Up @@ -107,10 +114,13 @@ jobs:
sudo microk8s.kubectl apply -f data/ncm-issuer.yml
sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer

- name: "sleep for 15s"
uses: juliangruber/sleep-action@v1
with:
time: 15s
- name: "wait for ncm-issuer readiness"
run: |
while [[ $(sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer -o jsonpath="{.items[0].status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for ncm-issuer to be ready..."
sleep 1
done
echo "ncm-issuer is ready"

- name: "check issuer status"
run: |
Expand All @@ -123,10 +133,13 @@ jobs:
run: |
sudo microk8s.kubectl apply -f data/cert-resource.yml

- name: "sleep for 15s"
uses: juliangruber/sleep-action@v1
with:
time: 15s
- name: "wait for certificate readiness"
run: |
while [[ $(sudo microk8s.kubectl get certificate.cert-manager.io/ncm-cert -n ncm-issuer -o jsonpath="{.status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for certificate to be ready..."
sleep 1
done
echo "Certificate is ready"

- name: "check certificate resource"
run: |
Expand Down Expand Up @@ -212,11 +225,14 @@ jobs:
- name: Set KUBECONFIG for MicroK8s
run: echo "KUBECONFIG=/var/snap/microk8s/current/credentials/client.config" >> $GITHUB_ENV

- name: "build ncm-issuer image"
run: |
make docker-build
docker save ncm-issuer > ncm-issuer.tar
sudo microk8s ctr image import ncm-issuer.tar
- name: "Download ncm-issuer image"
uses: actions/download-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: .

- name: "Load ncm-issuer image"
run: sudo microk8s ctr image import ${{ inputs.image-artifact-name }}.tar

- name: "install cert-manager charts"
run: |
Expand Down Expand Up @@ -287,10 +303,13 @@ jobs:
sudo microk8s.kubectl apply -f data/ncm-issuer.yml
sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer

- name: "sleep for 10s"
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: "wait for ncm-issuer readiness"
run: |
while [[ $(sudo microk8s.kubectl get issuers.certmanager.ncm.nokia.com -n ncm-issuer -o jsonpath="{.items[0].status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for ncm-issuer to be ready..."
sleep 1
done
echo "ncm-issuer is ready"

- name: "check issuer status"
run: |
Expand All @@ -303,10 +322,13 @@ jobs:
run: |
sudo microk8s.kubectl apply -f data/cert-resource.yml

- name: "sleep for 15s"
uses: juliangruber/sleep-action@v1
with:
time: 15s
- name: "wait for certificate readiness"
run: |
while [[ $(sudo microk8s.kubectl get certificate.cert-manager.io/ncm-cert -n ncm-issuer -o jsonpath="{.status.conditions[?(@.type=='Ready')].status}") != "True" ]]; do
echo "Waiting for certificate to be ready..."
sleep 1
done
echo "Certificate is ready"

- name: "check certificate resource"
run: |
Expand Down
Loading
Loading