Skip to content

Commit 0175c80

Browse files
Merge pull request #11054 from rabbitmq/conditional-oci-workflows
Make the OCI workflows conditional on push access
2 parents 483a824 + 07c9758 commit 0175c80

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

.github/workflows/oci-make.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,32 @@ concurrency:
1515
jobs:
1616
build-package-generic-unix:
1717
runs-on: ubuntu-latest
18+
outputs:
19+
authorized: ${{ steps.authorized.outputs.authorized }}
1820
steps:
21+
- name: CHECK IF IMAGE WILL PUSH
22+
id: authorized
23+
run: |
24+
if [ -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
25+
echo "authorized=true" | tee -a $GITHUB_OUTPUT
26+
else
27+
echo "authorized=false" | tee -a $GITHUB_OUTPUT
28+
fi
1929
- name: Checkout
30+
if: steps.authorized.outputs.authorized == 'true'
2031
uses: actions/checkout@v4
2132
- name: Configure Erlang
33+
if: steps.authorized.outputs.authorized == 'true'
2234
uses: erlef/setup-beam@v1
2335
with:
2436
otp-version: 26.2
2537
elixir-version: 1.15
2638
- name: make package-generic-unix
39+
if: steps.authorized.outputs.authorized == 'true'
2740
run: |
2841
make package-generic-unix PROJECT_VERSION=4.0.0
2942
- name: Upload package-generic-unix
43+
if: steps.authorized.outputs.authorized == 'true'
3044
uses: actions/[email protected]
3145
with:
3246
name: package-generic-unix
@@ -35,6 +49,7 @@ jobs:
3549
build:
3650
needs: build-package-generic-unix
3751
runs-on: ubuntu-latest
52+
if: ${{ needs.build-package-generic-unix.outputs.authorized }} == 'true'
3853
strategy:
3954
fail-fast: false
4055
matrix:
@@ -106,9 +121,10 @@ jobs:
106121
retention-days: 1
107122

108123
merge:
109-
runs-on: ubuntu-latest
110124
needs:
111125
- build
126+
runs-on: ubuntu-latest
127+
if: ${{ needs.build-package-generic-unix.outputs.authorized }} == 'true'
112128
steps:
113129
- name: Download digests
114130
uses: actions/download-artifact@v4

.github/workflows/rabbitmq_peer_discovery_aws.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,47 @@ jobs:
1919
- 26_2
2020
timeout-minutes: 45
2121
steps:
22+
- name: CHECK IF IMAGE WILL PUSH
23+
id: authorized
24+
run: |
25+
if [ -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
26+
echo "authorized=true" | tee -a $GITHUB_OUTPUT
27+
else
28+
echo "authorized=false" | tee -a $GITHUB_OUTPUT
29+
fi
2230
- name: CHECKOUT REPOSITORY
31+
if: steps.authorized.outputs.authorized == 'true'
2332
uses: actions/checkout@v4
2433
- uses: docker/metadata-action@v5
34+
if: steps.authorized.outputs.authorized == 'true'
2535
id: metadata
2636
with:
2737
images: pivotalrabbitmq/rabbitmq
2838
tags: |
2939
type=sha,format=long
3040
- uses: int128/wait-for-docker-image-action@v1
41+
if: steps.authorized.outputs.authorized == 'true'
3142
with:
3243
tags: ${{ steps.metadata.outputs.tags }}
3344
timeout-seconds: 3600
3445
polling-seconds: 60
3546
- name: CONFIGURE BAZEL
47+
if: steps.authorized.outputs.authorized == 'true'
3648
run: |
49+
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
3750
cat << EOF >> user.bazelrc
3851
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
39-
52+
EOF
53+
fi
54+
cat << EOF >> user.bazelrc
4055
build:buildbuddy --build_metadata=ROLE=CI
4156
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
4257
build:buildbuddy --color=yes
4358
EOF
4459
#! - name: Setup tmate session
4560
#! uses: mxschmitt/action-tmate@v3
4661
- name: RUN INTEGRATION TESTS
62+
if: steps.authorized.outputs.authorized == 'true'
4763
run: |
4864
sudo sysctl -w net.ipv4.tcp_keepalive_time=60
4965
sudo ethtool -K eth0 tso off gso off gro off tx off rx off lro off

.github/workflows/test-authnz.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ jobs:
4848
- name: Checkout
4949
uses: actions/checkout@v4
5050

51-
- name: 'Login to GitHub Container Registry'
52-
uses: docker/login-action@v3
53-
with:
54-
registry: ghcr.io
55-
username: ${{ github.actor }}
56-
password: ${{ secrets.GITHUB_TOKEN }}
57-
5851
- name: Configure OTP & Elixir
5952
uses: erlef/[email protected]
6053
with:

.github/workflows/test-selenium.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ jobs:
4444
- name: Checkout
4545
uses: actions/checkout@v4
4646

47-
- name: 'Login to GitHub Container Registry'
48-
uses: docker/login-action@v3
49-
with:
50-
registry: ghcr.io
51-
username: ${{ github.actor }}
52-
password: ${{ secrets.GITHUB_TOKEN }}
53-
5447
- name: Configure OTP & Elixir
5548
uses: erlef/[email protected]
5649
with:

0 commit comments

Comments
 (0)