Skip to content

Commit ed2e79f

Browse files
committed
feat: ci-hub-support
Signed-off-by: Adrian Riobo <[email protected]>
1 parent 7906192 commit ed2e79f

File tree

6 files changed

+157
-45
lines changed

6 files changed

+157
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: ci-hub-support-builder
2+
3+
on:
4+
push:
5+
tags: [ 'ci-hub-support-v*' ]
6+
pull_request:
7+
branches: [ main ]
8+
paths: ['ci-hub-support/**', '.github\/workflows\/ci-hub-support*' ]
9+
10+
jobs:
11+
build:
12+
name: build
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Build image for PR
19+
if: ${{ github.event_name == 'pull_request' }}
20+
env:
21+
CI_HUB_SUPPORT: ghcr.io/devtools-qe-incubator/ci-hub-support
22+
CI_HUB_SUPPORT_V: pr-${{ github.event.number }}
23+
run: |
24+
make ci-hub-support-oci-build
25+
make ci-hub-support-oci-save
26+
echo "image=${CI_HUB_SUPPORT}:${CI_HUB_SUPPORT_V}" >> "$GITHUB_ENV"
27+
28+
- name: Build image for Release
29+
if: ${{ github.event_name == 'push' }}
30+
run: |
31+
make ci-hub-support-oci-build
32+
make ci-hub-support-oci-save
33+
echo "image=$(sed -n 1p ci-hub-support/release-info):v$(sed -n 2p ci-hub-support/release-info)" >> "$GITHUB_ENV"
34+
35+
- name: Create image metadata
36+
run: |
37+
echo ${{ env.image }} > ci-hub-support-image
38+
echo ${{ github.event_name }} > ci-hub-support-build-event
39+
40+
- name: Upload ci-hub-support
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: ci-hub-support
44+
path: ci-hub-support*
45+
46+
47+
48+
49+
50+
51+
52+
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: ci-hub-support-pusher
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- ci-hub-support-builder
7+
types:
8+
- completed
9+
10+
jobs:
11+
push:
12+
name: push
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Download ci-hub-support assets
20+
uses: actions/download-artifact@v4
21+
with:
22+
name: ci-hub-support
23+
run-id: ${{ github.event.workflow_run.id }}
24+
github-token: ${{ github.token }}
25+
26+
- name: Get ci-hub-support build informaiton
27+
run: |
28+
echo "source_event=$(cat ci-hub-support-build-event)" >> "$GITHUB_ENV"
29+
echo "image=$(cat ci-hub-support-image)" >> "$GITHUB_ENV"
30+
31+
- name: Log in to ghcr.io
32+
if: ${{ env.source_event == 'pull_request' }}
33+
uses: redhat-actions/podman-login@v1
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Log in quay.io
40+
if: ${{ env.source_event == 'push' }}
41+
uses: redhat-actions/podman-login@v1
42+
with:
43+
registry: quay.io
44+
username: ${{ secrets.QUAY_IO_USERNAME }}
45+
password: ${{ secrets.QUAY_IO_PASSWORD }}
46+
47+
- name: Push ci-hub-support
48+
run: |
49+
podman load -i ci-hub-support.tar
50+
podman push ${{ env.image }}
51+

Makefile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CONTAINER_MANAGER ?= podman
2+
3+
#### ci-hub-support ####
4+
5+
.PHONY: ci-hub-support-oci-build ci-hub-support-oci-save ci-hub-support-oci-load ci-hub-support-oci-push
6+
7+
# Variables
8+
CI_HUB_SUPPORT ?= $(shell sed -n 1p ci-hub-support/release-info)
9+
CI_HUB_SUPPORT_V ?= v$(shell sed -n 2p ci-hub-support/release-info)
10+
CI_HUB_SUPPORT_SAVE ?= ci-hub-support
11+
12+
ci-hub-support-oci-build: CONTEXT=ci-hub-support
13+
ci-hub-support-oci-build: MANIFEST=$(CI_HUB_SUPPORT):$(CI_HUB_SUPPORT_V)
14+
ci-hub-support-oci-build:
15+
${CONTAINER_MANAGER} build -t $(MANIFEST) -f $(CONTEXT)/Containerfile $(CONTEXT)
16+
17+
ci-hub-support-oci-save:
18+
${CONTAINER_MANAGER} save -o $(CI_HUB_SUPPORT_SAVE).tar $(CI_HUB_SUPPORT):$(CI_HUB_SUPPORT_V)
19+
20+
sci-hub-support-oci-load:
21+
${CONTAINER_MANAGER} load -i $(CI_HUB_SUPPORT_SAVE).tar
22+
23+
ci-hub-support-oci-push:
24+
ifndef IMAGE
25+
IMAGE = $(CI_HUB_SUPPORT):$(CI_HUB_SUPPORT_V)
26+
endif
27+
${CONTAINER_MANAGER} push $(IMAGE)
28+
29+
30+

base-pipeline.yaml

-45
This file was deleted.

ci-hub-support/Containerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ubi 9.4-1227.1726694542
2+
FROM registry.access.redhat.com/ubi9-minimal@sha256:f5d2c6a1e0c86e4234ea601552dbabb4ced0e013a1efcbfb439f1f6a7a9275b0
3+
4+
LABEL org.opencontainers.image.authors="CodeReady Containers <[email protected]>"
5+
6+
ENV AWS_CLI_VERSION 2.17.63
7+
ENV AWS_CLI_URL https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWS_CLI_VERSION}.zip
8+
9+
# YQ
10+
ENV YQ_VERSION=4.11.2
11+
ENV YQ_BINARY_URL=https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64
12+
13+
RUN microdnf install -y openssh-clients sshpass unzip zip bash jq findutils \
14+
&& curl -Lo /usr/local/bin/yq "${YQ_BINARY_URL}" \
15+
&& chmod +x /usr/local/bin/yq \
16+
&& curl ${AWS_CLI_URL} -o awscliv2.zip \
17+
&& unzip awscliv2.zip \
18+
&& ./aws/install \
19+
&& microdnf clean all \
20+
&& rm -rf /var/cache/yum
21+

ci-hub-support/release-info

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
quay.io/devtools-qe-incubator/ci-hub-support
2+
1.0.0-dev

0 commit comments

Comments
 (0)