From 258a3e6173397d609b0a0a06d5152334e0bf4839 Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Wed, 2 Aug 2023 09:11:37 -0400 Subject: [PATCH] [CI:BUILD] Podman FCOS image from main Fixes: #19446, #19447, #19448 [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar --- .github/workflows/fcos-build.yml | 34 ++++++++++++++++++++++++++++ .packit.sh | 38 ++++++++++++++++++++++++++++++++ .packit.yaml | 4 ++++ 3 files changed, 76 insertions(+) create mode 100644 .github/workflows/fcos-build.yml create mode 100644 .packit.sh diff --git a/.github/workflows/fcos-build.yml b/.github/workflows/fcos-build.yml new file mode 100644 index 000000000000..a69b4894ecf8 --- /dev/null +++ b/.github/workflows/fcos-build.yml @@ -0,0 +1,34 @@ +name: FCOS Build from ${{ env.COPR_OWNER }}/${{ env.COPR_PROJECT }} + +on: + push: + branches: + - main + +env: + COPR_OWNER: "rhcontainerbot" + COPR_PROJECT: "podman-next" + +jobs: + wait-for-task: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up wait-for-copr + run: | + pip3 install git+https://github.com/packit/wait-for-copr.git@main + + - name: Wait for ${{ env.COPR_OWNER }}/${{ env.COPR_PROJECT }} build + run: | + # wait-for-copr attempts 180 tries with 10s between each try by default + wait-for-copr --owner ${{ env.COPR_OWNER }} --project ${{ env.COPR_PROJECT }} podman `git rev-parse --short HEAD` + echo "COPR build ready!" + + - name: Build FCOS image + run: | + git clone https://github.com/coreos/layering-examples + cd layering-examples/podman-next + podman build . diff --git a/.packit.sh b/.packit.sh new file mode 100644 index 000000000000..85a0d6f52014 --- /dev/null +++ b/.packit.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# This script handles any custom processing of the spec file using the `fix-spec-file` +# action in .packit.yaml. + +set -eox pipefail + +PACKAGE=podman + +# Set path to rpm spec file +SPEC_FILE=rpm/$PACKAGE.spec + +# Get Version from HEAD +VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2) + +# RPM Version can't take "-" +RPM_VERSION=$(echo $VERSION | sed -e 's/-/~/') + +# Generate source tarball from HEAD +git-archive-all -C $(git rev-parse --show-toplevel) --prefix=$PACKAGE-$VERSION/ rpm/$PACKAGE-$VERSION.tar.gz + +# RPM Spec modifications + +# Use the Version from HEAD in rpm spec +sed -i "s/^Version:.*/Version: $RPM_VERSION/" $SPEC_FILE + +# Use Packit's supplied variable in the Release field in rpm spec. +sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" $SPEC_FILE + +# Ensure last part of the release string is the git shortcommit without a +# prepended "g" +sed -i "/^Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/ s/\(.*\)g/\1/" $SPEC_FILE + +# Use above generated tarball as Source in rpm spec +sed -i "s/^Source0:.*.tar.gz/Source0: $PACKAGE-$VERSION.tar.gz/" $SPEC_FILE + +# Update setup macro to use the correct build dir +sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE diff --git a/.packit.yaml b/.packit.yaml index 2d53d26cc360..cbef5c768315 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -16,7 +16,11 @@ jobs: project: packit-builds enable_net: true srpm_build_deps: + - git-archive-all - make + actions: + fix-spec-file: + - "bash .packit.sh" - <<: *copr # Run on commit to main branch