Commit fef314b7 authored by Christian's avatar Christian 💬

push only with tag

parent 12fc69a1
stages:
- build
- deploy
- cleanup
variables:
imageversion: "2.2"
rootfsurl: "https://data.perryflynn.de/rootfs-stretch-20181211.tar.gz"
rootfssha256sum: "f2b79ce732c0fd47a65bda6c51c9bef7d9d9037bd483037edafab722843b50cd"
pushtag: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${imageversion}"
before_script:
- 'chmod a+x build.sh'
build:
stage: build
only:
- tags
- triggers
variables:
pushtag: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${imageversion}"
script:
- 'curl "${rootfsurl}" > rootfs.tar.gz'
- 'echo "${rootfssha256sum} rootfs.tar.gz" | sha256sum -c &> /dev/null || exit 98'
- "./build.sh --rootfstarfile rootfs.tar.gz --imagename ${pushtag}"
- 'rm -f rootfs.tar.gz'
deploy:
stage: deploy
only:
- tags
- triggers
script:
- "docker login -u gitlab-ci-token -p $CI_JOB_TOKEN ${CI_REGISTRY}"
- "docker push ${pushtag}"
- "docker logout ${CI_REGISTRY}"
- "docker image rm ${pushtag}"
cleanup:
stage: cleanup
script:
- "docker image prune -a -f"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment