Page MenuHomePhabricator

Install Jenkins Pipeline Plugin for ci-staging and verify its basic functionality
Closed, ResolvedPublic


Let's evaluate the Jenkins Pipeline Plugin for driving the new release pipeline. A simple verification could be to checkout the master branch of scap and have it run tox.

Event Timeline

dduvall created this task.Mar 28 2017, 11:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 28 2017, 11:08 PM
dduvall triaged this task as Medium priority.Mar 29 2017, 7:42 PM
dduvall moved this task from Backlog to Build PoC on the Release Pipeline board.

The Pipeline Plugin has been integrated in Jenkins 2.x :]

thcipriani closed this task as Resolved.Mar 29 2017, 11:52 PM

So the Jenkins pipeline plugin is installed and working on ci-staging-jenkins-master01.

Right now the JenkinsFile job is looking at some machine I spun up on digital ocean and downloading the scap repo from there:

I put a simple Jenkinsfile in the scap repo on that host:

node {
    stage('Build') {
        echo 'Building...'
    stage('Test') {
        git url: ''
        sh 'ls'
        sh '/usr/local/bin/docker-test-build'
    stage('Deploy') {
        echo 'Deploying....'

This downloads scap from github and runs ls then /usr/local/bin/docker-test-build which I pulled and modified from a our

set -e

JOB_LOWER=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')


[ -f "$DOCKER_FILE" ] || exit 0

onexit() {
  docker rm "${DOCKER_NAME}" || true

trap 'onexit $?' EXIT

docker build --file "${DOCKER_FILE}" --tag "${DOCKER_BUILD_TAG}" .
docker run --tty --name "${DOCKER_NAME}" "${DOCKER_BUILD_TAG}"

# copy all newly created files in log/ back to host workspace to be archived as artifacts
ID="$(docker ps -a --no-trunc --filter name="$DOCKER_NAME" --format "{{.ID}}" | tail -n 1)"
docker diff "$ID" | awk '$2 ~ "^'"$DOCKER_WORKSPACE"'/log/"' | while read change path; do
  if [[ "$change" == "A" ]]; then
    docker cp "$ID":"$path" "${path#"$DOCKER_WORKSPACE"/}"

From that simple jenkins-file I got a job that builds our scap Docker image and runs our unit tests: