Skip to content

Commit

Permalink
Merge branch 'pu/mm/ci-remove-dependency-on-source-build' into '2022.11'
Browse files Browse the repository at this point in the history
ci remove dependency on source build

See merge request tine20/tine20!5063
  • Loading branch information
byteplow committed Mar 7, 2024
2 parents 62a93d1 + 92efcca commit ce16031
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 85 deletions.
39 changes: 1 addition & 38 deletions ci/gitlab-ci/abstract_customapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ stages:
- merge

variables:
# also needs to be set in build job
IMAGE_TAG: $CI_PROJECT_ID-$CI_PIPELINE_IID-$PHP_VERSION
CI_IS_CUSTOMAPP: "true"
# TESTS
PHP_UNIT_ALL_TESTS_SOURCE_PARALLEL: "false"
Expand All @@ -39,39 +37,4 @@ workflow:
# Do not run pipelines on push for feature branches. Only merge requests should run feature branche pipelines.
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /(^feat)|(^pu)|(change)/
when: never
- when: always

docker_build_source:
stage: build
trigger:
project: tine20/tine20
branch: $TINE20_BRANCH
strategy: depend
variables:
RUN_NO_TESTS: "true"
AUTO_MERGE: "never"
IMAGE_TAG: $CI_PROJECT_ID-$CI_PIPELINE_IID-$PHP_VERSION
DOCKER_BUILD_SOURCE: "true"
docker_build_source_matrix:
stage: build
parallel:
matrix:
- PHP_VERSION:
- "7.4"
- "8.0"
- "8.1"
script:
- echo job is there for needs
rules:
- if: $NOT_TURE == "true"
when: on_success
- when: never

