diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab038dc43..974c49b97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ variables: public_docker_image: docker.io/${CI_PROJECT_PATH} stages: + - precheck - prepare - build_deps - build @@ -14,6 +15,17 @@ stages: - deploy - cleanup +## Check zeronet/alphanet + +precheck:constant: + image: ${opam_image} + stage: precheck + only: + - zeronet + - alphanet + script: + - ./scripts/check_patch.sh "${CI_COMMIT_REF_NAME}" + ## Template for `docker_in_docker` jobs .dind_template: &dind_definition @@ -56,7 +68,6 @@ build_deps: .build_deps_template: &build_deps_definition image: ${build_deps_image}:${CI_COMMIT_SHA} before_script: - - ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" - opam list tags: - gitlab-org @@ -456,7 +467,6 @@ publish:docker:minimal: - alphanet - zeronet script: - - ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ; - ./scripts/ci/create_docker_image.build.sh "tezos_build" "${CI_COMMIT_REF_NAME}" "${build_deps_image}:${CI_COMMIT_SHA}" @@ -481,7 +491,6 @@ publish:github: - echo "${CI_PK_GITHUB}" > ~/.ssh/id_rsa - chmod 400 ~/.ssh/id_rsa - rm -fr .git/refs/original - - ./scripts/apply_patch.sh "${CI_COMMIT_REF_NAME}" ; - sudo apk add --no-cache openssh - git push git@github.com:tezos/tezos.git -f HEAD:${CI_COMMIT_REF_NAME} tags: diff --git a/scripts/apply_patch.sh b/scripts/apply_patch.sh index fbd543b67..437fc4957 100755 --- a/scripts/apply_patch.sh +++ b/scripts/apply_patch.sh @@ -21,13 +21,13 @@ case "$branch" in sed -i s/TEZOS/TEZOS_ZERONET/ ./src/lib_shell/distributed_db_message.ml patch -p1 < scripts/alphanet_constants.patch patch -p1 < scripts/zeronet.patch - if has_git; then git commit -a -m "Zeronet: DO NOT MERGE" --author "Tezos CI "; fi + if has_git; then git commit -a -m "Zeronet: change economic constants." --author "Tezos CI "; fi echo "Done" ;; alphanet) sed -i s/TEZOS/TEZOS_ALPHANET/ ./src/lib_shell/distributed_db_message.ml patch -p1 < scripts/alphanet_constants.patch - if has_git; then git commit -a -m "Alphanet: DO NOT MERGE" --author "Tezos CI "; fi + if has_git; then git commit -a -m "Alphanet: change economic constants." --author "Tezos CI "; fi echo "Done" ;; *) diff --git a/scripts/check_patch.sh b/scripts/check_patch.sh new file mode 100755 index 000000000..c8ca53209 --- /dev/null +++ b/scripts/check_patch.sh @@ -0,0 +1,22 @@ +#! /bin/sh + +set -e + +if [ $1 != "zeronet" ] && [ $1 != "alphanet" ] ; then + echo Ignored + exit 0 +fi + +if git log | grep "net: change economic constants" >/dev/null 2>&1 ; then + echo OK + exit 0 +fi + +cat <