Commit 3bf1630d authored by Marcel Huber's avatar Marcel Huber
Browse files

Merge branch 'release/20180903-1'

parents 347ceb25 981b430c
Pipeline #18463 failed with stages
in 1 minute and 2 seconds
image: docker:latest
variables:
IMAGE_NAME: "ArchLinux yaourt build image"
LOCAL_IMAGE: $CI_REGISTRY_IMAGE/arch-yaourt
LOCAL_IMAGE_TAG: $CI_REGISTRY_IMAGE/arch-yaourt:$CI_COMMIT_REF_NAME
REMOTE_IMAGE: marcelhuberfoo/arch-yaourt
DESCRIPTION: "ArchLinux yaourt build image"
IMAGE_NAME_COMMIT_REF: "$CI_REGISTRY_IMAGE/arch-yaourt:$CI_COMMIT_REF_SLUG"
IMAGE_NAME_COMMIT_TAG: "$CI_REGISTRY_IMAGE/arch-yaourt:$CI_COMMIT_TAG"
IMAGE_NAME_LATEST: "$CI_REGISTRY_IMAGE/arch-yaourt:latest"
IMAGE_NAME_REMOTE: marcelhuberfoo/arch-yaourt
stages:
- build
- test
- deploy
BuildImage:
Build:
stage: build
tags:
- docker
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --no-cache
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
--label org.label-schema.name="$IMAGE_NAME"
--label org.label-schema.url="$CI_PROJECT_URL"
--label maintainer="$GITLAB_USER_EMAIL"
--label org.label-schema.build-date="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
--label org.label-schema.description="$DESCRIPTION"
--label org.label-schema.name="$CI_PROJECT_NAME"
--label org.label-schema.schema-version="1.0"
--label org.label-schema.url="$CI_PROJECT_URL"
--label org.label-schema.vcs-ref="$CI_COMMIT_SHA"
--label org.label-schema.vcs-url="$(echo $CI_REPOSITORY_URL | sed 's|gitlab-ci-token[^@]*@||')"
--label org.label-schema.vendor="me"
--label org.label-schema.version="$CI_COMMIT_REF_NAME"
--tag=$LOCAL_IMAGE_TAG
--label org.label-schema.vendor="$CI_PROJECT_NAMESPACE"
--label org.label-schema.version="${CI_COMMIT_TAG:-$CI_COMMIT_REF_NAME}"
--tag=$IMAGE_NAME_COMMIT_REF
--file=Dockerfile
.
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $LOCAL_IMAGE_TAG
- docker push $IMAGE_NAME_COMMIT_REF
TestImage:
Test:
stage: test
tags:
- docker
script:
- docker run --rm $LOCAL_IMAGE_TAG yaourt --version
- docker run --rm $IMAGE_NAME_COMMIT_REF yaourt --version
Tag:
stage: deploy
only:
- tags
tags:
- docker
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE_NAME_COMMIT_REF
- docker image tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_COMMIT_TAG
- docker push $IMAGE_NAME_COMMIT_TAG
- test -n "$DOCKER_USER" -a -n "$IMAGE_NAME_REMOTE" && {
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_REMOTE:$CI_COMMIT_TAG;
docker push $IMAGE_NAME_REMOTE:$CI_COMMIT_TAG;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
apk --no-cache add curl;
curl --silent --request POST $MICROBADGER_UPDATE_HOOK;
} || true
TagImage:
Deploy latest image:
stage: deploy
only:
- tags
- triggers
when: manual
tags:
- docker
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker image tag $LOCAL_IMAGE_TAG $LOCAL_IMAGE:$CI_COMMIT_TAG
- test -n "$DOCKER_USER" && {
- docker pull $IMAGE_NAME_COMMIT_REF
- docker image tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_LATEST
- docker push $IMAGE_NAME_LATEST
- test -n "$DOCKER_USER" -a -n "$IMAGE_NAME_REMOTE" && {
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker tag $LOCAL_IMAGE_TAG $REMOTE_IMAGE:latest;
docker tag $LOCAL_IMAGE_TAG $REMOTE_IMAGE:$CI_COMMIT_TAG;
docker push $REMOTE_IMAGE:latest;
docker push $REMOTE_IMAGE:$CI_COMMIT_TAG;
docker tag $IMAGE_NAME_COMMIT_REF $IMAGE_NAME_REMOTE:latest;
docker push $IMAGE_NAME_REMOTE:latest;
} || true
- test -n "$MICROBADGER_UPDATE_HOOK" && {
apk --no-cache add curl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment