From 3c24eec3a4f1dd338f13c9c4f2fbbdf44657797a Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:01:43 +0000 Subject: [PATCH 01/12] Update file .gitlab-ci.yml --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2707ad..28b0b4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,35 @@ -Update site: - stage: deploy - environment: production +image: node:latest + +stages: + - prepare + - build + - deploy + +before_script: + - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' + +"Установка зависимостей": + stage: prepare script: - - bash /home/gitlab-runner/deploy + - npm install + rules: + - if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"' + +cache: + paths: + - node_modules/ + +"Сборка проекта": + stage: build + script: + - npm install gulp + - npm run build rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH \ No newline at end of file + - if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"' + +"Деплой на продакшене": + stage: deploy + only: + - master + script: + - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From 0bad3b04ac8c64405b009c7f21068b22f14a7255 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:03:40 +0000 Subject: [PATCH 02/12] Update file .gitlab-ci.yml --- .gitlab-ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28b0b4a..28c5666 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,11 @@ before_script: stage: prepare script: - npm install + only: + - master rules: - - if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_TAG' + - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' cache: paths: @@ -24,12 +27,19 @@ cache: script: - npm install gulp - npm run build + only: + - master rules: - - if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_TAG' + - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' + "Деплой на продакшене": stage: deploy only: - master + rules: + - if: '$CI_COMMIT_TAG' + - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' script: - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From 999d57454c367d3fadc7f87a28ea151a6aaf4178 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:04:32 +0000 Subject: [PATCH 03/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28c5666..64d55a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,6 @@ before_script: stage: prepare script: - npm install - only: - - master rules: - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' @@ -27,8 +25,6 @@ cache: script: - npm install gulp - npm run build - only: - - master rules: - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' @@ -36,8 +32,6 @@ cache: "Деплой на продакшене": stage: deploy - only: - - master rules: - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' -- GitLab From 87c7e2d3d7e0ff6988fadd185674f66e66fd4023 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:17:12 +0000 Subject: [PATCH 04/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64d55a3..4f41c8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,9 +5,6 @@ stages: - build - deploy -before_script: - - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' - "Установка зависимостей": stage: prepare script: @@ -35,5 +32,7 @@ cache: rules: - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' + before_script: + - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From 17ea9ab4f43119590d17bd6db2995c119c7881b1 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:45:45 +0000 Subject: [PATCH 05/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f41c8e..8b626b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,4 +35,5 @@ cache: before_script: - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file + - lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER + # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From e0e49a465e3999838b4327784b6a009e394e73cc Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 14:54:13 +0000 Subject: [PATCH 06/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b626b5..2e27f5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: node:latest +image: node:18 stages: - prepare -- GitLab From 251661a4da86dac1c20280f623c6392d1daa45cc Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 15:17:00 +0000 Subject: [PATCH 07/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2e27f5c..df72572 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,5 +35,6 @@ cache: before_script: - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - - lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER + - lftp -e "open antifreezefelix.ru; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" + #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From 6eb28131194c7d34a5ab7971bccf155f6cbe21ec Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 15:19:22 +0000 Subject: [PATCH 08/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index df72572..fa8628b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,43 @@ -image: node:18 +# image: node:18 + +# stages: +# - prepare +# - build +# - deploy + +# "Установка зависимостей": +# stage: prepare +# script: +# - npm install +# rules: +# - if: '$CI_COMMIT_TAG' +# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' + +# cache: +# paths: +# - node_modules/ + +# "Сборка проекта": +# stage: build +# script: +# - npm install gulp +# - npm run build +# rules: +# - if: '$CI_COMMIT_TAG' +# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' + + +# "Деплой на продакшене": +# stage: deploy +# rules: +# - if: '$CI_COMMIT_TAG' +# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' +# before_script: +# - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' +# script: +# - lftp -e "open antifreezefelix.ru; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" +# #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER +# # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" stages: - prepare @@ -6,6 +45,7 @@ stages: - deploy "Установка зависимостей": + image: node:18 stage: prepare script: - npm install @@ -18,16 +58,17 @@ cache: - node_modules/ "Сборка проекта": + image: node:18 stage: build - script: - - npm install gulp - - npm run build + before_script: npm install gulp + script: npm run build rules: - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' "Деплой на продакшене": + image: ubuntu:20.04 stage: deploy rules: - if: '$CI_COMMIT_TAG' @@ -35,6 +76,6 @@ cache: before_script: - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - - lftp -e "open antifreezefelix.ru; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" + - lftp -e "open $PROD_FTP_SERVER; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From 171b93d6f2537d90848bf61e6b139ad05f2c47b4 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 15:31:46 +0000 Subject: [PATCH 09/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa8628b..de85d81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,6 +76,6 @@ cache: before_script: - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - - lftp -e "open $PROD_FTP_SERVER; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" + #- lftp -e "open $PROD_FTP_SERVER; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER - # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file + - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror -X .* -X .*/ --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file -- GitLab From d46abeb7e9f2f0904c6a9e760d166bf1f9804361 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 15:41:48 +0000 Subject: [PATCH 10/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de85d81..526c7ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,4 +78,4 @@ cache: script: #- lftp -e "open $PROD_FTP_SERVER; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER - - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror -X .* -X .*/ --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" \ No newline at end of file + - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e "set ftp:ssl-allow no; mirror -X .* -X .*/ --reverse --delete --verbose ./app /; quit" \ No newline at end of file -- GitLab From 22ecdd1d3ca003a3a3d78c906394019628b1e608 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 16:03:14 +0000 Subject: [PATCH 11/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 526c7ca..37f4d39 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,44 +1,3 @@ -# image: node:18 - -# stages: -# - prepare -# - build -# - deploy - -# "Установка зависимостей": -# stage: prepare -# script: -# - npm install -# rules: -# - if: '$CI_COMMIT_TAG' -# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' - -# cache: -# paths: -# - node_modules/ - -# "Сборка проекта": -# stage: build -# script: -# - npm install gulp -# - npm run build -# rules: -# - if: '$CI_COMMIT_TAG' -# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' - - -# "Деплой на продакшене": -# stage: deploy -# rules: -# - if: '$CI_COMMIT_TAG' -# - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' -# before_script: -# - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' -# script: -# - lftp -e "open antifreezefelix.ru; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" -# #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER -# # - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e \ "set ftp:ssl-allow no; mirror --continue --reverse --delete --verbose --exclude=^\.git/$ ./app /; quit" - stages: - prepare - build @@ -68,7 +27,6 @@ cache: "Деплой на продакшене": - image: ubuntu:20.04 stage: deploy rules: - if: '$CI_COMMIT_TAG' -- GitLab From 2181bcbfcf838b1d3e6eaf2e3fac3fbc2c13a957 Mon Sep 17 00:00:00 2001 From: Paul Khlopkov Date: Mon, 1 Apr 2024 16:54:57 +0000 Subject: [PATCH 12/12] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37f4d39..f55d04f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,14 +3,15 @@ stages: - build - deploy +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "master"' + "Установка зависимостей": image: node:18 stage: prepare script: - npm install - rules: - - if: '$CI_COMMIT_TAG' - - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' cache: paths: @@ -21,19 +22,11 @@ cache: stage: build before_script: npm install gulp script: npm run build - rules: - - if: '$CI_COMMIT_TAG' - - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' - "Деплой на продакшене": stage: deploy rules: - - if: '$CI_COMMIT_TAG' - - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\-release/' before_script: - 'which lftp || ( apt-get update -y && apt-get install lftp -y )' script: - #- lftp -e "open $PROD_FTP_SERVER; user $PROD_FTP_USER $PROD_FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete app/ /; bye" - #- lftp -e "mirror -R ./app /" -u $PROD_FTP_USER,$PROD_FTP_PASSWORD $PROD_FTP_SERVER - lftp ftp://$PROD_FTP_USER:$PROD_FTP_PASSWORD@$PROD_FTP_SERVER -e "set ftp:ssl-allow no; mirror -X .* -X .*/ --reverse --delete --verbose ./app /; quit" \ No newline at end of file -- GitLab