| |
@@ -24,43 +24,58 @@
|
| |
PAGURE_REPO_IS_FORK = "${env.GIT_REPO.contains('/forks/') ? 'true': 'false'}"
|
| |
}
|
| |
{% if "postmerge" not in job_vars.name %}
|
| |
- triggers {
|
| |
- ciBuildTrigger(
|
| |
- noSquash: true,
|
| |
- providerList: [
|
| |
- {% if "premerge" in job_vars.name %}
|
| |
- {% for topic in job_vars.messaging_fedmsg_topics %}
|
| |
- fedmsgSubscriber(
|
| |
- name: params.MESSAGING_FEDMSG_PROVIDER,
|
| |
- overrides: [topic: "{{ topic }}"],
|
| |
- checks: [
|
| |
- [field: '$.pullrequest.project.url_path', expectedValue: params.GIT_REPO.split('/')[3..-1].join('/').replace('forks/', 'fork/').replaceAll(/.git$/, '')],
|
| |
- [field: '$.pullrequest.branch', expectedValue: params.GIT_MAIN_BRANCH],
|
| |
- ]
|
| |
- ),
|
| |
- {% endfor %}
|
| |
- {% elif "job-updater" in job_vars.name %}
|
| |
- {% for topic in job_vars.messaging_fedmsg_topics %}
|
| |
- fedmsgSubscriber(
|
| |
- name: params.MESSAGING_FEDMSG_PROVIDER,
|
| |
- overrides: [topic: "{{ topic }}"],
|
| |
- checks: [
|
| |
- [field: '$.repo.url_path', expectedValue: "^${params.GIT_REPO.split('/')[3..-1].join('/').replace('forks/', 'fork/').replaceAll(/.git$/, '')}\$"],
|
| |
- [field: '$.branch', expectedValue: params.GIT_MAIN_BRANCH],
|
| |
- ]
|
| |
- )
|
| |
- {% endfor %}
|
| |
- {% endif %}
|
| |
- ]
|
| |
- )
|
| |
- }
|
| |
+ // pagure
|
| |
+ {% if "pagure" in c3i_git_repo %}
|
| |
+ triggers {
|
| |
+ ciBuildTrigger(
|
| |
+ noSquash: true,
|
| |
+ providerList: [
|
| |
+ {% if "premerge" in job_vars.name %}
|
| |
+ {% for topic in job_vars.messaging_fedmsg_topics %}
|
| |
+ fedmsgSubscriber(
|
| |
+ name: params.MESSAGING_FEDMSG_PROVIDER,
|
| |
+ overrides: [topic: "{{ topic }}"],
|
| |
+ checks: [
|
| |
+ [field: '$.pullrequest.project.url_path', expectedValue: params.GIT_REPO.split('/')[3..-1].join('/').replace('forks/', 'fork/').replaceAll(/.git$/, '')],
|
| |
+ [field: '$.pullrequest.branch', expectedValue: params.GIT_MAIN_BRANCH],
|
| |
+ ]
|
| |
+ ),
|
| |
+ {% endfor %}
|
| |
+ {% elif "job-updater" in job_vars.name %}
|
| |
+ {% for topic in job_vars.messaging_fedmsg_topics %}
|
| |
+ fedmsgSubscriber(
|
| |
+ name: params.MESSAGING_FEDMSG_PROVIDER,
|
| |
+ overrides: [topic: "{{ topic }}"],
|
| |
+ checks: [
|
| |
+ [field: '$.repo.url_path', expectedValue: "^${params.GIT_REPO.split('/')[3..-1].join('/').replace('forks/', 'fork/').replaceAll(/.git$/, '')}\$"],
|
| |
+ [field: '$.branch', expectedValue: params.GIT_MAIN_BRANCH],
|
| |
+ ]
|
| |
+ )
|
| |
+ {% endfor %}
|
| |
+ {% endif %}
|
| |
+ ]
|
| |
+ )
|
| |
+ }
|
| |
+ // gerrit trigger
|
| |
+ {% elif "gerrit" in c3i_git_repo %}
|
| |
+ triggers {
|
| |
+ gerrit customUrl: '',
|
| |
+ gerritProjects:
|
| |
+ [[branches: [[compareType: 'PLAIN', pattern: params.GIT_MAIN_BRANCH ]],
|
| |
+ compareType: 'ANT',
|
| |
+ disableStrictForbiddenFileVerification: false,
|
| |
+ pattern: env.GIT_REPO.split('/')[-1].replaceAll(/.git$/, '')]],
|
| |
+ serverName: env.GERRIT_SERVER_NAME,
|
| |
+ // there are variables in job-updater.yml and premerge.yml which change the value of trigger
|
| |
+ triggerOnEvents: [{{ job_vars.gerrit_trigger }}]
|
| |
+ }
|
| |
+ {% endif %}
|
| |
{% endif %}
|
| |
{% if c3i_trigger_update_only %}
|
| |
{% include "trigger-update-stages.groovy" %}
|
| |
{% else %}
|
| |
-
|
| |
stages {
|
| |
- stage('Proceeding CI_MESSAGE') {
|
| |
+ stage('Proceeding CI_MESSAGE from UMB') {
|
| |
when {
|
| |
expression { env.CI_MESSAGE }
|
| |
}
|
| |
@@ -73,7 +88,21 @@
|
| |
}
|
| |
}
|
| |
}
|
| |
- stage('Update Build Info') {
|
| |
+ stage('Proceeding Gerrit trigger') {
|
| |
+ when {
|
| |
+ expression { env.GERRIT_REFSPEC }
|
| |
+ }
|
| |
+ steps {
|
| |
+ script {
|
| |
+ // figure out how look the message when it is merged
|
| |
+ if (env.GERRIT_EVENT_TYPE == "patchset-created") {
|
| |
+ env.GIT_REPO_REF = env.GERRIT_REFSPEC
|
| |
+ env.PR_NO = env.GERRIT_CHANGE_NUMBER
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ stage('Clone git repo') {
|
| |
steps {
|
| |
script {
|
| |
if (!env.GIT_REPO_REF) {
|
| |
@@ -81,11 +110,17 @@
|
| |
}
|
| |
|
| |
// FIXME: Due to a bug described in https://issues.jenkins-ci.org/browse/JENKINS-45489
|
| |
- c3i.clone(repo: params.GIT_REPO,
|
| |
- branch: env.GIT_REPO_REF)
|
| |
+ c3i.clone(repo: params.GIT_REPO, branch: env.GIT_REPO_REF)
|
| |
env.GIT_COMMIT = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
| |
echo "Build ${env.GIT_REPO_REF}, commit=${env.GIT_COMMIT}"
|
| |
-
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ // this is not needed for Gerrit
|
| |
+ {% if "pagure" in c3i_git_repo %}
|
| |
+ stage('Update Build Info') {
|
| |
+ steps {
|
| |
+ script {
|
| |
// Set friendly display name and description
|
| |
def pagure_repo_home = env.GIT_REPO.replace('/forks/', '/fork/').replaceAll(/.git$/,'')
|
| |
{% if "premerge" in job_vars.name %}
|
| |
@@ -125,6 +160,10 @@
|
| |
}
|
| |
}
|
| |
}
|
| |
+ {% endif %}
|
| |
+ // Update jenkins files through oc command
|
| |
+ // run all jobs from templates/jobs directory
|
| |
+ // job updater is on the same lever as postmerge/premerge
|
| |
{% if "job-updater" in job_vars.name %}
|
| |
stage('Update pipeline jobs') {
|
| |
steps {
|
| |
@@ -135,7 +174,7 @@
|
| |
}
|
| |
}
|
| |
}
|
| |
- stage('Trigger postmerge') {
|
| |
+ stage('Trigger postmerge - build, test and upload container') {
|
| |
steps {
|
| |
script {
|
| |
openshift.withCluster() {
|
| |
@@ -181,8 +220,10 @@
|
| |
}
|
| |
}
|
| |
}
|
| |
-
|
| |
+ // run component snippet to run and test the component
|
| |
{{ task_var_build_and_test }}
|
| |
+
|
| |
+
|
| |
stage('Push container') {
|
| |
when {
|
| |
expression {
|
| |
@@ -225,6 +266,7 @@
|
| |
}
|
| |
stage('Triggering Tower deployment') {
|
| |
when {
|
| |
+ // env.GIT_REPO_REF == params.GIT_MAIN_BRANCH it means that this is a postmerge
|
| |
expression { env.GIT_REPO_REF == params.GIT_MAIN_BRANCH && params.TOWER_TEMPLATE_ID && params.TOWER_SECRET }
|
| |
}
|
| |
{% include "triggering-tower-steps.groovy" %}
|
| |