.gitlab-ci.yml 1.22 KB
Newer Older
qua's avatar
qua committed
1 2 3 4
---
stages:
  - test
  - build
qua's avatar
qua committed
5
  - deploy
qua's avatar
qua committed
6 7

test:
mh's avatar
mh committed
8
  image: $CI_REGISTRY/immerda/container-images/ruby/gpg:2.7
qua's avatar
qua committed
9
  tags:
qua's avatar
qua committed
10
    - container
qua's avatar
qua committed
11
  script:
mh's avatar
mh committed
12
    - yum install -y rh-ruby27-ruby-devel openssl-devel gcc gcc-c++ bzip2 make tar
qua's avatar
qua committed
13 14 15 16 17 18 19 20
    - bundle install --jobs $(nproc)
    - bundle exec rspec

build_image:
  stage: build
  tags:
    - buildah
  script:
qua's avatar
qua committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    - ./buildah.sh
    - podman save wkd-srv --output wkd-srv.tar;
  artifacts:
    expire_in: 1 day
    paths:
      - wkd-srv.tar

deploy_image:
  stage: deploy
  tags:
    - buildah
  script:
    - export USERPASS="$(
          echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64
          )"
    - |
      echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$USERPASS\"}}}" \
          > cred.json
    - echo "Pushing wkd-srv-$CI_COMMIT_SHORT_SHA"
    - skopeo copy --authfile ./cred.json "docker-archive:wkd-srv.tar" "docker://$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
    - echo -e "\033[0;32mdone\033[0m";
42
    - |
mh's avatar
mh committed
43
      if [ "${CI_COMMIT_REF_NAME}" = "master" ]; then
44 45 46 47
        echo "Pushing wkd-srv:latest"
        skopeo copy --authfile ./cred.json "docker-archive:wkd-srv.tar" "docker://$CI_REGISTRY_IMAGE:latest"
        echo -e "\033[0;32mdone\033[0m";
      fi
qua's avatar
qua committed
48
    - rm -f cred.json