diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml index 11aa2c689..f8bda1cb4 100644 --- a/.github/workflows/push_image.yml +++ b/.github/workflows/push_image.yml @@ -1,4 +1,4 @@ -name: push to quay.io +name: Build and push to quay.io on: push: branches: [ main ] diff --git a/.github/workflows/push_image_pr.yml b/.github/workflows/push_image_pr.yml new file mode 100644 index 000000000..a9f18c775 --- /dev/null +++ b/.github/workflows/push_image_pr.yml @@ -0,0 +1,57 @@ +name: Build and push PR image to quay.io +on: + pull_request_target: + types: [labeled] + +env: + REGISTRY_USER: netobserv+github_ci + REGISTRY: quay.io/netobserv + IMAGE: flowlogs-pipeline + +jobs: + push-pr-image: + if: ${{ github.event.label.name == 'ok-to-test' }} + name: push PR image + runs-on: ubuntu-20.04 + strategy: + matrix: + go: ['1.17'] + steps: + - name: install make + run: sudo apt-get install make + - name: set up go 1.x + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: checkout + uses: actions/checkout@v2 + with: + ref: "refs/pull/${{ github.event.number }}/merge" + - name: build images + run: DOCKER_TAG=temp make build-ci-images + - name: podman login to quay.io + uses: redhat-actions/podman-login@v1 + with: + username: ${{ env.REGISTRY_USER }} + password: ${{ secrets.QUAY_SECRET }} + registry: quay.io + - name: get short sha + id: shortsha + run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" + - name: push to quay.io + id: push-to-quay + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ env.IMAGE }} + tags: ${{ steps.shortsha.outputs.short_sha }} + registry: ${{ env.REGISTRY }} + - uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'New image: ${{ steps.push-to-quay.outputs.registry-paths }}. It will expire after two weeks.' + }) diff --git a/.github/workflows/rm-ok-to-test.yaml b/.github/workflows/rm-ok-to-test.yaml new file mode 100644 index 000000000..de4b04d6d --- /dev/null +++ b/.github/workflows/rm-ok-to-test.yaml @@ -0,0 +1,15 @@ +name: Remove ok-to-test +on: + pull_request_target: + types: [synchronize,reopened] + +jobs: + rm-ok-to-test: + if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') + runs-on: ubuntu-20.04 + name: Remove ok-to-test + steps: + - uses: actions-ecosystem/action-remove-labels@v1 + with: + labels: ok-to-test + fail_on_error: true