Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI job for nightly builds #1248

Merged
merged 6 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .ci/jobs/gke-e2e-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
artifactNumToKeep: 10
name: cloud-on-k8s-versions-gke
project-type: pipeline
triggers:
- timed: '0 0 * * 1-5'
parameters:
- string:
name: IMAGE
description: "Docker image with ECK"
pipeline-scm:
scm:
- git:
Expand Down
21 changes: 21 additions & 0 deletions .ci/jobs/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- job:
description: Job that build nightly images of ECK. This Job is managed by JJB.
logrotate:
daysToKeep: 7
numToKeep: 100
artifactDaysToKeep: 5
artifactNumToKeep: 10
name: cloud-on-k8s-nightly
project-type: pipeline
triggers:
- timed: '0 0 * * 1-5'
pipeline-scm:
scm:
- git:
url: https://github.com/elastic/cloud-on-k8s
branches:
- master
credentials-id: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba'
script-path: build/ci/nightly/Jenkinsfile
lightweight-checkout: true
8 changes: 5 additions & 3 deletions build/ci/e2e/GKE_k8s_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pipeline {
VAULT_SECRET_ID = credentials('vault-secret-id')
REGISTRY = "eu.gcr.io"
GCLOUD_PROJECT = credentials('k8s-operators-gcloud-project')
OPERATOR_IMAGE = "${IMAGE}"
LATEST_RELEASED_IMG = "${IMAGE}"
}

stages {
Expand All @@ -26,7 +28,7 @@ pipeline {
}
steps {
checkout scm
sh 'make -C build/ci ci-e2e'
sh 'make -C build/ci ci-e2e-rc'
}
}
stage("1.12") {
Expand All @@ -39,7 +41,7 @@ pipeline {
}
steps {
checkout scm
sh 'make -C build/ci ci-e2e'
sh 'make -C build/ci ci-e2e-rc'
}
}
stage("1.13") {
Expand All @@ -52,7 +54,7 @@ pipeline {
}
steps {
checkout scm
sh 'make -C build/ci ci-e2e'
sh 'make -C build/ci ci-e2e-rc'
}
}
}
Expand Down
59 changes: 59 additions & 0 deletions build/ci/nightly/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
pipeline {

agent {
label 'linux'
}

options {
timeout(time: 1, unit: 'HOURS')
}

environment {
VAULT_ADDR = credentials('vault-addr')
VAULT_ROLE_ID = credentials('vault-role-id')
VAULT_SECRET_ID = credentials('vault-secret-id')
GCLOUD_PROJECT = credentials('k8s-operators-gcloud-project')
REGISTRY = "push.docker.elastic.co"
REPOSITORY = "eck-snapshots"
IMG_NAME = "eck-operator"
SNAPSHOT = "true"
DOCKER_IMAGE_NO_TAG = "docker.elastic.co/${REPOSITORY}/${IMG_NAME}"
}

stages {
stage('Run unit and integration tests') {
steps {
sh 'make -C build/ci ci-pr'
}
}
stage('Build and push Docker image') {
steps {
sh """
export VERSION=\$(cat $WORKSPACE/operators/VERSION)-\$(date +%F)-\$(git rev-parse --short --verify HEAD)
export OPERATOR_IMAGE=${REGISTRY}/${REPOSITORY}/${IMG_NAME}:\$VERSION
make -C build/ci ci-release
"""
}
}
}

post {
success {
script {
def version = sh(returnStdout: true, script: 'cat $WORKSPACE/operators/VERSION')
def hash = sh(returnStdout: true, script: 'git rev-parse --short --verify HEAD')
def date = new Date()
def image = env.DOCKER_IMAGE_NO_TAG + ":" + version + "-" + date.format("yyyy-MM-dd") + "-" + hash
currentBuild.description = image
artemnikitin marked this conversation as resolved.
Show resolved Hide resolved

build job: 'cloud-on-k8s-versions-gke',
parameters: [string(name: 'IMAGE', value: image)],
wait: false
}
}
cleanup {
cleanWs()
}
}

}