This commit is contained in:
Бурденко Алексей
2025-06-24 14:44:18 +03:00
parent b97ea8c667
commit c37a779ab6
+36 -5
View File
@@ -1,3 +1,27 @@
# echo -e # ключ -e в комманде echo включает отображение "backslash escapes"; например \n - переход на следующую строку, \t -табуляция
# echo -n # ключ -n в команде echo сигнализирует, что после вывода информации не нужно переходить на следующую строку.
# - > переносы строк удаляются
# - | переносы строк не удаляются
# Git add
# - git submodule add -b main https://gitlab-ci-token:${CI_JOB_TOKEN}@$CI_SERVER_URL/products/vega/infra
# - git submodule sync --recursive
# - git submodule update --init --recursive
# # Прокидываем name + email, чтобы gitlab не сыпал ошибки
# - git config --global user.name "YourName"
# - git config --global user.email "YourEmail"
# # Вызываем наш скрипт, который инкрементирует версию
# - node bumpVersion.js
# # Добавляем и пушим наши изменения в ветку откуда стригерился pipeline
# - git add ./package.json
# - git commit -m "bump package.json version"
# # Используем опцию gitlab -o ci.skip, для того, чтобы наш коммит не тригерил новый pipeline
# - git push origin HEAD:$CI_COMMIT_REF_NAME -o ci.skip
.deploy-template: .deploy-template:
image: harbor.vimpelcom.ru/dockerhub/library/alpine image: harbor.vimpelcom.ru/dockerhub/library/alpine
before_script: before_script:
@@ -8,8 +32,7 @@
- which ssh-agent || (apt-get update -y && apt-get install openssh-client -y) - which ssh-agent || (apt-get update -y && apt-get install openssh-client -y)
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- pwd - echo -n "$TECH_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- echo -n "$TECH_SSH_KEY" | base64 -d > ~/.ssh/id_rsa
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- chmod 600 ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa
# https://mikefarah.gitbook.io/yq/operators/traverse-read#nested-special-characters # https://mikefarah.gitbook.io/yq/operators/traverse-read#nested-special-characters
@@ -26,10 +49,16 @@
echo "stand: ${stand}" echo "stand: ${stand}"
ssh-keyscan "${stand}" >> ~/.ssh/known_hosts ssh-keyscan "${stand}" >> ~/.ssh/known_hosts
done done
# - chmod 644 ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts
- chmod -R 400 ~/.ssh # Если получилось что-то пустое
- >
if [[ -z "$APPVERSION" ]]; then
APPVERSION="0.0.1"
fi
script: script:
- pwd - mkdir -p ${CI_PROJECT_DIR}/utils/
- cd ${CI_PROJECT_DIR}/utils/
# - wget -q --no-check-certificate --output-document "deploy.sh" --header "PRIVATE-TOKEN:${GITLAB_TOKEN}" "https://git.vimpelcom.ru/api/v4/projects/9556/repository/files/ci%2Fdeploy%2Fdeploy.sh/raw"
- > - >
for stand in $STANDS; do for stand in $STANDS; do
echo -e "Connect to ${stand}..." && echo -e "Connect to ${stand}..." &&
@@ -41,3 +70,5 @@
needs: needs:
- job: build-image-npm - job: build-image-npm
optional: true optional: true
- job: build-image-go
optional: true