Loading .gitlab-ci.yml 0 → 100644 +60 −0 Original line number Diff line number Diff line --- # WORKFLOW workflow: rules: - if: '$CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "api"' - when: never # VARIABLES variables: GIT_PUSH_URL: value: "" description: "1.1) ОБЯЗАТЕЛЬНАЯ ПЕРЕМЕННАЯ: указываем адрес репозитория нашего форка" GIT_PUSH_LOGIN: value: "" description: "1.2) НЕобязательная переменная: указываем логин репозитория нашего форка" GIT_PUSH_PASSWORD: value: "" description: "1.3) НЕобязательная переменная: указываем логин репозитория нашего форка" SSH_PUSH_PRIVATE_KEY: value: "" description: "1.4) НЕобязательная переменная: указываем ssh-ключ репозитория нашего форка вместо пп. 1.2-1.3" GIT_PULL_URL: value: "" description: "2.1) ОБЯЗАТЕЛЬНАЯ ПЕРЕМЕННАЯ: указываем адрес репозитория оригинала" GIT_PULL_LOGIN: value: "" description: "2.2) НЕобязательная переменная: указываем логин репозитория оригинала" GIT_PULL_PASSWORD: value: "" description: "2.3) НЕобязательная переменная: указываем логин репозитория оригинала" SSH_PULL_PRIVATE_KEY: value: "" description: "2.4) НЕобязательная переменная: указываем ssh-ключ репозитория оригинала вместо пп. 2.2-2.3" ########################################################################################################## ## PIPELINE DEFINITION stages: - sync ########################################################################################################## ### SYNC SECTION sync: image: $GIT_IMAGE stage: sync variables: GIT_STRATEGY: "none" before_script: - git config --global credential.helper store && touch ~/.git-credentials - ( test -n "${GIT_PULL_LOGIN}" && test -n "${GIT_PULL_PASSWORD}" ) && echo "https://${GIT_PULL_LOGIN}:${GIT_PULL_PASSWORD}@$(echo ${GIT_PULL_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( test -n "${GIT_PUSH_LOGIN}" && test -n "${GIT_PUSH_PASSWORD}" ) && echo "https://${GIT_PUSH_LOGIN}:${GIT_PUSH_PASSWORD}@$(echo ${GIT_PUSH_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( eval $(ssh-agent -s); echo "$SSH_PULL_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true - ( eval $(ssh-agent -s); echo "$SSH_PUSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true script: - git clone "${GIT_PUSH_URL}" /tmp/repo && cd /tmp/repo - git remote add upstream "${GIT_PULL_URL}" && git fetch upstream - git pull --ff-only upstream "${GIT_UPSTGREAM_BRANCH}" - git push origin gitlab-ci.ymldeleted 100644 → 0 +0 −34 Original line number Diff line number Diff line --- # VARIABLES variables: GIT_DEPTH: 1 ########################################################################################################## ## PIPELINE DEFINITION stages: - sync ########################################################################################################## ### SYNC SECTION sync: image: $GIT_IMAGE stage: sync except: refs: - merge_requests only: refs: - master script: - git config --global credential.helper store && touch ~/.git-credentials - echo "${CI_SERVER_PROTOCOL}://${GIT_PUSH_LOGIN}:${GIT_PUSH_PASSWORD}@${CI_SERVER_HOST}" >> ~/.git-credentials || true - ( test -n "${GIT_LOGIN}" && test -n "${GIT_PASSWORD}" ) && echo "https://${GIT_LOGIN}:${GIT_PASSWORD}@$(echo ${GIT_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( eval $(ssh-agent -s); echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true - git checkout --track origin/master && git pull --ff-only - git remote add upstream "${GIT_URL}" && git fetch upstream - git pull --ff-only upstream "${GIT_UPSTGREAM_BRANCH}" - echo -e "machine ${CI_SERVER_HOST}\nlogin ${GIT_PUSH_LOGIN}\npassword ${GIT_PUSH_PASSWORD}" > ~/.netrc - git push Loading
.gitlab-ci.yml 0 → 100644 +60 −0 Original line number Diff line number Diff line --- # WORKFLOW workflow: rules: - if: '$CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "api"' - when: never # VARIABLES variables: GIT_PUSH_URL: value: "" description: "1.1) ОБЯЗАТЕЛЬНАЯ ПЕРЕМЕННАЯ: указываем адрес репозитория нашего форка" GIT_PUSH_LOGIN: value: "" description: "1.2) НЕобязательная переменная: указываем логин репозитория нашего форка" GIT_PUSH_PASSWORD: value: "" description: "1.3) НЕобязательная переменная: указываем логин репозитория нашего форка" SSH_PUSH_PRIVATE_KEY: value: "" description: "1.4) НЕобязательная переменная: указываем ssh-ключ репозитория нашего форка вместо пп. 1.2-1.3" GIT_PULL_URL: value: "" description: "2.1) ОБЯЗАТЕЛЬНАЯ ПЕРЕМЕННАЯ: указываем адрес репозитория оригинала" GIT_PULL_LOGIN: value: "" description: "2.2) НЕобязательная переменная: указываем логин репозитория оригинала" GIT_PULL_PASSWORD: value: "" description: "2.3) НЕобязательная переменная: указываем логин репозитория оригинала" SSH_PULL_PRIVATE_KEY: value: "" description: "2.4) НЕобязательная переменная: указываем ssh-ключ репозитория оригинала вместо пп. 2.2-2.3" ########################################################################################################## ## PIPELINE DEFINITION stages: - sync ########################################################################################################## ### SYNC SECTION sync: image: $GIT_IMAGE stage: sync variables: GIT_STRATEGY: "none" before_script: - git config --global credential.helper store && touch ~/.git-credentials - ( test -n "${GIT_PULL_LOGIN}" && test -n "${GIT_PULL_PASSWORD}" ) && echo "https://${GIT_PULL_LOGIN}:${GIT_PULL_PASSWORD}@$(echo ${GIT_PULL_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( test -n "${GIT_PUSH_LOGIN}" && test -n "${GIT_PUSH_PASSWORD}" ) && echo "https://${GIT_PUSH_LOGIN}:${GIT_PUSH_PASSWORD}@$(echo ${GIT_PUSH_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( eval $(ssh-agent -s); echo "$SSH_PULL_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true - ( eval $(ssh-agent -s); echo "$SSH_PUSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true script: - git clone "${GIT_PUSH_URL}" /tmp/repo && cd /tmp/repo - git remote add upstream "${GIT_PULL_URL}" && git fetch upstream - git pull --ff-only upstream "${GIT_UPSTGREAM_BRANCH}" - git push origin
gitlab-ci.ymldeleted 100644 → 0 +0 −34 Original line number Diff line number Diff line --- # VARIABLES variables: GIT_DEPTH: 1 ########################################################################################################## ## PIPELINE DEFINITION stages: - sync ########################################################################################################## ### SYNC SECTION sync: image: $GIT_IMAGE stage: sync except: refs: - merge_requests only: refs: - master script: - git config --global credential.helper store && touch ~/.git-credentials - echo "${CI_SERVER_PROTOCOL}://${GIT_PUSH_LOGIN}:${GIT_PUSH_PASSWORD}@${CI_SERVER_HOST}" >> ~/.git-credentials || true - ( test -n "${GIT_LOGIN}" && test -n "${GIT_PASSWORD}" ) && echo "https://${GIT_LOGIN}:${GIT_PASSWORD}@$(echo ${GIT_URL} | sed -r 's#([^/])/[^/].*#\1#' | sed -e 's|https://||g')" >> ~/.git-credentials || true - ( eval $(ssh-agent -s); echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null && mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config ) || true - git checkout --track origin/master && git pull --ff-only - git remote add upstream "${GIT_URL}" && git fetch upstream - git pull --ff-only upstream "${GIT_UPSTGREAM_BRANCH}" - echo -e "machine ${CI_SERVER_HOST}\nlogin ${GIT_PUSH_LOGIN}\npassword ${GIT_PUSH_PASSWORD}" > ~/.netrc - git push