Skip to content

Commit

Permalink
Merge pull request #7 from etsauer/image-ci
Browse files Browse the repository at this point in the history
WIP: Add some github workflows to build and publish images
  • Loading branch information
cgruver authored May 22, 2024
2 parents b9cf5ac + 92607fb commit e83f901
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/cekit-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# This workflow gets called by other workflows
workflow_call:
inputs:
image:
required: true
type: string
tag:
required: true
type: string
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_and_push:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Install CEKit
uses: cekit/[email protected]

# Runs a set of commands using the runners shell
- name: Build base iamge
run: |
cekit build --overrides images/${{ inputs.image }}.yaml podman --tag=${{ inputs.tag }}
# Runs a set of commands using the runners shell
- name: Push Image
env:
USER: ${{ secrets.QUAY_ROBOT_USER }}
TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
REGISTRY: ${{ vars.REGISTRY_URL }}
run: |
podman login -u="${USER}" -p="${TOKEN}" ${REGISTRY}
podman push ${{ inputs.tag }}
30 changes: 30 additions & 0 deletions .github/workflows/podman-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This is a basic workflow to help you get started with Actions

name: CD

# Controls when the workflow will run
on:
# This workflow gets called by other workflows
workflow_call:
inputs:
tag:
required: true
type: string
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Install CEKit
uses: cekit/[email protected]

16 changes: 16 additions & 0 deletions .github/workflows/post-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Controls when the workflow will run
on:
push:
branches: [ "main" ]

jobs:
build-images:
strategy:
fail-fast: false
matrix:
image: ['cekit-builder', 'devspaces-base', 'devspaces-openjdk-17', 'devspaces-nodejs-18']
uses: ./.github/workflows/cekit-build.yaml
with:
tag: quay.io/redhat-cop/${{ matrix.image }}:latest
image: ${{ matrix.image }}
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Controls when the workflow will run
on:
push:
branches: ["image-ci"]
pull_request:
branches: [ "main" ]

jobs:
build-images:
strategy:
fail-fast: false
matrix:
image: ['cekit-builder', 'devspaces-base', 'devspaces-openjdk-17', 'devspaces-nodejs-18']
uses: ./.github/workflows/cekit-build.yaml
with:
tag: quay.io/redhat-cop/${{ matrix.image }}:pr-${{ github.sha }}
image: ${{ matrix.image }}
secrets: inherit
2 changes: 1 addition & 1 deletion images/developer-base.yaml → images/devspaces-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

schema_version: 1

name: &name "developer-base"
name: &name "devspaces-base"
version: &version "1.0"
description: "Developer base image for Red Hat OpenShift Dev Spaces"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
schema_version: 1

from: "registry.access.redhat.com/ubi9/nodejs-18:1"
name: &name "developer-nodejs-18"
name: &name "devspaces-nodejs-18"
version: &version "1.0"
description: "Developer image for Red Hat OpenShift Dev Spaces providing OpenJDK 17"
File renamed without changes.

0 comments on commit e83f901

Please sign in to comment.