From ee6ab088bb71692fb99e3639255bab55bde9c937 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Sun, 3 Mar 2024 19:31:29 -0600 Subject: [PATCH] First attempt at pipeline --- .gitlab-ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..15257f5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +stages: + - compose + - build + +vauxite-compose-job: + image: registry.fedoraproject.org/fedora:latest + stage: compose + tags: + - podman-exec + variables: + CLEAN_BUILD: false + RELVER: "39" + SOURCE_URL: "https://pagure.io/workstation-ostree-config" + CACHE_DIR: "/cache" + BUILD_REPO: "/build-repo" + SOURCE_REPO: "/source-repo" + before_script: + - printf "fastestmirror=True\ndeltarpm=True\n" | tee -a /etc/dnf/dnf.conf + - dnf update -y + - dnf install -y ostree podman rpm-ostree rsync + - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - mkdir -p "$(pwd)/.tmp" + - | + if [ ! -d "${BUILD_REPO}/objects" ]; then + echo "Previous build repo not found. Initialize new build repo in archive mode." + ostree --repo="${BUILD_REPO}" init --mode=archive + fi + - if [ ! -d "${SOURCE_REPO}/.git" ]; then + echo "Source repo not found. Clone from upstream." + git clone -b "f${RELVER}" "${SOURCE_URL}" "${SOURCE_REPO}" + fi + - rsync -aAX "${SOURCE_REPO}"/ "$(pwd)/.tmp" + - rsync -aAX "$(pwd)/src/" "$(pwd)/.tmp" + - rpm-ostree compose image --cachedir "${CACHE_DIR}" --initialize-mode=if-not-exists --format=registry "$(pwd)/.tmp/vauxite.json" "${CI_REGISTRY_IMAGE}:${RELVER}" + +vauxite-nonfree-job: + stage: build + tags: + - shell-exec + variables: + - PODMAN_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + before_script: + - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - cd oci/nonfree + - podman build --pull -t "$PODMAN_IMAGE_NAME" . + - podman push "$PODMAN_IMAGE_NAME" + - | + if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then + podman tag "$PODMAN_IMAGE_NAME" "$CI_REGISTRY_IMAGE:latest" + podman push "$CI_REGISTRY_IMAGE:latest" + fi