Skip to content

Commit

Permalink
use github container registry instead of gcr.io for releases (kubeflo…
Browse files Browse the repository at this point in the history
…w#1422)

* use github container registry instead of gcr.io for releases

It appears that it is possible looking at this workflow.

https://github.com/GoogleCloudPlatform/gke-autoneg-controller/blame/master/.github/workflows/go.yml

It can only be done on the master branch though, so can't find out until after merge

Update main.yaml

Update main.yaml

* Update to use github token

Following the guidance 
from here. This stil might not work, but I don't think there is anthing else that can be done. https://github.blog/changelog/2021-03-24-packages-container-registry-now-supports-github_token/
  • Loading branch information
TomHellier authored Jan 8, 2022
1 parent 2919f52 commit c5c3d6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ jobs:

- name: Build Spark-Operator Docker Image
run: |
DOCKER_TAG=$(cat charts/spark-operator-chart/Chart.yaml | grep "appVersion: .*" | cut -c13-)
docker build -t gcr.io/spark-operator/spark-operator:${DOCKER_TAG} .
docker build -t gcr.io/spark-operator/spark-operator:latest .
- name: Check changes in resources used in docker file
run: |
Expand All @@ -97,7 +96,7 @@ jobs:
fi
fi
done
build-helm-chart:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,31 @@ jobs:
with:
version: v3.7.1

- uses: actions/setup-python@v2
with:
python-version: 3.10

# TODO: Maintainer of repository to follow:
# https://github.com/docker/login-action#google-container-registry-gcr to add credentials so
# we can push from github actions
# - name: log in to container registry
# - name: log in to google container registry
# uses: docker/login-action@v1
# with:
# registry: gcr.io
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Packages Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release Spark-Operator Docker Image
- name: Release Spark-Operator Docker Image to github container registry
run: |
DOCKER_TAG=$(cat charts/spark-operator-chart/Chart.yaml | grep "appVersion: .*" | cut -c13-)
docker build -t gcr.io/spark-operator/spark-operator:${DOCKER_TAG} .
echo "Ideally, we'd release the docker container at this point, but the maintainer of this repo needs to approve..."
if ! docker pull docker pull gcr.io/spark-operator/spark-operator:${DOCKER_TAG}; then
echo "docker push gcr.io/spark-operator/spark-operator:${DOCKER_TAG}"
docker tag gcr.io/spark-operator/spark-operator:${DOCKER_TAG} ghcr.io/googlecloudplatform/spark-operator:${DOCKER_TAG}
if ! docker pull ghcr.io/googlecloudplatform/spark-operator:${DOCKER_TAG}; then
docker push ghcr.io/googlecloudplatform/spark-operator:${DOCKER_TAG}
git tag $DOCKER_TAG
git push origin $DOCKER_TAG
fi
Expand Down

0 comments on commit c5c3d6f

Please sign in to comment.