diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ef9a4564ec27fb2a13392f92b0cfd5810ebd258..e20d934cd3fafb62b2f61915228d1e49aafe913a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ include: - /includes/cache.yml - - /includes/before-script-yarn.yml + - /includes/before-script-js-pm.yml - /includes/rules.yml - /includes/docker-build.yml - /semantic-release-for-gitlab-ci-includes.yml @@ -51,8 +51,11 @@ replacePipelineImageTag: - git push "https://release-bot:${GL_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_REF_NAME}" test: - extends: - - .before-script-yarn + extends: .cache-node-modules + before_script: + - cd $APP_PATH + - if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi + - yarn install --frozen-lockfile script: - yarn test stage: test diff --git a/dockerfiles/pipeline/scripts/yarn-or-npm b/dockerfiles/pipeline/scripts/yarn-or-npm new file mode 100755 index 0000000000000000000000000000000000000000..3f6e2ec394d6228a6d916647528d648ea100b676 --- /dev/null +++ b/dockerfiles/pipeline/scripts/yarn-or-npm @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ -f package-lock.json ] && [ ! -f yarn.lock ]; then + if [ "$1" == "install" ] && [ "$2" == "--frozen-lockfile" ]; then + npm ci + else + npm "$@" + fi +else + yarn "$@" +fi diff --git a/helm-chart.yml b/helm-chart.yml index b6d8bed0b4fd9f79ef725c04672b2ddcea5814c0..1448e02f5e0f729a9005bed484c927bdc2177afe 100644 --- a/helm-chart.yml +++ b/helm-chart.yml @@ -11,7 +11,7 @@ image: variables: HELM_EXPERIMENTAL_OCI: 1 AUTO_RELEASE: "true" - PIPELINE_IMAGE_TAG: 812040b1983bed9cf302a3d37a4cef2f9f736c1e + PIPELINE_IMAGE_TAG: b631bd90d9642cc779779c8e0438ad78731f9905 stages: - lint diff --git a/includes/before-script-yarn.yml b/includes/before-script-js-pm.yml similarity index 69% rename from includes/before-script-yarn.yml rename to includes/before-script-js-pm.yml index fb444094d17b54f1167226ba728d24985709d6a1..2879dd3bfeb36ad5c0a863ba40c62160768c0adb 100644 --- a/includes/before-script-yarn.yml +++ b/includes/before-script-js-pm.yml @@ -1,6 +1,6 @@ -.before-script-yarn: +.before-script-js-pm: extends: .cache-node-modules before_script: - cd $APP_PATH - if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi - - yarn install --frozen-lockfile + - yarn-or-npm install --frozen-lockfile diff --git a/includes/docker-build.yml b/includes/docker-build.yml index efee71f64d122152588931351366fff9075b090d..7146019f898852807c08f4f8681d9cbb196076f2 100644 --- a/includes/docker-build.yml +++ b/includes/docker-build.yml @@ -72,7 +72,7 @@ variables: .storybook-build: extends: - .rules-stoybook - - .before-script-yarn + - .before-script-js-pm stage: build needs: ["setup-build-info"] diff --git a/monorepo.yml b/monorepo.yml index f4c0c2ba5a53de7eaf8166eea2de1db65068ad1b..918626b0005f7338e5b59b2f762e7b08c9816074 100644 --- a/monorepo.yml +++ b/monorepo.yml @@ -1,5 +1,5 @@ include: - - /includes/before-script-yarn.yml + - /includes/before-script-js-pm.yml - /includes/env.yml - /includes/retry.yml - /includes/cache.yml @@ -12,7 +12,7 @@ include: - /includes/open-mr.yml variables: - PIPELINE_IMAGE_TAG: 812040b1983bed9cf302a3d37a4cef2f9f736c1e + PIPELINE_IMAGE_TAG: b631bd90d9642cc779779c8e0438ad78731f9905 image: git.panter.ch:5001/catladder/gitlab-ci/pipeline:$PIPELINE_IMAGE_TAG diff --git a/node-kubernetes.yml b/node-kubernetes.yml index 73848ee4115c3bf4a91ff805b69bc8b5bec110c0..f95610ba4dd763b0cab18307afd6c6df59187586 100644 --- a/node-kubernetes.yml +++ b/node-kubernetes.yml @@ -13,11 +13,11 @@ docker-build: stage: test extends: - - .before-script-yarn + - .before-script-js-pm - .test-base script: - - yarn test + - yarn-or-npm test test: extends: .test-node @@ -26,11 +26,11 @@ test: stage: test extends: - - .before-script-yarn + - .before-script-js-pm - .audit-base script: - - yarn audit + - yarn-or-npm audit audit: extends: .audit-node @@ -38,11 +38,11 @@ audit: .lint-node: stage: test extends: - - .before-script-yarn + - .before-script-js-pm - .lint-base script: - - yarn lint + - yarn-or-npm lint needs: [] lint: @@ -50,11 +50,11 @@ lint: .app-build-node: extends: - - .before-script-yarn + - .before-script-js-pm - .app-build-base - .cache-app-build-node-next script: - - yarn build + - yarn-or-npm build artifacts: paths: @@ -71,7 +71,7 @@ app-build: extends: - .cache-verify-cypress script: - - !reference [.before-script-yarn, before_script] + - !reference [.before-script-js-pm, before_script] - yarn cypress install - CYPRESS_BASE_URL=$CI_ENVIRONMENT_URL yarn cypress:run --browser chrome --headless --record --key $CYPRESS_KEY artifacts: diff --git a/panter-kubernetes-base.yml b/panter-kubernetes-base.yml index e5b9f37133499559fe38a439936ab28fdcbf0ce9..9132e62432ce7a68404e84cf96722e5a549b9090 100644 --- a/panter-kubernetes-base.yml +++ b/panter-kubernetes-base.yml @@ -12,7 +12,7 @@ include: - /includes/open-mr.yml variables: - PIPELINE_IMAGE_TAG: 812040b1983bed9cf302a3d37a4cef2f9f736c1e + PIPELINE_IMAGE_TAG: b631bd90d9642cc779779c8e0438ad78731f9905 CUSTOMER_NAME: panter APP_NAME: demo COMPONENT_NAME: web