Stubbing out very rough gitlab ci

This commit is contained in:
James Jones
2022-11-16 17:59:46 -05:00
parent 394a6fe577
commit 45dc2717cf
2 changed files with 62 additions and 32 deletions

View File

@@ -1,38 +1,66 @@
docker-build:
# Use the official docker image.
# image: docker:latest
stage: build
# services:
# - docker:dind
stages:
- dind-build
before_script:
- dnf install -y podman-docker
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# docker-build:
# # Use the official docker image.
# # image: docker:latest
# stage: build
# # services:
# # - docker:dind
# tags:
# - big-build
# before_script:
# - dnf install -y podman-docker
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# # Default branch leaves tag empty (= latest tag)
# # All other branches are tagged with the escaped branch name (commit ref slug)
# script:
# - |
# if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
# tag=""
# echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
# else
# tag=":$CI_COMMIT_REF_SLUG"
# echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
# fi
# - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
# - docker push "$CI_REGISTRY_IMAGE${tag}"
# # Run this job in a branch where a Dockerfile exists
# rules:
# - if: $CI_COMMIT_BRANCH
# exists:
# - Dockerfile
build:prereleases:
stage: dind-build
tags:
- big-build
before_script:
- dnf install -y podman-docker
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile
- export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-')
- docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG"
only:
- branches
except:
- main
build:releases:
stage: dind-build
tags:
- big-build
script:
- export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-')
- docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG"
- docker tag "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest"
- docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest"
only:
- tags
# image: fedora:latest

View File

@@ -1 +1,3 @@
FROM registry.fedoraproject.org/fedora:latest
FROM quay.io/podman/stable:latest
RUN dnf install -y podman-docker buildah skopeo