diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-21 15:21:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-21 15:21:08 +0300 |
commit | e7198b914bf1d6594909e35d3d00d0a0b260f250 (patch) | |
tree | 6fe636fedeae9c679839d5bf27dc091af037e765 /.gitlab/ci | |
parent | 3b80f22aba42e3e424de5c3dd15cc11f96aaac65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to '.gitlab/ci')
-rw-r--r-- | .gitlab/ci/as-if-jh.gitlab-ci.yml | 57 | ||||
-rw-r--r-- | .gitlab/ci/rules.gitlab-ci.yml | 27 |
2 files changed, 73 insertions, 11 deletions
diff --git a/.gitlab/ci/as-if-jh.gitlab-ci.yml b/.gitlab/ci/as-if-jh.gitlab-ci.yml index 2c90112bbf2..ae589ddfc2c 100644 --- a/.gitlab/ci/as-if-jh.gitlab-ci.yml +++ b/.gitlab/ci/as-if-jh.gitlab-ci.yml @@ -1,9 +1,13 @@ +.as-if-jh-sandbox-variables: + variables: + AS_IF_JH_BRANCH: "as-if-jh/${CI_COMMIT_REF_NAME}" + SANDBOX_REPOSITORY: "https://dummy:${AS_IF_JH_TOKEN}@gitlab.com/gitlab-org-sandbox/gitlab-jh-validation.git" + .shared-as-if-jh: + extends: + - .as-if-jh-sandbox-variables variables: - SANDBOX_PROJECT: "gitlab-org-sandbox/gitlab-jh-validation" - SANDBOX_REPOSITORY: "https://dummy:${AS_IF_JH_TOKEN}@gitlab.com/${SANDBOX_PROJECT}.git" GITLAB_JH_MIRROR_PROJECT: "33019816" - AS_IF_JH_BRANCH: "as-if-jh/${CI_COMMIT_REF_NAME}" JH_FILES_TO_COMMIT: "jh package.json yarn.lock" add-jh-files: @@ -42,30 +46,61 @@ prepare-as-if-jh-branch: # so instead we tell runner to not clone anything, and we set up the # repository by ourselves. GIT_STRATEGY: "none" - script: - - git clone --filter=tree:0 "$CI_REPOSITORY_URL" gitlab + before_script: + - git clone --filter=tree:0 "${CI_REPOSITORY_URL}" gitlab # We should checkout before moving/changing files - cd gitlab - git checkout -b "${AS_IF_JH_BRANCH}" "${CI_COMMIT_SHA}" - cd .. - - mv $JH_FILES_TO_COMMIT gitlab/ + - mv ${JH_FILES_TO_COMMIT} gitlab/ + script: - cd gitlab - git add ${JH_FILES_TO_COMMIT} - git commit -m 'Add JH files' # TODO: Mark which SHA we add - git push -f "${SANDBOX_REPOSITORY}" "${AS_IF_JH_BRANCH}" +sync-as-if-jh-branch: + extends: + - .as-if-jh-sandbox-variables + - .as-if-jh:rules:sync-as-if-jh + stage: prepare + needs: ["prepare-as-if-jh-branch"] + inherit: + variables: + # From .gitlab-ci.yml for the default Docker image and cache + - DEFAULT_CI_IMAGE + - REGISTRY_HOST + - REGISTRY_GROUP + - DEBIAN_VERSION + - RUBY_VERSION + - GO_VERSION + - RUST_VERSION + - PG_VERSION + - RUBYGEMS_VERSION + - CHROME_VERSION + - NODE_ENV + variables: + MERGE_FROM: "${CI_COMMIT_SHA}" # This is used in https://jihulab.com/gitlab-cn/gitlab/-/blob/e98bcb37aea4cfe1e78e1daef1b58b5f732cf289/jh/bin/build_packagejson where we run in https://gitlab.com/gitlab-org-sandbox/gitlab-jh-validation + trigger: + # What this runs can be found at: + # https://gitlab.com/gitlab-org-sandbox/gitlab-jh-validation/-/blob/as-if-jh-code-sync/jh/.gitlab-ci.yml + project: gitlab-org-sandbox/gitlab-jh-validation + branch: as-if-jh-code-sync + strategy: depend + start-as-if-jh: extends: - - .shared-as-if-jh - .as-if-jh:rules:start-as-if-jh stage: prepare - needs: ["prepare-as-if-jh-branch"] + needs: + - job: "prepare-as-if-jh-branch" + - job: "sync-as-if-jh-branch" + optional: true inherit: variables: false variables: - AS_IF_EDITION: "jh" FORCE_GITLAB_CI: "true" # TODO: Trigger a merge request pipeline trigger: - project: gitlab-org-sandbox/gitlab-jh-validation # ${SANDBOX_PROJECT} does not work here - branch: as-if-jh/${CI_COMMIT_REF_NAME} # ${AS_IF_JH_BRANCH} does not work here + project: gitlab-org-sandbox/gitlab-jh-validation + branch: as-if-jh/${CI_COMMIT_REF_NAME} strategy: depend diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 13189f88124..d10803f025a 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -2392,6 +2392,33 @@ changes: *feature-flag-development-config-patterns # This rule should share the same logic with .as-if-jh:rules:prepare-as-if-jh +# in additionally that there are changes in dependency-patterns +# Unfortunately, we can't say it has changes in +# feature-flag-development-config-patterns +# And in +# dependency-patterns +# At the same time. Note that this can't be using OR so using a union pattern +# doesn't work either. Given that we cannot specify this, there's a gap can +# happen when: +# * The merge request does not have ~"pipeline:run-as-if-jh" +# * The merge request changes a feature flag +# * The merge request also changes dependencies +# In this case, we expect that we do run `sync-as-if-jh-branch` but it won't, +# meaning that dependencies in the JH validation pipeline will be outdated. +# To work around this issue, apply ~"pipeline:run-as-if-jh" to the merge +# request so we can force it to run `sync-as-if-jh-branch` when there are +# dependencies changes. +.as-if-jh:rules:sync-as-if-jh: + rules: + - !reference [".strict-ee-only-rules", rules] + - !reference [".as-if-jh-default-exclusion-rules", rules] + - <<: *if-merge-request-labels-as-if-jh + changes: *dependency-patterns + # Ideally, we should be able to do this: + # - <<: *if-dot-com-gitlab-org-merge-request + # changes: *feature-flag-development-config-patterns && *dependency-patterns + +# This rule should share the same logic with .as-if-jh:rules:prepare-as-if-jh # Because the jobs using this need jobs using the preparation rules .as-if-jh:rules:start-as-if-jh: rules: |