Skip to content

Add new job gitlab-pre-main-jh

Baodong请求将feat/pre-main-jh合并到main-jh

Add new job gitlab-pre-main-jh,

  • scheduled trigger
  • on project gitlab-cn/gitlab
  • on branch pre-main-jh
  • merge master and main-jh into pre-main-jh

full configuration: https://jihulab.com/gitlab-cn/code-sync/-/ci/editor?branch_name=feat%2Fpre-main-jh&tab=3

gitlab-pre-main-jh:
  stage: sync
  variables:
    MERGE_FROM: master
    MERGE_INTO: pre-main-jh
    REPOSITORY: https://dummy:${JH_SYNC_TOKEN}@jihulab.com/gitlab-cn/gitlab.git
    USER_EMAIL: project23966655_bot2@example.com
    USER_NAME: JH_SYNC_TOKEN
    MERGE_FROM_JH: main-jh
  rules:
  - if: $CI_COMMIT_REF_NAME == "pre-main-jh" && $CI_PIPELINE_SOURCE == "schedule"
      && $JH_SYNC_SCHEDULE == $CI_JOB_NAME
  - when: manual
    allow_failure: true
  before_script:
  - git clone --filter=tree:0 "${REPOSITORY}" "${CI_JOB_NAME}"
  - cd ${CI_JOB_NAME}
  - git config user.email "${USER_EMAIL}"
  - git config user.name "${USER_NAME}"
  - git checkout "${MERGE_INTO}"
  - |
    if [ "$CI_JOB_NAME" = "gitlab" ] || [ "$CI_JOB_NAME" = "gitlab-pre-main-jh" ]; then
      git config --global merge.ours.driver true
      printf '%s\n%s' 'yarn.lock merge=ours' "$(cat .gitattributes)" > .gitattributes
      printf '%s\n%s' 'package.json merge=ours' "$(cat .gitattributes)" > .gitattributes
    fi
  - git merge "origin/${MERGE_FROM}"
  - |
    if [ "$CI_JOB_NAME" = "gitlab-pre-main-jh" ]; then
      [[ ! -z "$MERGE_FROM_JH" ]] && git merge "origin/${MERGE_FROM_JH}"
    fi
  - |
    if [ "$CI_JOB_NAME" = "gitlab" ] || [ "$CI_JOB_NAME" = "gitlab-pre-main-jh" ]; then
      git checkout "origin/${MERGE_FROM}" .gitattributes
    fi
  script:
  - apt-get update
  - apt-get --assume-yes install jq
  - "./jh/bin/build_packagejson"
  - yarn install
  - git commit -am  "Update package.json and yarn.lock" || true
  - mv ../vendor/ruby vendor/ || true
  - "./jh/bin/merge_checksum"
  - "./jh/bin/adjust_gemfile_lock"
  - ". scripts/utils.sh"
  - bundle_install_script
  - git commit -am "Update jh/Gemfile.lock" || true
  - - git push origin "${MERGE_INTO}"
  - mv vendor ../
  extends:
  - gitlab
  image: registry.gitlab.cn/gitlab-cn/gitlab-build-images/debian-bullseye-ruby-3.0.patched-golang-1.19-rust-1.65-node-16.14-postgresql-13:rubygems-3.4-git-2.36-lfs-2.9-chrome-109-yarn-1.22-graphicsmagick-1.3.36
  cache:
  - key: vendor-ruby-v2
    paths:
    - vendor/ruby
  - key: node-modules
    paths:
    - node_modules
Baodong 编辑于

合并请求报告

加载中