You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/agent-ci.yaml
+86-3Lines changed: 86 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,27 @@
24
24
25
25
26
26
27
-
name: Agent Unittest
27
+
name: Agent CI
28
28
on:
29
29
pull_request:
30
+
branches:
31
+
- main
30
32
paths:
31
33
- agent/**
32
-
- .github/workflows/agent-ci.yaml
34
+
- containers/agent.Dockerfile
35
+
- .github/workflows/agent-container.yaml
36
+
push:
37
+
branches:
38
+
- main
39
+
tags:
40
+
- agent/*
41
+
paths:
42
+
- agent/**
43
+
- containers/agent.Dockerfile
44
+
- .github/workflows/agent-container.yaml
45
+
env:
46
+
REGISTRY: ghcr.io
47
+
IMAGE_NAME: ${{ github.repository }}
33
48
jobs:
34
49
test:
35
50
name: Skyhook Agent Unit Tests
@@ -54,4 +69,72 @@ jobs:
54
69
- name: Display Summary
55
70
if: always()
56
71
run: |
57
-
cat test-summary.md >> $GITHUB_STEP_SUMMARY
72
+
cat test-summary.md >> $GITHUB_STEP_SUMMARY
73
+
build-and-push-agent:
74
+
runs-on: ubuntu-latest
75
+
needs: [test] # Don't run the build and push if the unit tests fail
76
+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
77
+
permissions:
78
+
contents: read
79
+
packages: write
80
+
attestations: write
81
+
id-token: write
82
+
#
83
+
steps:
84
+
- name: Checkout repository
85
+
uses: actions/checkout@v4
86
+
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
87
+
- name: Log in to the Container registry
88
+
uses: docker/login-action@v3
89
+
with:
90
+
registry: ${{ env.REGISTRY }}
91
+
username: ${{ github.actor }}
92
+
password: ${{ secrets.GITHUB_TOKEN }}
93
+
94
+
# Setup for multi-platform
95
+
- name: Set up QEMU
96
+
uses: docker/setup-qemu-action@v3
97
+
98
+
- name: Set up Docker Buildx
99
+
uses: docker/setup-buildx-action@v3
100
+
101
+
- name: Build the agent container image
102
+
id: build
103
+
run: |
104
+
apt-get update && apt-get install -y make git jq
105
+
cd agent
106
+
# if this is a tag build, use the tag as the version, otherwise use the sha
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
33
47
env:
34
48
REGISTRY: ghcr.io
49
+
IMAGE_NAME: ${{ github.repository }}
50
+
GO_VERSION: 1.23.6
51
+
52
+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
35
53
jobs:
36
54
unit-test:
37
55
runs-on: ubuntu-latest
@@ -47,6 +65,7 @@ jobs:
47
65
make unit-tests
48
66
k8s-tests:
49
67
runs-on: ubuntu-latest
68
+
needs: [unit-test] # Don't run the k8s tests if the unit tests fail
50
69
steps:
51
70
- uses: actions/checkout@v4
52
71
with:
@@ -72,4 +91,76 @@ jobs:
72
91
run: |
73
92
cd operator
74
93
GITHUB_TOKEN=${{ secrets.github_token }} make create-kind-cluster
75
-
make e2e-tests
94
+
make e2e-tests
95
+
build-and-push-operator:
96
+
runs-on: ubuntu-latest
97
+
needs: [k8s-tests] # Don't run the build and push if the k8s tests fail
98
+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
99
+
permissions:
100
+
contents: read
101
+
packages: write
102
+
attestations: write
103
+
id-token: write
104
+
#
105
+
steps:
106
+
- name: Checkout repository
107
+
uses: actions/checkout@v4
108
+
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
109
+
- name: Log in to the Container registry
110
+
uses: docker/login-action@v3
111
+
with:
112
+
registry: ${{ env.REGISTRY }}
113
+
username: ${{ github.actor }}
114
+
password: ${{ secrets.GITHUB_TOKEN }}
115
+
116
+
# Setup for multi-platform
117
+
- name: Set up QEMU
118
+
uses: docker/setup-qemu-action@v3
119
+
120
+
- name: Set up Docker Buildx
121
+
uses: docker/setup-buildx-action@v3
122
+
123
+
- name: Build the operator container image
124
+
id: build
125
+
run: |
126
+
apt-get update && apt-get install -y make git jq
127
+
cd operator
128
+
# if this is a tag build, use the tag as the version, otherwise use the sha
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
0 commit comments