summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorJonas Zohren <gitlab-jfowl-0ux98@sh14.de>2021-11-25 22:36:44 +0000
committerTimo Kösters <timo@koesters.xyz>2021-11-25 22:36:44 +0000
commit9bfc7b34b6d72def7da19ccd1decbe1ac2c7e6db (patch)
treededd9596d15132685b79943926a81caeed7a0aca /.gitlab-ci.yml
parentafa5d449c605b6ddae8d2397b2996fda356f8b78 (diff)
downloadconduit-9bfc7b34b6d72def7da19ccd1decbe1ac2c7e6db.zip
Fixes for !225
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml87
1 files changed, 31 insertions, 56 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6f2e0fe..a8d4384 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -142,8 +142,12 @@ build:debug:cargo:x86_64-unknown-linux-musl:
DOCKER_HOST: tcp://docker:2375/
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
- PLATFORMS: "linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64"
+ PLATFORMS: "linux/arm/v6,linux/arm/v7,linux/arm64,linux/amd64"
DOCKER_FILE: "docker/ci-binaries-packaging.Dockerfile"
+ cache:
+ paths:
+ - docker_cache
+ key: "$CI_JOB_NAME"
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Only log in to Dockerhub if the credentials are given:
@@ -156,80 +160,51 @@ build:debug:cargo:x86_64-unknown-linux-musl:
- mkdir -p linux/ && mv ./conduit-x86_64-unknown-linux-musl linux/amd64
- mkdir -p linux/arm/ && mv ./conduit-arm-unknown-linux-musleabihf linux/arm/v6
- mkdir -p linux/arm/ && mv ./conduit-armv7-unknown-linux-musleabihf linux/arm/v7
- - mkdir -p linux/arm64/ && mv ./conduit-aarch64-unknown-linux-musl linux/arm64/v8
- # Actually create multiarch image:
+ - mv ./conduit-aarch64-unknown-linux-musl linux/arm64
+ - 'export CREATED=$(date -u +''%Y-%m-%dT%H:%M:%SZ'') && echo "Docker image creation date: $CREATED"'
+ # Build and push image:
- >
docker buildx build
--pull
--push
- --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
+ --cache-from=type=local,src=$CI_PROJECT_DIR/docker_cache
+ --cache-to=type=local,dest=$CI_PROJECT_DIR/docker_cache
+ --build-arg CREATED=$CREATED
--build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
--build-arg "GIT_REF=$CI_COMMIT_SHORT_SHA"
--platform "$PLATFORMS"
- --tag "$GL_IMAGE_TAG"
- --tag "$GL_IMAGE_TAG-commit-$CI_COMMIT_SHORT_SHA"
+ --tag "$TAG"
+ --tag "$TAG-alpine"
+ --tag "$TAG-commit-$CI_COMMIT_SHORT_SHA"
--file "$DOCKER_FILE" .
- # Only try to push to docker hub, if auth data for dockerhub exists:
- - if [ -n "${DOCKER_HUB}" ]; then docker push "$DH_IMAGE_TAG"; fi
- - if [ -n "${DOCKER_HUB}" ]; then docker push "$DH_IMAGE_TAG-commit-$CI_COMMIT_SHORT_SHA"; fi
-build:docker:next:
+docker:next:gitlab:
extends: .docker-shared-settings
rules:
- if: '$CI_COMMIT_BRANCH == "next"'
variables:
- GL_IMAGE_TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:next"
- DH_IMAGE_TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
+ TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:next"
-build:docker:master:
+docker:next:dockerhub:
+ extends: .docker-shared-settings
+ rules:
+ - if: '$CI_COMMIT_BRANCH == "next" && $DOCKER_HUB'
+ variables:
+ TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
+
+docker:master:gitlab:
extends: .docker-shared-settings
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
variables:
- GL_IMAGE_TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:latest"
- DH_IMAGE_TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:latest"
+ TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:latest"
-## Build a docker image by packaging up the x86_64-unknown-linux-musl binary into an alpine image
-#.docker-shared-settings:
-# stage: "build docker image"
-# needs: []
-# interruptible: true
-# image:
-# name: "gcr.io/kaniko-project/executor:debug"
-# entrypoint: [""]
-# tags: ["docker"]
-# variables:
-# # Configure Kaniko Caching: https://cloud.google.com/build/docs/kaniko-cache
-# KANIKO_CACHE_ARGS: "--cache=true --cache-copy-layers=true --cache-ttl=120h --cache-repo $CI_REGISTRY_IMAGE/kaniko-ci-cache"
-# before_script:
-# - "mkdir -p /kaniko/.docker"
-# - 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"$DOCKER_HUB\":{\"username\":\"$DOCKER_HUB_USER\",\"password\":\"$DOCKER_HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json'
-#
-#
-#build:docker:next:
-# extends: .docker-shared-settings
-# needs:
-# - "build:release:cargo:x86_64-unknown-linux-musl"
-# script:
-# - >
-# /kaniko/executor
-# $KANIKO_CACHE_ARGS
-# --force
-# --context $CI_PROJECT_DIR
-# --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-# --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
-# --build-arg "GIT_REF=$CI_COMMIT_SHORT_SHA"
-# --dockerfile "$CI_PROJECT_DIR/docker/ci-binaries-packaging.Dockerfile"
-# --destination "$CI_REGISTRY_IMAGE/conduit:next"
-# --destination "$CI_REGISTRY_IMAGE/conduit:next-alpine"
-# --destination "$CI_REGISTRY_IMAGE/conduit:commit-$CI_COMMIT_SHORT_SHA"
-# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
-# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next-alpine"
-# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:commit-$CI_COMMIT_SHORT_SHA"
-# rules:
-# - if: '$CI_COMMIT_BRANCH == "next"'
-#
-#
+docker:master:dockerhub:
+ extends: .docker-shared-settings
+ rules:
+ - if: '$CI_COMMIT_BRANCH == "master" && $DOCKER_HUB'
+ variables:
+ TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:latest"
# --------------------------------------------------------------------- #
# Run tests #