This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
pleroma-ansible-playbook/.gitlab/ci/playbook.gitlab-ci.yml
Dan Anglin 20667709b2
ci: test environment docker image for CI pipelines
This commit includes a Dockerfile for building a test environment for
future CI pipelines. This commit also refactors the GitLab CI pipeline
files by splitting the jobs into different files:

- .gitlab-ci.yml: Global CI pipeline file.
- .gitlab/ci/test-env.gitlab-ci.yml: Jobs to test and publish the
docker image for the test environment.
- .gitlab/ci/playbook.gitlab-ci.yml: Jobs to test and publish the
docker image for the pleroma playbook
- .gitlab/ci/templates/docker.gitlab-ci.yml: Template jobs for
testing and publishing docker images.

Part of dananglin/pleroma-ansible-playbook#17
2020-07-10 07:22:39 +01:00

60 lines
1.3 KiB
YAML

---
.use-python:
image: python:3.7.6-slim-buster
.playbook-docker-vars:
variables:
DOCKERFILE: "Dockerfile"
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_PATH}/playbook
IMAGE_TAG: ${CI_COMMIT_REF_NAME}
.playbook-docker-test-rules:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- "Dockerfile"
when: always
test:playbook:dockerfile-lint:
extends:
- .dockerfile-lint
- .playbook-docker-vars
- .playbook-docker-test-rules
test:playbook:docker-build:
extends:
- .dockerbuild-test
- .playbook-docker-vars
- .playbook-docker-test-rules
script:
- export IMAGE_DATE=$(date -Iseconds)
- export BUILD_ARGS="--build-arg BUILD_TAG=${IMAGE_TAG} --build-arg BUILD_TIME=${IMAGE_DATE}"
- make image
test:playbook:custom-modules:
stage: test
extends: .use-python
before_script:
- apt-get update && apt-get install make
- pip install ansible==2.9.7
script:
- make test_modules_unit
only:
refs:
- merge_requests
changes:
- library/*
except:
refs:
- master
publish:playbook:docker-image:
extends:
- .docker-publish
- .playbook-docker-vars
script:
- export IMAGE_DATE=$(date -Iseconds)
- export BUILD_ARGS="--build-arg BUILD_TAG=${IMAGE_TAG} --build-arg BUILD_TIME=${IMAGE_DATE}"
- make publish
only:
- /^v[0-9]+(.[0-9]+){2}$/