From 621becebdcaa3706bc90d9e70d2971242ed61c39 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 3 Dec 2022 22:25:14 +0100 Subject: [PATCH 1/4] CI/CD Version 1 --- .gitlab-ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..43a69bb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,69 @@ +# avoids unecessary repulling of node modules +cache: + paths: + - page-test/node_modules/ + +stages: + - lint + #- test + - build + - deploy + +variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + IAMGE_LATES: $CI_REGISTRY_IMAGE:latest + + +.node: + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:latest + + +.docker: + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:20 + + +linter: + image: !reference [.node, image] + stage: lint + before_script: + - cd page-test + - yarn install + script: + - yarn lint + + +build: + image: !reference [.docker, image] + stage: build + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH + CACHING: + before_script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + script: + - docker build $CACHING -t $IMAGE_TAG . + after_script: + - docker save $IMAGE_TAG > docker.tar + artifacts: + expire_in: 30 mins + paths: + - docker.tar + only: + - tags + + +push: + image: !reference [.docker, image] + stage: deploy + needs: + - job: build + artifacts: true + before_script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker load -i docker.tar + script: + - docker tag $IMAGE_TAG $IMAGE_LATEST + - docker push $IMAGE_TAG + - docker push $IMAGE_LATEST + only: + - tags From e2a5f6c96ff743949b06ddf6e2c1a9dd4355a0d4 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 3 Dec 2022 22:28:07 +0100 Subject: [PATCH 2/4] Fix 1 for CI/CD script --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43a69bb..ee52e3f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,6 @@ linter: image: !reference [.node, image] stage: lint before_script: - - cd page-test - yarn install script: - yarn lint From 1016c782a85bf88859c2866b6a3c7893d4f8461f Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 3 Dec 2022 22:35:14 +0100 Subject: [PATCH 3/4] Removed unused variables --- .gitlab-ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee52e3f..cbe2e96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ # avoids unecessary repulling of node modules cache: paths: - - page-test/node_modules/ + - node_modules/ stages: - lint @@ -34,13 +34,10 @@ linter: build: image: !reference [.docker, image] stage: build - variables: - IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH - CACHING: before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - - docker build $CACHING -t $IMAGE_TAG . + - docker build -t $IMAGE_TAG . after_script: - docker save $IMAGE_TAG > docker.tar artifacts: From 9682ddd86983ab6f329fee91fce768965d2bd959 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 3 Dec 2022 22:40:21 +0100 Subject: [PATCH 4/4] Syntax Error v2 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbe2e96..9b9f80c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ stages: variables: IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - IAMGE_LATES: $CI_REGISTRY_IMAGE:latest + IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest .node: