1
0
Fork 0
This repository has been archived on 2025-01-13. You can view files and clone it, but cannot push or open issues or pull requests.
gitlab-hetzner-runner/.gitlab-ci.yml

50 lines
1.7 KiB
YAML
Raw Normal View History

image: quay.io/sheogorath/build-ah-engine
2019-05-04 14:04:44 +02:00
variables:
LANG: C.UTF-8
before_script:
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
2019-05-04 14:04:44 +02:00
stages:
- analyse
2019-05-04 14:04:44 +02:00
- build
- test
2020-04-09 20:24:19 +02:00
- cleanup_test
- tag
2019-05-04 14:04:44 +02:00
- deploy
build:
2019-05-04 14:04:44 +02:00
stage: build
script:
- podman build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
2019-05-04 14:04:44 +02:00
2020-04-09 20:24:19 +02:00
test:
stage: test
script:
- curl -L https://github.com/hetznercloud/cli/releases/download/v1.16.2/hcloud-linux-amd64.tar.gz | tar -zxv hcloud
- sha256sum -c <(echo "a517c1362edd3c6374c1dd12ba58e3fe89d67ec7db37b12aa5b904d409182d25 hcloud")
- podman run -e CI_HETZNER_KEY --entrypoint /bin/bash "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -c 'docker-machine create --driver hetzner --hetzner-image="debian-10" --hetzner-server-type="cx11" --hetzner-api-token="$CI_HETZNER_KEY" ci-test-machine && docker-machine ls; docker-machine rm -y ci-test-machine'
cleanup_test:
image: docker.io/library/ubuntu:21.04
2020-04-09 20:24:19 +02:00
stage: cleanup_test
before_script: []
2020-04-09 20:24:19 +02:00
script:
- apt-get update
- apt-get install -y hcloud-cli
- HCLOUD_TOKEN="$CI_HETZNER_KEY" ./hcloud server delete ci-test-machine || exit 0
- HCLOUD_TOKEN="$CI_HETZNER_KEY" ./hcloud ssh-key delete ci-test-machine || exit 0
when: on_failure
tagging-master:
stage: tag
2019-05-04 14:04:44 +02:00
script:
- podman pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- si-tagging -l "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE" "$(grep -e 'FROM docker.io/gitlab/gitlab-runner:v' Dockerfile | sed -e 's/.*:v//')"
- podman images --format "{{.Repository}}:{{.Tag}}" "$CI_REGISTRY_IMAGE" | grep "$CI_REGISTRY_IMAGE" | xargs -L 1 podman push
only:
2019-05-04 14:04:44 +02:00
- master