mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
remove duplicate airshipper ci jobs. Introduce weekly build.
This requires the veloren schedule to contain variables and requires the airshipper server to handle those in the config
This commit is contained in:
parent
c6066d7f3f
commit
203fe7ad47
@ -194,38 +194,6 @@ macos-aarch64:
|
||||
- .release
|
||||
tags: ["veloren/veloren:macos", "build", "publish", "trusted"]
|
||||
|
||||
# The air-* builds are the builds that Airshipper Server expects to find in the scheduled build webhook JSON.
|
||||
# Renaming these will break Airshipper downloads! build on schedule quickfix till airshipper 0.5
|
||||
air-linux-x86_64:
|
||||
extends:
|
||||
- .tlinux-x86_64
|
||||
- .release-scheduled
|
||||
tags: ["veloren/veloren", "build", "publish", "trusted"]
|
||||
|
||||
air-linux-aarch64:
|
||||
extends:
|
||||
- .tlinux-aarch64
|
||||
- .release-scheduled
|
||||
tags: ["veloren/veloren", "build", "publish", "trusted"]
|
||||
|
||||
air-windows-x86_64:
|
||||
extends:
|
||||
- .twindows-x86_64
|
||||
- .release-scheduled
|
||||
tags: ["veloren/veloren", "build", "publish", "trusted"]
|
||||
|
||||
air-macos-x86_64:
|
||||
extends:
|
||||
- .tmacos-x86_64
|
||||
- .release-scheduled
|
||||
tags: ["veloren/veloren:macos", "build", "publish", "trusted"]
|
||||
|
||||
air-macos-aarch64:
|
||||
extends:
|
||||
- .tmacos-aarch64
|
||||
- .release-scheduled
|
||||
tags: ["veloren/veloren:macos", "build", "publish", "trusted"]
|
||||
|
||||
# if NOT release or master, allow optional builds
|
||||
opt-linux-x86_64:
|
||||
extends:
|
||||
|
@ -3,16 +3,15 @@
|
||||
.publish:
|
||||
stage: publish
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"
|
||||
when: on_success
|
||||
- when: never
|
||||
|
||||
.publish-nightly:
|
||||
stage: publish
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
when: on_success
|
||||
- when: never
|
||||
before_script:
|
||||
- source "$CI_PROJECT_DIR/.gitlab/scripts/utils.sh"
|
||||
- publishtype PUBLISH_TYPE
|
||||
- publishdockertag PUBLISH_DOCKER_TAG
|
||||
- publishgittag PUBLISH_GIT_TAG
|
||||
- echo "Publish detected '$PUBLISH_TYPE' Docker Tag '$PUBLISH_DOCKER_TAG' Git Tag '$PUBLISH_GIT_TAG'"
|
||||
|
||||
docker:
|
||||
extends: .publish
|
||||
@ -29,27 +28,13 @@ docker:
|
||||
# avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
|
||||
- export container=docker
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${CI_COMMIT_REF_NAME}"
|
||||
- |
|
||||
if [[ ! -z "${PUBLISH_DOCKER_TAG}" ]]; then
|
||||
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:${PUBLISH_DOCKER_TAG}"
|
||||
fi
|
||||
|
||||
docker-nightly:
|
||||
extends: .publish-nightly
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
tags: ["veloren/veloren", "publish", "trusted"]
|
||||
dependencies:
|
||||
- air-linux-x86_64
|
||||
before_script:
|
||||
- ls "$CI_PROJECT_DIR/server-cli/"
|
||||
script:
|
||||
# Help kaniko identify that it is running in a container.
|
||||
# avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
|
||||
- export container=docker
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}/server-cli:nightly"
|
||||
|
||||
tag-nightly:
|
||||
extends: .publish-nightly
|
||||
gittag:
|
||||
extends: .publish
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||
tags: ["veloren/veloren", "publish", "trusted"]
|
||||
script:
|
||||
@ -57,8 +42,11 @@ tag-nightly:
|
||||
- git config --global user.name "veloren-bot"
|
||||
- git config --global http.postBuffer 52428800
|
||||
- git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8}
|
||||
- git tag -a "nightly" -m '' -f
|
||||
- git push origin nightly -f
|
||||
- |
|
||||
if [[ ! -z "${PUBLISH_GIT_TAG}" ]]; then
|
||||
git tag -a "${PUBLISH_GIT_TAG}" -m '' -f;
|
||||
git push origin "${PUBLISH_GIT_TAG}" -f;
|
||||
fi
|
||||
|
||||
pages:
|
||||
extends: .publish
|
||||
|
@ -2,28 +2,16 @@
|
||||
.optional-release:
|
||||
stage: check
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event" || $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/
|
||||
when: never
|
||||
- when: manual
|
||||
allow_failure: true
|
||||
|
||||
# Template to only run if pushes to master, a version tag, or release branch happened
|
||||
# Template to only run if pushes to master, schedule or a version tag
|
||||
.release:
|
||||
stage: build
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_PIPELINE_SOURCE != "schedule" && ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/)
|
||||
when: on_success
|
||||
- when: never
|
||||
retry:
|
||||
max: 1
|
||||
|
||||
# Template to only run if pushes to master or a tag happened for scheduled builds
|
||||
# This is a temporary fix until Airshipper can use a different mechanism of identifying jobs it should take
|
||||
# artifacts from. Once this is done the air-* jobs can be removed.
|
||||
.release-scheduled:
|
||||
stage: build-nightly
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/)
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/)
|
||||
when: on_success
|
||||
- when: never
|
||||
retry:
|
||||
|
97
.gitlab/scripts/util.sh
Executable file
97
.gitlab/scripts/util.sh
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
### forbid setting SCHEDULE_CADENCE to v0.1.2 syntax
|
||||
sanitize () {
|
||||
local -n VAR=$1
|
||||
INPUT=$2
|
||||
if [[ "${INPUT}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "---WARN---SANITIZE---ACTIVE---"
|
||||
VAR="";
|
||||
return 1;
|
||||
fi
|
||||
VAR="${INPUT}";
|
||||
}
|
||||
|
||||
### returns the respective type of publish for the ci
|
||||
### 0 => optional build/no publish
|
||||
### 10 => master build
|
||||
### 20 => scheduled build
|
||||
### 30 => release build
|
||||
publishtype () {
|
||||
local -n VAR=$1
|
||||
if [[ "${CI_COMMIT_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
VAR=30;
|
||||
return 0;
|
||||
fi
|
||||
if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then
|
||||
VAR=20;
|
||||
return 0;
|
||||
fi
|
||||
if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then
|
||||
VAR=10;
|
||||
return 0;
|
||||
fi
|
||||
VAR=0;
|
||||
}
|
||||
|
||||
### returns respective DOCKER TAG
|
||||
### 0 => exit code 3
|
||||
### 10 => master
|
||||
### 20 => <SCHEDULE_CADENCE>
|
||||
### 30 => <tag>
|
||||
### else => exit code 7
|
||||
|
||||
publishdockertag () {
|
||||
local -n VAR=$1
|
||||
INPUT=$2
|
||||
if [[ "${INPUT}" == "0" ]]; then
|
||||
VAR="";
|
||||
return 3;
|
||||
fi
|
||||
if [[ "${INPUT}" == "10" ]]; then
|
||||
VAR="master";
|
||||
return 0;
|
||||
fi
|
||||
if [[ "${INPUT}" == "20" ]]; then
|
||||
VAR="${SCHEDULE_CADENCE}";
|
||||
sanitize $1 "${VAR}";
|
||||
return 0;
|
||||
fi
|
||||
if [[ "${INPUT}" == "30" ]]; then
|
||||
VAR="${CI_COMMIT_TAG}";
|
||||
return 0;
|
||||
fi
|
||||
VAR="";
|
||||
return 7;
|
||||
}
|
||||
|
||||
### returns respective GIT TAG
|
||||
### 0 => exit code 3
|
||||
### 10 => exit code 4
|
||||
### 20 => <SCHEDULE_CADENCE>
|
||||
### 30 => exit code 6
|
||||
### else => exit code 7
|
||||
|
||||
publishgittag () {
|
||||
local -n VAR=$1
|
||||
INPUT=$2
|
||||
if [[ "${INPUT}" == "0" ]]; then
|
||||
VAR="";
|
||||
return 3;
|
||||
fi
|
||||
if [[ "${INPUT}" == "10" ]]; then
|
||||
VAR="";
|
||||
return 4;
|
||||
fi
|
||||
if [[ "${INPUT}" == "20" ]]; then
|
||||
VAR="${SCHEDULE_CADENCE}";
|
||||
sanitize $1 "${VAR}";
|
||||
return 0;
|
||||
fi
|
||||
if [[ "${INPUT}" == "30" ]]; then
|
||||
VAR="${CI_COMMIT_TAG}";
|
||||
return 0;
|
||||
fi
|
||||
VAR="";
|
||||
return 7;
|
||||
}
|
Loading…
Reference in New Issue
Block a user