Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push_image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: push to quay.io
name: Build and push to quay.io
on:
push:
branches: [ main ]
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/push_image_pr.yml
Original file line number Diff line number Diff line change
@@ -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.'
})
Comment on lines +52 to +57
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused. If this workflow is triggered by a PR, then what is the issue in context where the comment is created?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in github API, a PR is apparently some special kind of issue. But the comment is actually created on the PR

15 changes: 15 additions & 0 deletions .github/workflows/rm-ok-to-test.yaml
Original file line number Diff line number Diff line change
@@ -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