diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..18f8eec --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,49 @@ +stages: + - build + +default: + image: registry.gitlab.com/wunker-bunker/ci-builder + before_script: + - | + IMAGE_NAME=$(yq '.name' ./$RECIPE) + IMAGE_DESCRIPTION=$(yq '.description' ./$RECIPE) + FEDORA_MAJOR_VERSION=$(yq '.fedora-version' ./$RECIPE) + BASE_IMAGE_URL=$(yq '.base-image' ./$RECIPE) + # Generate a timestamp for creating an image version history + TIMESTAMP="$(date +%Y%m%d)" + COMMIT_TAGS=() + BUILD_TAGS=() + # Have tags for tracking builds during pull request + SHA_SHORT="$CI_COMMIT_SHA" + COMMIT_TAGS+=("pr-${{ github.event.number }}-${FEDORA_MAJOR_VERSION}") + COMMIT_TAGS+=("${SHA_SHORT}-${FEDORA_MAJOR_VERSION}") + + BUILD_TAGS=("${FEDORA_MAJOR_VERSION}" "${FEDORA_MAJOR_VERSION}-${TIMESTAMP}") + + BUILD_TAGS+=("${TIMESTAMP}") + BUILD_TAGS+=("latest") + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "Generated the following commit tags: " + for TAG in "${COMMIT_TAGS[@]}"; do + echo "${TAG}" + done + alias_tags=("${COMMIT_TAGS[@]}") + else + alias_tags=("${BUILD_TAGS[@]}") + fi + echo "Generated the following build tags: " + for TAG in "${BUILD_TAGS[@]}"; do + echo "${TAG}" + done + echo "alias_tags=${alias_tags[*]}" + +build: + stage: build + parallel: + matrix: + - RECIPE: + - recipe-desktop.yml + - recipe-framework.yml + script: + - buildah build . --build-arg=RECIPE=$RECIPE --build-arg=FEDORA_MAJOR_VERSION=$FEDORA_MAJOR_VERSION --build-arg BASE_IMAGE_URL=$BASE_IMAGE_URL \ No newline at end of file