mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-04 21:25:24 +00:00
use $CI_* vars instead of hardcoded url + use docker login - useful for selfhosted gitlab instances
This commit is contained in:
parent
3f68954882
commit
983c71b8c2
2 changed files with 21 additions and 14 deletions
|
@ -248,7 +248,7 @@ variables:
|
|||
CLOUDRON_DOCKERFILE_PATH: $CI_PROJECT_DIR/deploy/cloudron/Dockerfile
|
||||
HEROKU_DOCKERFILE_PATH: $CI_PROJECT_DIR/heroku.Dockerfile
|
||||
# The image path for the helper CI util image that will be built and pushed to.
|
||||
CI_UTIL_IMAGE: $CI_REGISTRY/bramw/baserow/ci/ci_util_image:latest
|
||||
CI_UTIL_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH/ci/ci_util_image:latest
|
||||
|
||||
# ==================================== CI UTIL ====================================
|
||||
|
||||
|
@ -263,8 +263,6 @@ build-ci-util-image:
|
|||
DOCKER_BUILDKIT: 1
|
||||
DOCKER_HOST: tcp://docker:2376
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
before_script:
|
||||
- echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
|
||||
script:
|
||||
- cd .gitlab/ci_util_image
|
||||
- docker build -t $CI_UTIL_IMAGE .
|
||||
|
@ -573,9 +571,7 @@ build-cloudron-image:
|
|||
- job: build-all-in-one-image
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $MASTER_BRANCH_NAME
|
||||
- $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
- $BUILD_ALL_IN_ONE == "true"
|
||||
- ( $CI_COMMIT_BRANCH == $MASTER_BRANCH_NAME || $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME ) && $BUILD_ALL_IN_ONE == "true" && $CLOUDRON_IMAGE_NAME != "disable"
|
||||
variables:
|
||||
IMAGE_NAME: $CLOUDRON_IMAGE_NAME
|
||||
DOCKERFILE_PATH: $CLOUDRON_DOCKERFILE_PATH
|
||||
|
@ -593,9 +589,7 @@ build-heroku-image:
|
|||
- job: build-all-in-one-image
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $MASTER_BRANCH_NAME
|
||||
- $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
- $BUILD_ALL_IN_ONE == "true"
|
||||
- ( $CI_COMMIT_BRANCH == $MASTER_BRANCH_NAME || $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME ) && $BUILD_ALL_IN_ONE == "true" && $HEROKU_IMAGE_NAME != "disable"
|
||||
variables:
|
||||
IMAGE_NAME: $HEROKU_IMAGE_NAME
|
||||
DOCKERFILE_PATH: $HEROKU_DOCKERFILE_PATH
|
||||
|
@ -623,9 +617,8 @@ trigger-saas-build:
|
|||
variables:
|
||||
UPSTREAM_SHA: $CI_COMMIT_SHA
|
||||
UPSTREAM_SHORT_SHA: $CI_COMMIT_SHORT_SHA
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
rules:
|
||||
- if: $CI_PROJECT_ID == "10858056" && $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
allow_failure: true
|
||||
trigger:
|
||||
project: bramw/baserow-saas
|
||||
|
@ -779,7 +772,7 @@ publish-cloudron-develop-latest-image:
|
|||
extends: .publish-baserow-image
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
- $CLOUDRON_IMAGE_NAME != "disable" && $CI_COMMIT_BRANCH == $DEVELOP_BRANCH_NAME
|
||||
dependencies: []
|
||||
variables:
|
||||
SKIP_IF_NOT_LATEST_COMMIT_ON_BRANCH: $DEVELOP_BRANCH_NAME
|
||||
|
@ -793,6 +786,8 @@ publish-cloudron-develop-latest-image:
|
|||
publish-cloudron-release-tagged-image:
|
||||
extends: .publish-baserow-image
|
||||
only:
|
||||
variables:
|
||||
- $CLOUDRON_IMAGE_NAME != "disable"
|
||||
refs:
|
||||
- tags
|
||||
dependencies: []
|
||||
|
|
|
@ -412,13 +412,19 @@
|
|||
- !reference [.skip-if-tag-not-on-branch, script]
|
||||
- !reference [.skip-if-not-latest-commit-on-branch, script]
|
||||
- |
|
||||
echo "$TARGET_REGISTRY_PASSWORD" | docker login -u "$TARGET_REGISTRY_USER" "$TARGET_REGISTRY" --password-stdin
|
||||
|
||||
# If that project registry isn't public then we must login first.
|
||||
if [[ "$CI_PROJECT_VISIBILITY" != "public" ]]; then
|
||||
echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
|
||||
fi
|
||||
|
||||
if ! docker pull $SOURCE_IMAGE; then
|
||||
echo "Could not pull $SOURCE_IMAGE, has the build pipeline finished yet?" 2>&1;
|
||||
exit 1
|
||||
fi
|
||||
docker tag $SOURCE_IMAGE $TARGET_IMAGE
|
||||
|
||||
echo "$TARGET_REGISTRY_PASSWORD" | docker login -u "$TARGET_REGISTRY_USER" "$TARGET_REGISTRY" --password-stdin
|
||||
docker push $TARGET_IMAGE
|
||||
|
||||
.skippable-job:
|
||||
|
@ -433,6 +439,12 @@
|
|||
echo "Must provide RUN_WHEN_CHANGES_MADE_IN as a job variable" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# These jobs often pull from the projects CI_REGISTRY, but if that project registry isn't public then we must login first.
|
||||
if [[ "$CI_PROJECT_VISIBILITY" != "public" ]]; then
|
||||
echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
|
||||
fi
|
||||
|
||||
|
||||
if [[ -z "$PROJECT_READ_ONLY_API_TOKEN" && "$ENABLE_JOB_SKIPPING" = "true" ]]; then
|
||||
echo -e "$RED Disabling job skipping as PROJECT_READ_ONLY_API_TOKEN env variable not set. $CLEAR"
|
||||
|
|
Loading…
Add table
Reference in a new issue