docker_build_built:
stage: build
script:
- echo job is there for needs
rules:
- if: $NOT_TURE == "true"
when: on_success
- when: never
- when: always
6 changes: 6 additions & 0 deletions ci/gitlab-ci/build_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,15 @@ docker_build_source_arm64:
docker_build_built:
extends: .abstract_jobs.docker
stage: build2
needs: []
script:
- !reference [.lib, script]
- docker_build_image base $(docker_image_hash base)
- export BASE_IMAGE="${REGISTRY}/base:$(docker_image_hash base)";
- docker_build_image dependency $(docker_image_hash dependency)
- export DEPENDENCY_IMAGE="${REGISTRY}/dependency:$(docker_image_hash dependency)";
- cp $DOCKER_GIT_CONFIG ./ci/dockerimage/.gitconfig
- ${CI_BUILDS_DIR}/${CI_PROJECT_NAMESPACE}/tine20/ci/scripts/reuse_or_build_image.sh source false
- ${CI_BUILDS_DIR}/${CI_PROJECT_NAMESPACE}/tine20/ci/scripts/build_image.sh build
- ${CI_BUILDS_DIR}/${CI_PROJECT_NAMESPACE}/tine20/ci/scripts/build_image.sh built
- ${CI_BUILDS_DIR}/${CI_PROJECT_NAMESPACE}/tine20/ci/scripts/build_image.sh test-built
Expand Down Expand Up @@ -307,6 +312,7 @@ docker_build_dev:
stage: build2
script:
- !reference [.lib, script]
- docker_build_image base $(docker_image_hash base)
- export BASE_IMAGE="${REGISTRY}/base:$(docker_image_hash base)";
- ${CI_BUILDS_DIR}/${CI_PROJECT_NAMESPACE}/tine20/ci/scripts/build_image.sh dev
rules:
Expand Down
2 changes: 0 additions & 2 deletions ci/gitlab-ci/lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@
curl -X POST -F token=$MERGE_TRIGGER_TOKEN \
-F ref=$ref \
-F "variables[$var]=true" \
-F "variables[DOCKER_BUILD_SOURCE]=true" \
-F "variables[SEND_PIPELINE_STATUS]=true" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/trigger/pipeline" > /dev/null
done
Expand Down Expand Up @@ -1558,7 +1557,6 @@
curl -X POST -F token=$MERGE_TRIGGER_TOKEN \
-F ref=$ref \
-F "variables[$var]=true" \
-F "variables[DOCKER_BUILD_SOURCE]=true" \
-F "variables[SEND_PIPELINE_STATUS]=true" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/trigger/pipeline" > /dev/null
done
Expand Down
1 change: 0 additions & 1 deletion ci/gitlab-ci/lib/scripts/merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ merge_trigger_next () {
curl -X POST -F token=$MERGE_TRIGGER_TOKEN \
-F ref=$ref \
-F "variables[$var]=true" \
-F "variables[DOCKER_BUILD_SOURCE]=true" \
-F "variables[SEND_PIPELINE_STATUS]=true" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/trigger/pipeline" > /dev/null
done
Expand Down
71 changes: 36 additions & 35 deletions ci/gitlab-ci/test_jobs.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
check-php-version:
extends: .abstract_jobs.copy_source
stage: test
variables:
ARG_IMAGE: test-source
needs:
- docker_build_source
script:
- echo "PHP version shoud be ${PHP_VERSION}."
- php -r "echo 'PHP version is'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;"
- php -r "if (version_compare(PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION, '${PHP_VERSION}', '!=')) exit(1);"
rules:
- if: $RUN_NO_TESTS == "true"
when: never
- if: $CHECK_PHP_VERSION == "never"
when: never
- if: $RUN_ALL_TESTS == "true"
when: on_success
- if: $CHECK_PHP_VERSION == "true"
when: on_success
- when: never
rules:
- if: $RUN_NO_TESTS == "true"
when: never
- if: $CHECK_PHP_VERSION == "false"
when: never
- if: $CHECK_PHP_VERSION == "true"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CHECK_PHP_VERSION_MERGE_REQUEST == "true"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS =~ /test-with-health-check/
- if: $PIPELINE_TYPE =~ /default-tests/
- if: $PIPELINE_TYPE =~ /mr-tests/
- if: $CI_COMMIT_TAG
allow_failure: true
timeout: 20m # time run: 4m
interruptible: true
# todo: should run ob build image and on test images after they are build
# check-php-version:
# extends: .abstract_jobs.copy_source
# stage: test
# variables:
# ARG_IMAGE: test-source
# needs:
# - docker_build_source
# script:
# - echo "PHP version shoud be ${PHP_VERSION}."
# - php -r "echo 'PHP version is'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;"
# - php -r "if (version_compare(PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION, '${PHP_VERSION}', '!=')) exit(1);"
# rules:
# - if: $RUN_NO_TESTS == "true"
# when: never
# - if: $CHECK_PHP_VERSION == "never"
# when: never
# - if: $RUN_ALL_TESTS == "true"
# when: on_success
# - if: $CHECK_PHP_VERSION == "true"
# when: on_success
# - when: never
# rules:
# - if: $RUN_NO_TESTS == "true"
# when: never
# - if: $CHECK_PHP_VERSION == "false"
# when: never
# - if: $CHECK_PHP_VERSION == "true"
# - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CHECK_PHP_VERSION_MERGE_REQUEST == "true"
# - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS =~ /test-with-health-check/
# - if: $PIPELINE_TYPE =~ /default-tests/
# - if: $PIPELINE_TYPE =~ /mr-tests/
# - if: $CI_COMMIT_TAG
# allow_failure: true
# timeout: 20m # time run: 4m
# interruptible: true

phpstan-analysis:
stage: test
Expand Down
9 changes: 0 additions & 9 deletions ci/gitlab-ci/test_php_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ php-unit-all-tests-source-matrix:
variables:
NODE_TOTAL: 1
NODE_INDEX: 1
IMAGE_TAG: ${CI_PIPELINE_ID}-${PHP_VERSION}
needs:
- docker_build_source
- 'docker_build_source_matrix: [7.4]'
- 'docker_build_source_matrix: [8.0]'
- 'docker_build_source_matrix: [8.1]'
parallel:
matrix:
- DATABASE_IMAGE:
Expand Down Expand Up @@ -156,8 +150,6 @@ php-unit-servertests-source:
variables:
ARG_IMAGE: test-source
ARG_COPY_SOURCE: "true"
needs:
- docker_build_source
timeout: 2h
interruptible: true
rules:
Expand Down Expand Up @@ -300,7 +292,6 @@ php-unit-nogitlabci-tests-built-parallel:
when: never
- !reference [.php-unit-nogitlabci-tests-built, rules]


php-unit-update-tests:
extends: .abstract_jobs.php_unit
variables:
Expand Down

0 comments on commit ce16031

Please sign in to comment.