-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5043156
commit 3daa75b
Showing
1 changed file
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,25 +30,23 @@ jobs: | |
with: | ||
version: v1.60 | ||
|
||
# test: | ||
# name: Test code | ||
# needs: golangci | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: actions/setup-go@v5 | ||
# with: | ||
# go-version: '1.23' | ||
# cache: true | ||
# cache-dependency-path: go.sum | ||
# - name: Run tests | ||
# run: | | ||
# make test | ||
# make integration-test | ||
test: | ||
name: Test code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23' | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: Run tests | ||
run: | | ||
make test | ||
make integration-test | ||
build-docker-image: | ||
name: Build Docker image | ||
# needs: test | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
|
@@ -121,7 +119,7 @@ jobs: | |
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' }} | ||
uses: helm/[email protected] | ||
with: | ||
config: ${{ github.workspace }}/src/test/kind-config.yaml | ||
config: ${{ github.workspace }}/test/kind-config.yaml | ||
|
||
- name: Set up kubectl | ||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' }} | ||
|
@@ -137,7 +135,7 @@ jobs: | |
- name: Run chart-testing (install) | ||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.event.inputs.deploy_to_dev == 'true' || github.event.inputs.build_and_push == 'true' }} | ||
run: | | ||
cd src/kubenetmon/deploy/helm | ||
cd kubenetmon/deploy/helm | ||
ct install \ | ||
--config ../../../.github/workflows/configs/ct.yaml \ | ||
--target-branch ${{ github.event.repository.default_branch }} \ | ||
|
@@ -165,3 +163,35 @@ jobs: | |
--set=region=europe-north1 \ | ||
--set=environment=development \ | ||
--set=cloud=gcp" | ||
docker-publish: | ||
name: Publish Docker image | ||
needs: [golangci, test, build-docker-image, helm-test] | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Download Docker image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docker-image | ||
|
||
- name: Load Docker image | ||
run: docker load -i image.tar | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push to GitHub Container Registry | ||
run: | | ||
IMAGE_TAG=$(echo ${{ needs.build-and-push-image.outputs.image-tags }} | cut -d':' -f2) | ||
docker tag ${{ needs.build-and-push-image.outputs.image-tags }} ghcr.io/${{ github.repository }}:$IMAGE_TAG | ||
docker tag ${{ needs.build-and-push-image.outputs.image-tags }} ghcr.io/${{ github.repository }}:latest | ||
docker push ghcr.io/${{ github.repository }}:$IMAGE_TAG | ||
docker push ghcr.io/${{ github.repository }}:latest |