Skip to content

Commit b650e6c

Browse files
joshuabairdmarcofranssen
authored andcommitted
Do not push images on PR.
Signed-off-by: Josh Baird <[email protected]>
1 parent 94d21ad commit b650e6c

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

.github/workflows/build-op-image.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
platforms: linux/amd64,linux/arm64
8888

8989
- name: Login to GHCR
90+
if: github.event_name != 'pull_request'
9091
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
9192
with:
9293
registry: ghcr.io
@@ -117,7 +118,24 @@ jobs:
117118
type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }}
118119
type=sha,format=long,prefix=,priority=1000
119120
121+
- name: Build image (pull request)
122+
if: github.event_name == 'pull_request'
123+
id: build-pr
124+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
125+
with:
126+
context: .
127+
file: cmd/fluent-manager/Dockerfile
128+
platforms: ${{ matrix.platform }}
129+
labels: ${{ steps.image-metadata.outputs.labels }}
130+
provenance: false
131+
cache-from: type=gha
132+
cache-to: type=gha,mode=max
133+
build-args: |
134+
GO_VERSION=${{ steps.setup-go.outputs.go-version }}
135+
push: false
136+
120137
- name: Build and push image
138+
if: github.event_name != 'pull_request'
121139
id: build
122140
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
123141
with:
@@ -130,10 +148,10 @@ jobs:
130148
cache-to: type=gha,mode=max
131149
build-args: |
132150
GO_VERSION=${{ steps.setup-go.outputs.go-version }}
133-
push: ${{ github.event_name != 'pull_request' }}
134-
outputs: ${{ github.event_name != 'pull_request' && format('type=image,"name={0},{1}",push-by-digest=true,name-canonical=true,push=true', env.GHCR_REPO, env.DOCKERHUB_REPO) || '' }}
151+
outputs: type=image,"name=${{ env.GHCR_REPO }},${{ env.DOCKERHUB_REPO }}",push-by-digest=true,name-canonical=true,push=true
135152

136153
- name: Output image digests
154+
if: github.event_name != 'pull_request'
137155
id: output-digests
138156
run: |
139157
platform="${{ matrix.platform }}"
@@ -155,7 +173,6 @@ jobs:
155173
password: ${{ secrets.GITHUB_TOKEN }}
156174

157175
- name: Login to Docker Hub
158-
if: github.event_name != 'pull_request'
159176
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
160177
with:
161178
registry: docker.io

manifests/setup/setup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40352,7 +40352,7 @@ spec:
4035240352
fieldRef:
4035340353
apiVersion: v1
4035440354
fieldPath: metadata.namespace
40355-
image: ghcr.io/fluent/fluent-operator/fluent-operator:v3.5.0
40355+
image: ghcr.io/fluent/fluent-operator/fluent-operator:latest
4035640356
name: fluent-operator
4035740357
resources:
4035840358
limits:

0 commit comments

Comments
 (0)