2021-08-06 15:36:59 +00:00
|
|
|
stages:
|
|
|
|
- build_and_test
|
|
|
|
- package
|
2021-12-08 09:41:02 +00:00
|
|
|
#- security
|
2021-08-06 15:36:59 +00:00
|
|
|
- upload
|
|
|
|
- image
|
2021-12-01 12:12:45 +00:00
|
|
|
- integrationtest
|
2021-08-06 15:36:59 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
- docker:19.03.12-dind
|
|
|
|
|
2021-12-01 16:21:26 +00:00
|
|
|
.only-master: &only-master
|
|
|
|
rules:
|
2021-12-01 16:26:03 +00:00
|
|
|
- if: '$CI_COMMIT_REF_NAME == "master"'
|
|
|
|
when: always
|
2021-12-01 16:21:26 +00:00
|
|
|
- when: never
|
|
|
|
|
2021-08-06 15:36:59 +00:00
|
|
|
.cljs-job: &cljs
|
|
|
|
image: domaindrivenarchitecture/shadow-cljs
|
|
|
|
cache:
|
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
- .shadow-cljs/
|
|
|
|
- .m2
|
|
|
|
before_script:
|
|
|
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
|
|
- npm install
|
|
|
|
|
|
|
|
.clj-uploadjob: &clj
|
|
|
|
image: domaindrivenarchitecture/lein
|
|
|
|
cache:
|
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
|
|
paths:
|
|
|
|
- .m2
|
|
|
|
before_script:
|
|
|
|
- mkdir -p /root/.lein
|
|
|
|
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj
|
|
|
|
|
|
|
|
test-cljs:
|
|
|
|
<<: *cljs
|
2021-12-01 16:10:38 +00:00
|
|
|
<<: *only-master
|
2021-08-06 15:36:59 +00:00
|
|
|
stage: build_and_test
|
|
|
|
script:
|
|
|
|
- shadow-cljs compile test
|
|
|
|
|
|
|
|
test-clj:
|
|
|
|
<<: *clj
|
2021-12-01 16:10:38 +00:00
|
|
|
<<: *only-master
|
2021-08-06 15:36:59 +00:00
|
|
|
stage: build_and_test
|
|
|
|
script:
|
|
|
|
- lein test
|
|
|
|
|
|
|
|
test-schema:
|
|
|
|
<<: *clj
|
2021-12-01 16:10:38 +00:00
|
|
|
<<: *only-master
|
2021-08-06 15:36:59 +00:00
|
|
|
stage: build_and_test
|
|
|
|
script:
|
|
|
|
- lein uberjar
|
2021-10-27 13:50:20 +00:00
|
|
|
- java -jar target/uberjar/c4k-nextcloud-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip "Certificate,CronJob" -
|
2021-08-06 15:36:59 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/uberjar
|
|
|
|
|
|
|
|
.report-frontend:
|
|
|
|
<<: *cljs
|
|
|
|
stage: package
|
|
|
|
script:
|
|
|
|
- mkdir -p target/frontend-build
|
|
|
|
- shadow-cljs run shadow.cljs.build-report frontend target/frontend-build/build-report.html
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/frontend-build/build-report.html
|
|
|
|
|
|
|
|
.package-frontend:
|
|
|
|
<<: *cljs
|
|
|
|
stage: package
|
|
|
|
script:
|
|
|
|
- mkdir -p target/frontend-build
|
|
|
|
- shadow-cljs release frontend
|
2021-08-10 12:34:17 +00:00
|
|
|
- cp public/js/main.js target/frontend-build/c4k-nextcloud.js
|
|
|
|
- sha256sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha256
|
|
|
|
- sha512sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha512
|
2021-08-06 15:36:59 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/frontend-build
|
|
|
|
|
|
|
|
package-uberjar:
|
|
|
|
<<: *clj
|
2021-12-01 16:10:38 +00:00
|
|
|
<<: *only-master
|
2021-08-06 15:36:59 +00:00
|
|
|
stage: package
|
|
|
|
script:
|
2021-08-10 12:34:17 +00:00
|
|
|
- sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256
|
|
|
|
- sha512sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha512
|
2021-08-06 15:36:59 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/uberjar
|
|
|
|
|
2021-12-08 09:45:06 +00:00
|
|
|
#.sast:
|
|
|
|
# <<: *only-master
|
|
|
|
# variables:
|
|
|
|
# SAST_EXCLUDED_ANALYZERS:
|
|
|
|
# bandit, brakeman, flawfinder, gosec, kubesec, phpcs-security-audit,
|
|
|
|
# pmd-apex, security-code-scan, sobelow, spotbugs
|
|
|
|
# stage: security
|
|
|
|
# before_script:
|
|
|
|
# - mkdir -p builds && cp -r target/ builds/
|
|
|
|
#include:
|
|
|
|
# - template: Security/SAST.gitlab-ci.yml
|
2021-08-06 15:36:59 +00:00
|
|
|
|
|
|
|
upload-clj-prerelease:
|
|
|
|
<<: *clj
|
|
|
|
stage: upload
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
|
|
|
|
script:
|
|
|
|
- lein deploy clojars
|
|
|
|
|
|
|
|
release:
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
stage: upload
|
|
|
|
rules:
|
2021-12-01 16:10:38 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
|
2021-08-06 15:36:59 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/uberjar
|
|
|
|
- target/frontend-build
|
|
|
|
script:
|
|
|
|
- apk --no-cache add curl
|
|
|
|
- |
|
|
|
|
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
2021-08-10 12:34:17 +00:00
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar\"}" \
|
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha256\"}" \
|
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha512\"}" \
|
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js\"}" \
|
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha256\"}" \
|
|
|
|
--assets-link "{\"name\":\"c4k-nextcloud.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha512\"}" \
|
2021-08-06 15:36:59 +00:00
|
|
|
|
2021-08-10 12:34:17 +00:00
|
|
|
nextcloud-image-test-publish:
|
2021-08-06 15:36:59 +00:00
|
|
|
image: domaindrivenarchitecture/devops-build:latest
|
|
|
|
stage: image
|
|
|
|
rules:
|
2021-12-01 16:10:38 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != null'
|
2021-08-06 15:36:59 +00:00
|
|
|
script:
|
2021-08-10 12:34:17 +00:00
|
|
|
- cd infrastructure/docker-nextcloud && pyb image test publish
|
2021-08-06 15:36:59 +00:00
|
|
|
|
|
|
|
backup-image-test-publish:
|
|
|
|
image: domaindrivenarchitecture/devops-build:latest
|
|
|
|
stage: image
|
|
|
|
rules:
|
2021-12-01 16:10:38 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != null'
|
2021-08-06 15:36:59 +00:00
|
|
|
script:
|
2021-12-01 12:12:45 +00:00
|
|
|
- cd infrastructure/docker-backup && pyb image test publish
|
|
|
|
|
|
|
|
nextcloud-integrationtest:
|
2021-12-09 14:35:05 +00:00
|
|
|
stage: integrationtest
|
2021-12-01 16:10:38 +00:00
|
|
|
rules:
|
2021-12-08 09:20:22 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "integration-test-w-o-db-backup"'
|
2021-12-09 13:26:13 +00:00
|
|
|
image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/3.7.1-kube-1.20.11-alpine-3.14
|
2021-12-01 12:12:45 +00:00
|
|
|
services:
|
2021-12-09 13:26:13 +00:00
|
|
|
- name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.22.2-k3s2
|
|
|
|
alias: k3s
|
2021-12-01 12:12:45 +00:00
|
|
|
script:
|
2021-12-09 13:26:13 +00:00
|
|
|
- apk add curl sudo bash
|
|
|
|
- apk add wget curl bash sudo openjdk8
|
|
|
|
- wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
|
|
|
|
- apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen
|
|
|
|
|
2021-12-15 11:23:14 +00:00
|
|
|
- curl -f k3s:8081 > ${HOME}/.kube/config
|
2021-12-09 13:26:13 +00:00
|
|
|
- kubectl version
|
|
|
|
- kubectl cluster-info
|
2021-12-01 12:12:45 +00:00
|
|
|
- echo "---------- Integration test -------------"
|
2021-12-09 13:02:52 +00:00
|
|
|
- pwd
|
2021-12-09 13:26:13 +00:00
|
|
|
- cd ./src/test/resources/local-integration-test/ && ./setup-local-s3-on-k3d.sh
|
|
|
|
|