-
Notifications
You must be signed in to change notification settings - Fork 31
Step Containers
Rajan, Sarat edited this page Aug 22, 2019
·
1 revision
You can use pipeline for building your docker images as well as publish/push them to your own Docker Registry right after they are built.
pipeline:
appName: my-app-image
appVersion:
master: 2.0.1
environment:
ARTIFACTORY: <Your Docker Registry>
IMAGE: ${ARTIFACTORY}/test/${PIPELINE_APP_NAME}
TAG: ${PIPELINE_APP_VERSION}.${PIPELINE_BUILD_NUMBER}
steps:
- name: build-image
image: plugins/docker
commands:
- docker build . -t pipeline-test
- docker tag pipeline-test ${IMAGE}:latest
- docker tag pipeline-test ${IMAGE}:${TAG}
.
.
- name: publish-image
image: plugins/docker
secrets:
- source: docker_registry_credential_from_jenkins
target:
- DOCKER_USER
- DOCKER_PASS
commands:
- echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin ${ARTIFACTORY}
- docker push ${IMAGE}:latest
- docker push ${IMAGE}:${TAG}
- docker logout ${ARTIFACTORY}
POET pipeline is compatible with any of the official gradle images.
steps:
- name: test
image: gradle:5.0-jre8-alpine
commands:
- gradle --no-daemon clean test jacocoTestReport
POET pipeline is compatible with any of the official maven images.
steps:
- name: build
image: maven:3.6-jdk-8-slim
commands:
- mvn clean install
POET pipeline is compatible with any of the official python images.
steps:
- name: hello-world
image: python:3.5.7-alpine
commands:
- print("Hello World")
Notifications could be implemented as a normal pipeline step. Note that since most steps are currently designed to only run during pipeline success, you'll need to set:
when:
status: [ success, failure ]
to make sure notifications fire on pipeline failures.
steps:
- name: slack
image: plugins/slack
settings:
webhook: https://hooks.slack.com/services/...
channel: dev
when:
status: [ success, failure ]