From f99b371935e058ba7bf7282debd50f5e2f3f6979 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 5 Aug 2024 10:45:21 +0200 Subject: [PATCH 1/2] ci: add auto generated dockerfile to gitignore Add auto generated dockerfile to gitignore so that we dont need to it push to repo. Signed-off-by: Madhu Rajanna --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e2046a84..61dbe252 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ go.work.sum # Locally generated install files dist/ + +# Locally generated dockerfile for multi-arch +Dockerfile.cross From ce0ddbc1f0e6e2d3cff7671bdfff35cb418446d4 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 5 Aug 2024 10:46:54 +0200 Subject: [PATCH 2/2] ci: github action to push image to quay Adding a github action to build and push docker image to quay Signed-off-by: Madhu Rajanna --- .github/workflows/build-push.yaml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/build-push.yaml diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml new file mode 100644 index 00000000..491f113f --- /dev/null +++ b/.github/workflows/build-push.yaml @@ -0,0 +1,49 @@ +name: build-and-push +on: + push: + branches: + - main + - release-* + tags: + - '*' + +permissions: + contents: read + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: github.repository == 'ceph/ceph-csi-operator' + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + #- name: Login to Quay.io + #uses: docker/login-action@v3 + #with: + # registry: quay.io + # username: ${{ secrets.QUAY_IO_USERNAME }} + # password: ${{ secrets.QUAY_IO_PASSWORD }} + - name: Set up Image tag + run: | + echo "image tag ${{ github.ref }}" + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + echo "IMAGE_TAG=latest" >> $GITHUB_ENV + elif [[ "${{ github.ref }}" == refs/heads/* ]]; then + TAG=$(echo ${{ github.ref }} | sed 's/refs\/heads\///') + echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV + elif [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///') + echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV + fi + - name: print env + run: echo $IMAGE_TAG + + - name: Build and push Docker images + run: make docker-buildx IMAGE_TAG=${{ env.IMAGE_TAG }}