debian-mirror-gitlab/.gitlab/ci/as-if-jh.gitlab-ci.yml

64 lines
1.9 KiB
YAML
Raw Normal View History

2023-01-13 00:05:48 +05:30
.shared-as-if-jh:
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:
extends:
- .shared-as-if-jh
- .as-if-jh:rules:prepare-as-if-jh
2023-04-23 21:23:45 +05:30
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
2023-01-13 00:05:48 +05:30
stage: prepare
before_script:
- source ./scripts/utils.sh
- source ./scripts/setup/as-if-jh.sh
- install_gitlab_gem
script:
- prepare_jh_branch
- download_jh_path ${JH_FILES_TO_COMMIT}
- echoinfo "Changes after downloading JiHu files:"
- git diff
- git status
artifacts:
expire_in: 2d
paths:
# This should match JH_FILES_TO_COMMIT
- jh/
- package.json
- yarn.lock
prepare-as-if-jh-branch:
extends:
- .shared-as-if-jh
- .as-if-jh:rules:prepare-as-if-jh
stage: prepare
needs:
- add-jh-files
script:
2023-04-23 21:23:45 +05:30
# Fetch for the history of the branch so it does not cause the following error:
# ! [remote rejected] ref -> ref (shallow update not allowed)
- git fetch --unshallow --filter=tree:0 origin "${CI_COMMIT_SHA}"
2023-01-13 00:05:48 +05:30
- git checkout -b "${AS_IF_JH_BRANCH}"
- 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}"
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"]
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
strategy: depend