workspaces-images/.gitlab-ci.yml

363 lines
11 KiB
YAML

############
# Settings #
############
image: docker
services:
- docker:dind
stages:
- readme
- revert
- build
- test
- manifest
variables:
BASE_TAG: "develop"
USE_PRIVATE_IMAGES: 0
KASM_RELEASE: "1.14.0"
DOCKER_AUTH_CONFIG: ${_DOCKER_AUTH_CONFIG}
TEST_INSTALLER: "https://kasmweb-build-artifacts.s3.amazonaws.com/kasm_backend/7cbc7854255820c60cfecb2dee5177c1663af43a/kasm_workspaces_feature_KASM-4513-slim-upgrades_1.14.0.7cbc78.tar.gz"
before_script:
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed -r 's#^release/##' | sed 's/\//_/g')"
################
# YAML anchors #
################
# Metadata format - name|baseimage|dockerfile
.MULTI_ARCH_BUILDS: &MULTI_ARCH_BUILDS
- "audacity|core-ubuntu-focal|dockerfile-kasm-audacity"
- "chromium|core-ubuntu-focal|dockerfile-kasm-chromium"
- "deluge|core-ubuntu-focal|dockerfile-kasm-deluge"
- "doom|core-ubuntu-focal|dockerfile-kasm-doom"
- "filezilla|core-ubuntu-focal|dockerfile-kasm-filezilla"
- "firefox|core-ubuntu-focal|dockerfile-kasm-firefox"
- "gimp|core-ubuntu-focal|dockerfile-kasm-gimp"
- "inkscape|core-ubuntu-focal|dockerfile-kasm-inkscape"
- "java-dev|core-ubuntu-focal|dockerfile-kasm-java-dev"
- "libre-office|core-ubuntu-focal|dockerfile-kasm-libre-office"
- "opensuse-15-desktop|core-opensuse-15|dockerfile-kasm-opensuse-15-desktop"
- "oracle-8-desktop|core-oracle-8|dockerfile-kasm-oracle-8-desktop"
- "pinta|core-ubuntu-focal|dockerfile-kasm-pinta"
- "qbittorrent|core-ubuntu-focal|dockerfile-kasm-qbittorrent"
- "remmina|core-ubuntu-focal|dockerfile-kasm-remmina"
- "sublime-text|core-ubuntu-focal|dockerfile-kasm-sublime-text"
- "telegram|core-ubuntu-focal|dockerfile-kasm-telegram"
- "terminal|core-ubuntu-focal|dockerfile-kasm-terminal"
- "thunderbird|core-ubuntu-focal|dockerfile-kasm-thunderbird"
- "tor-browser|core-ubuntu-focal|dockerfile-kasm-tor-browser"
- "ubuntu-focal-desktop|core-ubuntu-focal|dockerfile-kasm-ubuntu-focal-desktop"
- "ubuntu-jammy-desktop|core-ubuntu-jammy|dockerfile-kasm-ubuntu-jammy-desktop"
- "vlc|core-ubuntu-focal|dockerfile-kasm-vlc"
- "vs-code|core-ubuntu-focal|dockerfile-kasm-vs-code"
.MULTI_ARCH_BUILDS2: &MULTI_ARCH_BUILDS2
- "almalinux-8-desktop|core-almalinux-8|dockerfile-kasm-almalinux-8-desktop"
- "almalinux-9-desktop|core-almalinux-9|dockerfile-kasm-almalinux-9-desktop"
- "alpine-317-desktop|core-alpine-317|dockerfile-kasm-alpine-317-desktop"
- "alpine-318-desktop|core-alpine-318|dockerfile-kasm-alpine-318-desktop"
- "brave|core-ubuntu-focal|dockerfile-kasm-brave"
- "debian-bullseye-desktop|core-debian-bullseye|dockerfile-kasm-debian-bullseye-desktop"
- "debian-bookworm-desktop|core-debian-bookworm|dockerfile-kasm-debian-bookworm-desktop"
- "fedora-37-desktop|core-fedora-37|dockerfile-kasm-fedora-37-desktop"
- "fedora-38-desktop|core-fedora-38|dockerfile-kasm-fedora-38-desktop"
- "kali-rolling-desktop|core-kali-rolling|dockerfile-kasm-kali-rolling-desktop"
- "minetest|core-ubuntu-focal|dockerfile-kasm-minetest"
- "oracle-9-desktop|core-oracle-9|dockerfile-kasm-oracle-9-desktop"
- "parrotos-5-desktop|core-parrotos-5|dockerfile-kasm-parrotos-5-desktop"
- "retroarch|core-ubuntu-focal|dockerfile-kasm-retroarch"
- "rockylinux-8-desktop|core-rockylinux-8|dockerfile-kasm-rockylinux-8-desktop"
- "rockylinux-9-desktop|core-rockylinux-9|dockerfile-kasm-rockylinux-9-desktop"
- "super-tux-kart|core-ubuntu-focal|dockerfile-kasm-super-tux-kart"
- "ubuntu-focal-dind|core-ubuntu-focal|dockerfile-kasm-ubuntu-focal-dind"
- "ubuntu-focal-dind-rootless|core-ubuntu-focal|dockerfile-kasm-ubuntu-focal-dind-rootless"
- "ubuntu-jammy-dind|core-ubuntu-jammy|dockerfile-kasm-ubuntu-jammy-dind"
- "ubuntu-jammy-dind-rootless|core-ubuntu-jammy|dockerfile-kasm-ubuntu-jammy-dind-rootless"
- "vivaldi|core-ubuntu-focal|dockerfile-kasm-vivaldi"
.SINGLE_ARCH_BUILDS: &SINGLE_ARCH_BUILDS
- "atom|core-ubuntu-focal|dockerfile-kasm-atom"
- "blender|core-ubuntu-focal|dockerfile-kasm-blender"
- "centos-7-desktop|core-centos-7|dockerfile-kasm-centos-7-desktop"
- "chrome|core-ubuntu-focal|dockerfile-kasm-chrome"
- "desktop|core-ubuntu-focal|dockerfile-kasm-desktop"
- "desktop-deluxe|core-ubuntu-focal|dockerfile-kasm-desktop-deluxe"
- "discord|core-ubuntu-focal|dockerfile-kasm-discord"
- "edge|core-ubuntu-focal|dockerfile-kasm-edge"
- "hunchly|core-ubuntu-focal|dockerfile-kasm-hunchly"
- "insomnia|core-ubuntu-focal|dockerfile-kasm-insomnia"
- "maltego|core-ubuntu-focal|dockerfile-kasm-maltego"
- "only-office|core-ubuntu-focal|dockerfile-kasm-only-office"
- "oracle-7-desktop|core-oracle-7|dockerfile-kasm-oracle-7-desktop"
- "postman|core-ubuntu-focal|dockerfile-kasm-postman"
- "remnux-focal-desktop|core-ubuntu-focal|dockerfile-kasm-remnux-focal-desktop"
- "signal|core-ubuntu-focal|dockerfile-kasm-signal"
- "steam|core-ubuntu-focal|dockerfile-kasm-steam"
- "tracelabs|core-kali-rolling|dockerfile-kasm-tracelabs"
- "unityhub|core-ubuntu-focal|dockerfile-kasm-unityhub"
- "zoom|core-ubuntu-focal|dockerfile-kasm-zoom"
- "zsnes|core-ubuntu-focal|dockerfile-kasm-zsnes"
###############################################
# Build Containers and push to cache endpoint #
###############################################
build_multi_containers:
stage: build
script:
- apk add bash
- bash ci-scripts/build.sh "${BUILD_META}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- ${TAG}
retry: 1
parallel:
matrix:
- TAG: [ aws-autoscale, aws-autoscale-arm64 ]
BUILD_META: *MULTI_ARCH_BUILDS
build_multi_containers2:
stage: build
script:
- apk add bash
- bash ci-scripts/build.sh "${BUILD_META}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- ${TAG}
retry: 1
parallel:
matrix:
- TAG: [ aws-autoscale, aws-autoscale-arm64 ]
BUILD_META: *MULTI_ARCH_BUILDS2
build_single_containers:
stage: build
script:
- apk add bash
- bash ci-scripts/build.sh "${BUILD_META}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale
retry: 1
parallel:
matrix:
- BUILD_META: *SINGLE_ARCH_BUILDS
######################################
# Test containers and upload results #
######################################
test_multi:
stage: test
when: always
script:
- apk add bash
- bash ci-scripts/test.sh "${BUILD_META}" "${ARCH}" "${EC2_LAUNCHER_ID}" "${EC2_LAUNCHER_SECRET}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
retry: 1
parallel:
matrix:
- ARCH: [ "x86_64", "aarch64" ]
BUILD_META: *MULTI_ARCH_BUILDS
test_multi2:
stage: test
when: always
script:
- apk add bash
- bash ci-scripts/test.sh "${BUILD_META}" "${ARCH}" "${EC2_LAUNCHER_ID}" "${EC2_LAUNCHER_SECRET}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
retry: 1
parallel:
matrix:
- ARCH: [ "x86_64", "aarch64" ]
BUILD_META: *MULTI_ARCH_BUILDS2
test_single:
stage: test
when: always
script:
- apk add bash
- bash ci-scripts/test.sh "${BUILD_META}" "x86_64" "${EC2_LAUNCHER_ID}" "${EC2_LAUNCHER_SECRET}"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
retry: 1
parallel:
matrix:
- BUILD_META: *SINGLE_ARCH_BUILDS
############################################
# Manifest Containers if their test passed #
############################################
manifest_multi:
stage: manifest
when: always
script:
- apk add bash
- bash ci-scripts/manifest.sh "${BUILD_META}" "multi"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS
manifest_multi2:
stage: manifest
when: always
script:
- apk add bash
- bash ci-scripts/manifest.sh "${BUILD_META}" "multi"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS2
manifest_single:
stage: manifest
when: always
script:
- apk add bash
- bash ci-scripts/manifest.sh "${BUILD_META}" "single"
except:
variables:
- $README_USERNAME
- $README_PASSWORD
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *SINGLE_ARCH_BUILDS
####################
# Helper Functions #
####################
## Update Readmes ##
update_readmes_multi:
stage: readme
script:
- apk add bash
- bash ci-scripts/readme.sh "${BUILD_META}"
only:
variables:
- $README_USERNAME
- $README_PASSWORD
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS
update_readmes_multi2:
stage: readme
script:
- apk add bash
- bash ci-scripts/readme.sh "${BUILD_META}"
only:
variables:
- $README_USERNAME
- $README_PASSWORD
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS2
update_readmes_single:
stage: readme
script:
- apk add bash
- bash ci-scripts/readme.sh "${BUILD_META}"
only:
variables:
- $README_USERNAME
- $README_PASSWORD
tags:
- aws-autoscale-nano
parallel:
matrix:
- BUILD_META: *SINGLE_ARCH_BUILDS
## Revert Images to specific build id ##
dockerhub_revert_multi:
stage: revert
script:
- /bin/bash ci-scripts/manifest.sh "${BUILD_META}" "multi" "${DOCKERHUB_REVERT}" "${REVERT_IS_ROLLING}"
only:
variables:
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS
dockerhub_revert_multi2:
stage: revert
script:
- /bin/bash ci-scripts/manifest.sh "${BUILD_META}" "multi" "${DOCKERHUB_REVERT}" "${REVERT_IS_ROLLING}"
only:
variables:
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
parallel:
matrix:
- BUILD_META: *MULTI_ARCH_BUILDS
dockerhub_revert_single:
stage: revert
script:
- /bin/bash ci-scripts/manifest.sh "${BUILD_META}" "single" "${DOCKERHUB_REVERT}" "${REVERT_IS_ROLLING}"
only:
variables:
- $DOCKERHUB_REVERT
- $REVERT_IS_ROLLING
parallel:
matrix:
- BUILD_META: *SINGLE_ARCH_BUILDS