mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xMAC94x/cleanup_ci' into 'master'
remove duplicate airshipper ci jobs. Introduce weekly build. See merge request veloren/veloren!3286
This commit is contained in:
commit
d409a67984
@ -14,6 +14,7 @@ variables:
|
|||||||
GIT_DEPTH: 3
|
GIT_DEPTH: 3
|
||||||
GIT_CLEAN_FLAGS: -f
|
GIT_CLEAN_FLAGS: -f
|
||||||
CACHE_IMAGE_TAG: d7756444
|
CACHE_IMAGE_TAG: d7756444
|
||||||
|
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
|
||||||
default:
|
default:
|
||||||
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines
|
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines
|
||||||
|
@ -194,38 +194,6 @@ macos-aarch64:
|
|||||||
- .release
|
- .release
|
||||||
tags: ["veloren/veloren:macos", "build", "publish", "trusted"]
|
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
|
# if NOT release or master, allow optional builds
|
||||||
opt-linux-x86_64:
|
opt-linux-x86_64:
|
||||||
extends:
|
extends:
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
# cargo clippy is a superset of cargo check, so we don't check manually
|
|
||||||
code-quality:
|
code-quality:
|
||||||
extends: .recompile-branch
|
extends: .recompile-branch
|
||||||
stage: check
|
stage: check
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||||
tags: ["veloren/veloren", "check"]
|
tags: ["veloren/veloren", "check"]
|
||||||
script:
|
script:
|
||||||
|
- echo $CI_COMMIT_TAG
|
||||||
|
- echo $TAG_REGEX
|
||||||
- ln -s /dockercache/target target
|
- ln -s /dockercache/target target
|
||||||
- cat ./.gitlab/scripts/code-quality.sh
|
- cat ./.gitlab/scripts/code-quality.sh
|
||||||
- source ./.gitlab/scripts/code-quality.sh
|
- source ./.gitlab/scripts/code-quality.sh
|
||||||
|
@ -3,16 +3,11 @@
|
|||||||
.publish:
|
.publish:
|
||||||
stage: publish
|
stage: publish
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
when: on_success
|
|
||||||
- when: never
|
|
||||||
|
|
||||||
.publish-nightly:
|
|
||||||
stage: publish
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
|
|
||||||
when: on_success
|
when: on_success
|
||||||
- when: never
|
- when: never
|
||||||
|
before_script:
|
||||||
|
- source "$CI_PROJECT_DIR/.gitlab/scripts/utils.sh"
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
extends: .publish
|
extends: .publish
|
||||||
@ -29,27 +24,16 @@ docker:
|
|||||||
# avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
|
# avoids this issue: https://github.com/GoogleContainerTools/kaniko/issues/1542
|
||||||
- export container=docker
|
- export container=docker
|
||||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
- 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}"
|
- |
|
||||||
|
publishdockertag PUBLISH_DOCKER_TAG
|
||||||
|
if [ "${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:
|
gittag:
|
||||||
extends: .publish-nightly
|
extends: .publish
|
||||||
image:
|
rules:
|
||||||
name: gcr.io/kaniko-project/executor:debug
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
|
||||||
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
|
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||||
tags: ["veloren/veloren", "publish", "trusted"]
|
tags: ["veloren/veloren", "publish", "trusted"]
|
||||||
script:
|
script:
|
||||||
@ -57,11 +41,16 @@ tag-nightly:
|
|||||||
- git config --global user.name "veloren-bot"
|
- git config --global user.name "veloren-bot"
|
||||||
- git config --global http.postBuffer 52428800
|
- git config --global http.postBuffer 52428800
|
||||||
- git remote set-url origin https://veloren-bot:${GITLAB_TOKEN_WRITE}@${CI_PROJECT_URL:8}
|
- 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 [[ ! "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then
|
||||||
|
git tag -a "${SCHEDULE_CADENCE}" -m '' -f;
|
||||||
|
git push origin "${SCHEDULE_CADENCE}" -f;
|
||||||
|
fi
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
extends: .publish
|
extends: .publish
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||||
tags: ["veloren/veloren", "publish"]
|
tags: ["veloren/veloren", "publish"]
|
||||||
artifacts:
|
artifacts:
|
||||||
|
@ -2,28 +2,16 @@
|
|||||||
.optional-release:
|
.optional-release:
|
||||||
stage: check
|
stage: check
|
||||||
rules:
|
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 != null && $CI_COMMIT_TAG =~ $TAG_REGEX )
|
||||||
when: never
|
when: never
|
||||||
- when: manual
|
- when: manual
|
||||||
allow_failure: true
|
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:
|
.release:
|
||||||
stage: build
|
stage: build
|
||||||
rules:
|
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]+/)
|
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && ( $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || ( $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ $TAG_REGEX ) )
|
||||||
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]+/)
|
|
||||||
when: on_success
|
when: on_success
|
||||||
- when: never
|
- when: never
|
||||||
retry:
|
retry:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# cargo clippy is a superset of cargo check, so we don't check manually
|
||||||
time cargo clippy --all-targets --locked --features="bin_cmd_doc_gen,bin_compression,bin_csv,bin_graphviz,bin_bot,bin_asset_migrate,asset_tweak" -- -D warnings &&
|
time cargo clippy --all-targets --locked --features="bin_cmd_doc_gen,bin_compression,bin_csv,bin_graphviz,bin_bot,bin_asset_migrate,asset_tweak" -- -D warnings &&
|
||||||
# Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features
|
# Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features
|
||||||
time cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings &&
|
time cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings &&
|
||||||
|
29
.gitlab/scripts/util.sh
Executable file
29
.gitlab/scripts/util.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
### returns respective DOCKER TAG
|
||||||
|
### release-tag => <release-tag> (e.g. v1.2.3)
|
||||||
|
### schedule => <SCHEDULE_CADENCE> (e.g. nightly)
|
||||||
|
### master => "master"
|
||||||
|
### else => ""
|
||||||
|
publishdockertag () {
|
||||||
|
# this stores the result in a variable defined by the caller
|
||||||
|
local -n VAR=$1
|
||||||
|
VAR="";
|
||||||
|
if [[ "${CI_COMMIT_TAG}" =~ ${TAG_REGEX} ]]; then
|
||||||
|
VAR="${CI_COMMIT_TAG}";
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
if [[ -z "${SCHEDULE_CADENCE}" && ${CI_PIPELINE_SOURCE} == "schedule" ]]; then
|
||||||
|
# sanitize check
|
||||||
|
if [[ "${SCHEDULE_CADENCE}" =~ ${TAG_REGEX} ]]; then
|
||||||
|
VAR="invalid_cadence";
|
||||||
|
else
|
||||||
|
VAR="${SCHEDULE_CADENCE}";
|
||||||
|
fi
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
if [[ ${CI_COMMIT_BRANCH} == ${CI_DEFAULT_BRANCH} ]]; then
|
||||||
|
VAR="master";
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user