Skip to content

Commit

Permalink
Merge pull request #122 from stakater/token
Browse files Browse the repository at this point in the history
Change to generic github token
  • Loading branch information
SheryarButt authored Sep 6, 2024
2 parents 738b43c + 98ae7b6 commit f697da3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
42 changes: 17 additions & 25 deletions .github/workflows/publish_operator_image_and_bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ on:
description: Certification project ID
required: true
type: string

DOCKER_FILE_PATH:
description: Dockerfile path
required: true
type: string

PUBLISH_BUNDLE:
description: "Publish bundle will publish operator bundle to stakater/certified-operators"
default: false
Expand All @@ -47,7 +47,7 @@ on:
description: Admin user name to pull private repository
required: false
type: string

SUBPATH:
description: Custom path for docker build
required: true
Expand Down Expand Up @@ -86,10 +86,6 @@ on:
description: "Pyxis API token to run Preflight"
required: true

STAKATER_GITHUB_TOKEN:
description: "Secret to create branch in stakater/certified-operators repository"
required: false

ADMIN_TOKEN:
description: "Secret to commit bundle files"
required: false
Expand Down Expand Up @@ -158,7 +154,7 @@ jobs:
run: |
echo ${{ secrets.REGISTRY_REDHAT_IO_PULL_SECRET }} | base64 -d > ~/.docker/config.json
docker login registry.redhat.io
# For pushing operator image
- name: Login to Quay Registry
uses: docker/login-action@v3
Expand All @@ -170,7 +166,7 @@ jobs:
- name: Generate image repository path
run: |
echo IMAGE_REPOSITORY=$(echo quay.io/${{ secrets.OPERATORHUB_REPOSITORY }}) >> $GITHUB_ENV
# Build and push tag
- name: Build and push
id: build_and_push
Expand All @@ -191,7 +187,7 @@ jobs:
- name: Run Preflight test
run: |
preflight check container ${{ env.IMAGE_REPOSITORY }}:${{ steps.latest_tag.outputs.tag }} --pyxis-api-token ${{ secrets.PYXIS_API_TOKEN }} --docker-config ~/.docker/config.json
- name: Submit Preflight test
run: |
rm -r ./artifacts
Expand All @@ -214,7 +210,7 @@ jobs:
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:latest
outputs:
operatorhub_image_digest: ${{ steps.build_and_push.outputs.digest }}
latest_tag: ${{ steps.latest_tag.outputs.tag }}
Expand All @@ -234,8 +230,8 @@ jobs:

- name: Check if registry secrets are set
run: |
if [ "${{ secrets.STAKATER_GITHUB_TOKEN }}" == "" ] || [ "${{ secrets.ADMIN_TOKEN }}" == "" ]; then
echo "Required Secrets 'STAKATER_GITHUB_TOKEN' or 'ADMIN_TOKEN' is not set!"
if [ "${{ secrets.ADMIN_TOKEN }}" == "" ]; then
echo "Required Secrets 'ADMIN_TOKEN' is not set!"
exit 1
fi
Expand Down Expand Up @@ -276,20 +272,16 @@ jobs:
- name: Clone stakater/certified-operators repository
run: |
if [ -z "${{ secrets.STAKATER_GITHUB_TOKEN }}" ]; then
git clone https://github.com/stakater/certified-operators.git
else
git clone https://${{ secrets.STAKATER_GITHUB_TOKEN }}@github.com/stakater/certified-operators.git
fi
git clone https://${{ secrets.GITHUB_TOKEN }}@github.com/stakater/certified-operators.git
if [ -d "certified-operators" ]; then
echo "Cloned certified-operators repository successfully."
echo "Access the repository content using \"cd certified-operators\"."
echo "Access the repository content using \"cd certified-operators\"."
else
echo "Error: Couldn't clone certified-operators repository. Check the inputs or the PAT scope."
exit 1
fi
- name: Push branch
run: |
cd certified-operators
Expand All @@ -306,13 +298,13 @@ jobs:
git add .
git commit -am "Updated multi-tenant-operator to ${{ needs.publish-image.outputs.latest_tag}}"
git push --set-upstream origin mto-${{ needs.publish-image.outputs.latest_tag}}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ADMIN_TOKEN }}
branch: main

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand All @@ -322,7 +314,7 @@ jobs:
driver-opts: |
image=moby/buildkit:v0.9.3
buildkitd-flags: --debug

- name: Login to Nexus Registry
uses: docker/login-action@v3
with:
Expand All @@ -339,7 +331,7 @@ jobs:
runs-on: ubuntu-latest
needs: [publish-image, publish-bundle]
if: always()

steps:
- name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Push Latest Tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
Expand Down

0 comments on commit f697da3

Please sign in to comment.