-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from mikenairn/add_image_builds
Add build images CI job
- Loading branch information
Showing
7 changed files
with
439 additions
and
683 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: Build Images | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
tags: [ '*' ] | ||
|
||
env: | ||
IMG_TAGS: ${{ github.ref_name }} | ||
IMG_REGISTRY_HOST: quay.io | ||
IMG_REGISTRY_ORG: kuadrant | ||
MAIN_BRANCH_NAME: main | ||
OPERATOR_NAME: authorino-operator | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Add latest tag | ||
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} | ||
id: add-latest-tag | ||
run: | | ||
echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.OPERATOR_NAME }} | ||
tags: ${{ env.IMG_TAGS }} | ||
dockerfiles: | | ||
./Dockerfile | ||
- name: Push Image | ||
if: ${{ !env.ACT }} | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | ||
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
- name: Print Image URL | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | ||
|
||
build-bundle: | ||
needs: build | ||
name: Build Bundle | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.16.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
id: go | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Add latest tag | ||
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} | ||
id: add-latest-tag | ||
run: | | ||
echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV | ||
- name: Run make bundle | ||
if: ${{ github.ref_name != env.MAIN_BRANCH_NAME }} | ||
run: make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=${{ github.ref_name }} | ||
- name: Run make bundle (main) | ||
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} | ||
run: make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=latest VERSION=0.0.0 | ||
- name: Git diff | ||
run: git diff | ||
# Uncomment this when ORG in the Makefile to be updated to "kuadrant" | ||
# - name: Verify manifests and bundle | ||
# if: startsWith(github.ref, 'refs/tags/v') || github.ref_name == env.MAIN_BRANCH_NAME | ||
# run: make verify-manifests verify-bundle | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.OPERATOR_NAME }}-bundle | ||
tags: ${{ env.IMG_TAGS }} | ||
dockerfiles: | | ||
./bundle.Dockerfile | ||
- name: Push Image | ||
if: ${{ !env.ACT }} | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | ||
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
- name: Print Image URL | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | ||
|
||
build-catalog: | ||
name: Build Catalog | ||
needs: [build, build-bundle] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.16.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
id: go | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Add latest tag | ||
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} | ||
id: add-latest-tag | ||
run: | | ||
echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV | ||
- name: Run make catalog-generate | ||
if: ${{ github.ref_name != env.MAIN_BRANCH_NAME }} | ||
run: make catalog-generate REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=${{ github.ref_name }} | ||
- name: Run make catalog-generate (main) | ||
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} | ||
run: make catalog-generate REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=latest VERSION=0.0.0 | ||
- name: Git diff | ||
run: git diff | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.OPERATOR_NAME }}-catalog | ||
tags: ${{ env.IMG_TAGS }} | ||
dockerfiles: | | ||
./index.Dockerfile | ||
- name: Push Image | ||
if: ${{ !env.ACT }} | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | ||
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
- name: Print Image URL | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- github.com/Kuadrant/authorino/install?ref=${AUTHORINO_GITREF} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- github.com/Kuadrant/authorino/install?ref=main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- ../authorino | ||
- ../default |
Oops, something went wrong.