diff --git a/.ci/jobs/gke-e2e-versions.yml b/.ci/jobs/gke-e2e-versions.yml index 58c220917a..10f9c49566 100644 --- a/.ci/jobs/gke-e2e-versions.yml +++ b/.ci/jobs/gke-e2e-versions.yml @@ -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: diff --git a/.ci/jobs/nightly.yml b/.ci/jobs/nightly.yml new file mode 100644 index 0000000000..ebbb5b21b2 --- /dev/null +++ b/.ci/jobs/nightly.yml @@ -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 diff --git a/build/ci/e2e/GKE_k8s_versions.jenkinsfile b/build/ci/e2e/GKE_k8s_versions.jenkinsfile index 0df4eca802..567c828ba5 100644 --- a/build/ci/e2e/GKE_k8s_versions.jenkinsfile +++ b/build/ci/e2e/GKE_k8s_versions.jenkinsfile @@ -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 { @@ -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") { @@ -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") { @@ -52,7 +54,7 @@ pipeline { } steps { checkout scm - sh 'make -C build/ci ci-e2e' + sh 'make -C build/ci ci-e2e-rc' } } } diff --git a/build/ci/nightly/Jenkinsfile b/build/ci/nightly/Jenkinsfile new file mode 100644 index 0000000000..9d7b616423 --- /dev/null +++ b/build/ci/nightly/Jenkinsfile @@ -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 + + build job: 'cloud-on-k8s-versions-gke', + parameters: [string(name: 'IMAGE', value: image)], + wait: false + } + } + cleanup { + cleanWs() + } + } + +}