Skip to content

Commit

Permalink
Change: use GREENBONE_REGISTRY_REPLICATION_TOKEN (#147)
Browse files Browse the repository at this point in the history
* Change: use GREENBONE_REGISTRY_REPLICATION_TOKEN in container-build-push-2nd-gen.yml

* Change: use GREENBONE_REGISTRY_REPLICATION_TOKEN in container-build-push-3rd-gen.yml

* Change: use GREENBONE_REGISTRY_REPLICATION_TOKEN in  container-build-push-feed.yml
  • Loading branch information
pascalholthaus authored Dec 3, 2024
1 parent 065088b commit 0234947
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/container-build-push-2nd-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ on:
required: false
GREENBONE_REGISTRY_TOKEN:
required: false
GREENBONE_REGISTRY_REPLICATION_USER:
required: false
GREENBONE_REGISTRY_REPLICATION_TOKEN:
required: false
MATTERMOST_WEBHOOK_URL:
required: false

Expand Down Expand Up @@ -254,7 +258,7 @@ jobs:
registry-password: ${{ secrets.GREENBONE_REGISTRY_TOKEN }}

harbor-replication:
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN
needs: create-multi-arch-manifest
runs-on: self-hosted-generic
steps:
Expand All @@ -263,7 +267,7 @@ jobs:
run: |
curl -X POST \
https://${{ vars.GREENBONE_REGISTRY }}/api/v2.0/replication/executions \
-u '${{ secrets.GREENBONE_REGISTRY_USER }}:${{ secrets.GREENBONE_REGISTRY_TOKEN }}' \
-u '${{ secrets.GREENBONE_REGISTRY_REPLICATION_USER }}:${{ secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN }}' \
-H "Content-Type: application/json" \
-d '{"policy_id": 1}'
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/container-build-push-3rd-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ on:
required: false
DOCKERHUB_TOKEN:
required: false
GREENBONE_REGISTRY:
required: false
GREENBONE_REGISTRY_USER:
required: false
GREENBONE_REGISTRY_TOKEN:
required: false
GREENBONE_REGISTRY_REPLICATION_USER:
required: false
GREENBONE_REGISTRY_REPLICATION_TOKEN:
required: false

outputs:
digest:
Expand Down Expand Up @@ -199,7 +209,7 @@ jobs:
registry-password: ${{ secrets.GREENBONE_REGISTRY_TOKEN }}

harbor-replication:
if: inputs.service && startsWith(github.ref, 'refs/tags/v')
if: inputs.service && startsWith(github.ref, 'refs/tags/v') && secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN
needs: building-container-greenbone
runs-on: self-hosted-generic
steps:
Expand All @@ -208,7 +218,7 @@ jobs:
run: |
curl -X POST \
https://${{ vars.GREENBONE_REGISTRY }}/api/v2.0/replication/executions \
-u '${{ secrets.GREENBONE_REGISTRY_USER }}:${{ secrets.GREENBONE_REGISTRY_TOKEN }}' \
-u '${{ secrets.GREENBONE_REGISTRY_REPLICATION_USER }}:${{ secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN }}' \
-H "Content-Type: application/json" \
-d '{"policy_id": 1}'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/container-build-push-feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ on:
required: false
GREENBONE_REGISTRY_TOKEN:
required: false
GREENBONE_REGISTRY_REPLICATION_USER:
required: false
GREENBONE_REGISTRY_REPLICATION_TOKEN:
required: false
MATTERMOST_WEBHOOK_URL:
required: false

Expand Down Expand Up @@ -185,7 +189,7 @@ jobs:
registry-password: ${{ secrets.GREENBONE_REGISTRY_TOKEN }}

harbor-replication:
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN
needs: create-multi-arch-manifest
runs-on: self-hosted-generic
steps:
Expand All @@ -194,7 +198,7 @@ jobs:
run: |
curl -X POST \
https://${{ vars.GREENBONE_REGISTRY }}/api/v2.0/replication/executions \
-u '${{ secrets.GREENBONE_REGISTRY_USER }}:${{ secrets.GREENBONE_REGISTRY_TOKEN }}' \
-u '${{ secrets.GREENBONE_REGISTRY_REPLICATION_USER }}:${{ secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN }}' \
-H "Content-Type: application/json" \
-d '{"policy_id": 1}'
Expand Down

0 comments on commit 0234947

Please sign in to comment.