Dan Anglin
ed709517c0
Update the CI pipeline file and Makefile to push the Docker image on tagged releases. Part of dananglin/pleroma-ansible-playbook#14
75 lines
1.3 KiB
YAML
75 lines
1.3 KiB
YAML
---
|
|
stages:
|
|
- test
|
|
- publish
|
|
|
|
.use-python:
|
|
image: python:3.7.6-slim-buster
|
|
|
|
.docker-build-setup:
|
|
image: docker:19.03.8
|
|
services:
|
|
- docker:19.03.8-dind
|
|
|
|
.install-make: &install-make
|
|
- apk add --no-cache make
|
|
|
|
test:dockerfile-lint:
|
|
image: hadolint/hadolint:v1.17.5-alpine
|
|
script:
|
|
- hadolint ./Dockerfile
|
|
only:
|
|
refs:
|
|
- merge_requests
|
|
changes:
|
|
- Dockerfile
|
|
except:
|
|
refs:
|
|
- master
|
|
|
|
test:docker-image-build:
|
|
extends: .docker-build-setup
|
|
script:
|
|
- *install-make
|
|
- make image
|
|
stage: test
|
|
only:
|
|
refs:
|
|
- merge_requests
|
|
changes:
|
|
- Dockerfile
|
|
except:
|
|
refs:
|
|
- master
|
|
|
|
test:custom-modules:
|
|
extends: .use-python
|
|
stage: test
|
|
before_script:
|
|
- apt-get update && apt-get install make
|
|
- pip install ansible==2.9.6
|
|
script:
|
|
- make test_modules_unit
|
|
only:
|
|
refs:
|
|
- merge_requests
|
|
changes:
|
|
- library/*
|
|
except:
|
|
refs:
|
|
- master
|
|
|
|
publish:docker-image:
|
|
extends: .docker-build-setup
|
|
before_script:
|
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
|
after_script:
|
|
- docker logout ${CI_REGISTRY}
|
|
script:
|
|
- *install-make
|
|
- make publish
|
|
only:
|
|
- /^v[0-9]+(.[0-9]+){2}$/
|
|
variables:
|
|
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_PATH}
|
|
IMAGE_TAG: ${CI_COMMIT_REF_NAME}
|