Commits on Source (7)
stages:
- build
- push
default:
interruptible: true
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
variables:
CI_IMAGE: "quay.io/buildah/stable"
DOCKERHUB_REPO: "paritytech"
DOCKERFILE: Dockerfile
IMAGE_NAME: docker.io/$DOCKERHUB_REPO/$CI_PROJECT_NAME
.test-refs: &test-refs
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
.publish-refs: &publish-refs
rules:
- if: $CI_COMMIT_REF_NAME == "master"
.kubernetes-env: &kubernetes-env
image: $CI_IMAGE
tags:
- kubernetes-parity-build
# template task for building and pushing an image
.build-push-docker-image: &build-push-docker-image
<<: *kubernetes-env
script:
- export VERSION=$(cat Cargo.toml| grep version | head -1 | awk '{print $3}' | tr -d '"')
- test "${Docker_Hub_User_Parity}" -a "${Docker_Hub_Pass_Parity}" ||
( echo "no docker credentials provided"; exit 1 )
- buildah bud
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg VERSION="$VERSION"
--build-arg PROJECT_NAME="${CI_PROJECT_NAME}"
--tag "${IMAGE_NAME}:$VERSION"
--tag "${IMAGE_NAME}:latest"
--file "${DOCKERFILE}" .
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin docker.io
- buildah info
- buildah push --format=v2s2 "${IMAGE_NAME}:${VERSION}"
- buildah push --format=v2s2 "${IMAGE_NAME}:latest"
after_script:
- buildah logout --all
# test that docker image can build
.build-only-docker-image: &build-only-docker-image
<<: *kubernetes-env
script:
- export VERSION=$(cat Cargo.toml| grep version | head -1 | awk '{print $3}' | tr -d '"')
- buildah bud
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg PROJECT_NAME="${CI_PROJECT_NAME}"
--tag "${IMAGE_NAME}:latest"
--tag "${IMAGE_NAME}:${VERSION}"
--file "$DOCKERFILE" .
build-docker:
stage: build
<<: *test-refs
<<: *build-only-docker-image
# publish to paritytech dockerhub
publish-docker:
stage: push
<<: *publish-refs
<<: *build-push-docker-image
# Lists some code owners.
#
# A codeowner just oversees some part of the codebase. If an owned file is changed then the
# corresponding codeowner receives a review request. An approval of the codeowner might be
# required for merging a PR (depends on repository settings).
#
# For details about syntax, see:
# https://help.github.com/en/articles/about-code-owners
# But here are some important notes:
#
# - Glob syntax is git-like, e.g. `/core` means the core directory in the root, unlike `core`
# which can be everywhere.
# - Multiple owners are supported.
# - Either handle (e.g, @github_user or @github_org/team) or email can be used. Keep in mind,
# that handles might work better because they are more recognizable on GitHub,
# you can use them for mentioning unlike an email.
# - The latest matching rule, if multiple, takes precedence.
# CI
/.gitlab-ci.yml @paritytech/ci
Dockerfile @paritytech/ci
......@@ -9,10 +9,24 @@ RUN cargo build --${PROFILE} --bins
# MAIN IMAGE FOR PEOPLE TO PULL --- small one#
FROM docker.io/debian:buster-slim
LABEL maintainer="Chevdor"
ARG VCS_REF=master
ARG BUILD_DATE=""
ARG REGISTRY_PATH="docker.io/paritytech"
ARG PROJECT_NAME=""
ARG PROFILE=release
ARG USER=ci
LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
io.parity.image.title="${REGISTRY_PATH}/${PROJECT_NAME}" \
io.parity.image.description="${PROJECT_NAME}" \
io.parity.image.source="https://github.com/paritytech/${PROJECT_NAME}/blob/${VCS_REF}/Dockerfile" \
io.parity.image.documentation="https://github.com/paritytech/${PROJECT_NAME}/blob/${VCS_REF}/README.md" \
io.parity.image.revision="${VCS_REF}" \
io.parity.image.created="${BUILD_DATE}"
WORKDIR /usr/local/bin
COPY --from=builder /app/target/$PROFILE/ruled-labels /usr/local/bin
......