mirror of
https://gitlab.com/psono/psono-admin-client
synced 2025-04-19 03:22:17 +03:00
288 lines
9.7 KiB
YAML
288 lines
9.7 KiB
YAML
variables:
|
|
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
CONTAINER_TEST_IMAGE_JFROG: psono-docker.jfrog.io/psono/psono-admin-client:$CI_COMMIT_REF_NAME
|
|
CONTAINER_LATEST_IMAGE_JFROG: psono-docker.jfrog.io/psono/psono-admin-client:latest
|
|
|
|
stages:
|
|
- translate
|
|
- test
|
|
- build
|
|
- release
|
|
- deploy
|
|
|
|
create-translations:
|
|
except:
|
|
- schedules
|
|
stage: translate
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- apt-get update && apt-get install -y python3 python3-pip
|
|
- pip3 install requests openai==1.55.3
|
|
- python3 var/translate.py
|
|
only:
|
|
- master@psono/psono-admin-client
|
|
|
|
test-unittests:
|
|
except:
|
|
- schedules
|
|
stage: test
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- sh ./var/build-ubuntu.sh
|
|
- npm test -- --coverage
|
|
# - apt-get install -y --no-install-recommends xvfb x11vnc fluxbox xterm
|
|
# - curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
# - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
|
|
# - apt-get update
|
|
# - apt-get install -y google-chrome-stable
|
|
# - karma start ./unittests/karma-chrome-headless.conf.js
|
|
|
|
|
|
test-vulnerability-scan:
|
|
except:
|
|
- schedules
|
|
stage: test
|
|
image: psono-docker.jfrog.io/node:lts-alpine
|
|
script:
|
|
- npm audit --audit-level high --json --omit=dev
|
|
allow_failure: true
|
|
|
|
|
|
test-upload-translations:
|
|
stage: test
|
|
image: psono-docker.jfrog.io/python:3
|
|
script:
|
|
- pip install requests
|
|
- python3 var/upload_translations.py
|
|
- python3 var/sync_translations.py
|
|
only:
|
|
- develop@psono/psono-admin-client
|
|
|
|
build-docker-image:
|
|
except:
|
|
- schedules
|
|
stage: build
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
services:
|
|
- name: docker:25-dind
|
|
alias: docker
|
|
command: ["--tls=false"]
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_TLS_CERTDIR: ""
|
|
script:
|
|
- apt-get update && apt-get install -y curl iptables libdevmapper1.02.1
|
|
- sh ./var/download_translations_from_artifactory.sh
|
|
- sh ./var/build-ubuntu.sh
|
|
- curl -fSL "https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/containerd.io_1.6.28-1_amd64.deb" -o containerd.deb && echo "3fcc3e44e6d507c346ae05bbaef8f4bb04dfa8da9f04af658537f7e373c91340 containerd.deb" | sha256sum -c -
|
|
- curl -fSL "https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-buildx-plugin_0.12.1-1~ubuntu.22.04~jammy_amd64.deb" -o docker-buildx-plugin.deb && echo "3fb7cd11fd9bf7c31d81c1afa96c023519d9e6e17422192aa4d0aa2767ed0776 docker-buildx-plugin.deb" | sha256sum -c -
|
|
- curl -fSL "https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-ce-cli_25.0.3-1~ubuntu.22.04~jammy_amd64.deb" -o docker-ce-cli.deb && echo "624abe860a3d9dd190c278263b3ae115d54ce1135774a79f84026a6ec6ebafd1 docker-ce-cli.deb" | sha256sum -c -
|
|
- curl -fSL "https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-ce_25.0.3-1~ubuntu.22.04~jammy_amd64.deb" -o docker-ce.deb && echo "63c7703814558a829ab3cc37c8018c050c9dad56f99c261090500f6c87821fd1 docker-ce.deb" | sha256sum -c -
|
|
- dpkg -i ./containerd.deb ./docker-ce.deb ./docker-ce-cli.deb ./docker-buildx-plugin.deb
|
|
- docker info
|
|
- echo $CI_JOB_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
|
|
- docker context create builder
|
|
- docker buildx create builder --use
|
|
- docker buildx build --platform linux/amd64,linux/arm64 -t $CONTAINER_TEST_IMAGE --push --pull .
|
|
only:
|
|
- branches@psono/psono-admin-client
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
|
|
build-sbom:
|
|
except:
|
|
- schedules
|
|
stage: build
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- sh ./var/build-ubuntu.sh
|
|
- npx @cyclonedx/cyclonedx-npm > sbom.json
|
|
- mv /builds/psono/psono-admin-client/sbom.json ../
|
|
- rm -Rf *
|
|
- rm -Rf .* 2> /dev/null || true
|
|
- mv ../sbom.json ./
|
|
artifacts:
|
|
name: "sbom_$CI_COMMIT_REF_NAME"
|
|
paths:
|
|
- ./*
|
|
only:
|
|
- branches@psono/psono-admin-client
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
build-webclient:
|
|
except:
|
|
- schedules
|
|
stage: build
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- sh ./var/download_translations_from_artifactory.sh
|
|
- sh ./var/build-ubuntu.sh
|
|
- sh ./var/package-webclient.sh
|
|
- >
|
|
if [ ! -z "$artifactory_credentials" ]; then
|
|
curl -fL https://getcli.jfrog.io | sh &&
|
|
./jfrog config add rt-server-1 --artifactory-url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials --interactive=false &&
|
|
./jfrog rt u --target-props="CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_COMMIT_SHA=$CI_COMMIT_SHA;CI_COMMIT_URL=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA;CI_PROJECT_ID=$CI_PROJECT_ID;CI_PROJECT_NAME=$CI_PROJECT_NAME;CI_PROJECT_NAMESPACE=$CI_PROJECT_NAMESPACE;CI_PROJECT_URL=$CI_PROJECT_URL;CI_PIPELINE_ID=$CI_PIPELINE_ID;CI_PIPELINE_URL=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID;CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME;CI_JOB_ID=$CI_JOB_ID;CI_JOB_URL=$CI_PROJECT_URL/-/jobs/$CI_JOB_ID;CI_JOB_NAME=$CI_JOB_NAME;CI_JOB_STAGE=$CI_JOB_STAGE;CI_RUNNER_ID=$CI_RUNNER_ID;GITLAB_USER_ID=$GITLAB_USER_ID;CI_SERVER_VERSION=$CI_SERVER_VERSION" /builds/psono/psono-admin-client/build/psono.webclient.zip psono/admin-client/$CI_COMMIT_REF_NAME/webclient.zip &&
|
|
./jfrog rt sp "psono/admin-client/$CI_COMMIT_REF_NAME/webclient.zip" "CI_COMMIT_TAG=$CI_COMMIT_TAG" || true
|
|
fi
|
|
- mv /builds/psono/psono-admin-client/build ../
|
|
- rm -Rf *
|
|
- rm -Rf .* 2> /dev/null || true
|
|
- mv ../build/* ./
|
|
artifacts:
|
|
name: "webclient_$CI_COMMIT_REF_NAME"
|
|
paths:
|
|
- ./*
|
|
only:
|
|
- branches@psono/psono-admin-client
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
release-artifacts:
|
|
except:
|
|
- schedules
|
|
stage: release
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- apt-get update
|
|
- apt-get install -y curl
|
|
- curl -fL https://getcli.jfrog.io | sh
|
|
- ./jfrog config add rt-server-1 --artifactory-url=https://psono.jfrog.io/psono --user=gitlab --password=$artifactory_credentials --interactive=false
|
|
- ./jfrog rt cp --flat psono/admin-client/$CI_COMMIT_REF_NAME/webclient.zip psono/admin-client/latest/
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
|
|
release-docker-jfrog:
|
|
except:
|
|
- schedules
|
|
stage: release
|
|
image: psono-docker.jfrog.io/docker:25.0.3-git
|
|
services:
|
|
- name: docker:25-dind
|
|
alias: docker
|
|
command: ["--tls=false"]
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_TLS_CERTDIR: ""
|
|
script:
|
|
- apk add skopeo
|
|
- docker info
|
|
- echo $CI_JOB_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
|
|
- echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
|
|
- skopeo copy --all docker://$CONTAINER_TEST_IMAGE docker://$CONTAINER_TEST_IMAGE_JFROG
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
|
|
release-docker:
|
|
except:
|
|
- schedules
|
|
stage: release
|
|
image: psono-docker.jfrog.io/docker:25.0.3-git
|
|
services:
|
|
- name: docker:25-dind
|
|
alias: docker
|
|
command: ["--tls=false"]
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_TLS_CERTDIR: ""
|
|
script:
|
|
- apk add skopeo
|
|
- docker info
|
|
- echo $CI_JOB_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
|
|
- echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
|
|
- skopeo copy --all docker://$CONTAINER_TEST_IMAGE docker://$CONTAINER_LATEST_IMAGE_JFROG
|
|
only:
|
|
- develop@psono/psono-admin-client
|
|
- master@psono/psono-admin-client
|
|
|
|
deploy-docker:
|
|
except:
|
|
- schedules
|
|
stage: deploy
|
|
image: psono-docker.jfrog.io/docker:25.0.3-git
|
|
services:
|
|
- name: docker:25-dind
|
|
alias: docker
|
|
command: ["--tls=false"]
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_TLS_CERTDIR: ""
|
|
script:
|
|
- echo $CI_JOB_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
|
|
- echo $docker_hub_credentials | docker login --username=psonogitlab --password-stdin
|
|
- sh ./var/deploy-docker.sh
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
|
|
deploy-github:
|
|
except:
|
|
- schedules
|
|
stage: deploy
|
|
image: psono-docker.jfrog.io/docker:25.0.3-git
|
|
services:
|
|
- name: docker:25-dind
|
|
alias: docker
|
|
command: ["--tls=false"]
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
DOCKER_TLS_CERTDIR: ""
|
|
script:
|
|
- sh ./var/deploy-github.sh
|
|
environment:
|
|
name: github
|
|
url: https://github.com/psono/psono-admin-client
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
deploy-changelog:
|
|
except:
|
|
- schedules
|
|
stage: deploy
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
script:
|
|
- sh ./var/deploy_changelog.sh
|
|
environment:
|
|
name: static.psono.com
|
|
url: https://static.psono.com/gitlab.com/psono/psono-admin-client/changelog.json
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|
|
|
|
|
|
deploy-nightlyartifacts:
|
|
except:
|
|
- schedules
|
|
stage: release
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
dependencies:
|
|
- build-sbom
|
|
script:
|
|
- sh ./var/deploy_nightlyartifacts.sh
|
|
environment:
|
|
name: static.psono.com
|
|
url: https://get.psono.com/psono/psono-admin-client/nightly/adminclient.zip
|
|
only:
|
|
- develop@psono/psono-admin-client
|
|
|
|
|
|
deploy-releaseartifacts:
|
|
except:
|
|
- schedules
|
|
stage: release
|
|
image: psono-docker.jfrog.io/ubuntu:22.04
|
|
dependencies:
|
|
- build-sbom
|
|
script:
|
|
- sh ./var/deploy_releaseartifacts.sh
|
|
environment:
|
|
name: static.psono.com
|
|
url: https://get.psono.com/psono/psono-admin-client/latest/adminclient.zip
|
|
only:
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/
|