From aba9113c286d8cd064bcb856461a9a21b9e7ec79 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Aug 17 2018 23:26:07 +0000 Subject: Restore docs building even thought it doesn't make sense for now. --- diff --git a/openshift/sync2jira-dev-pipeline-template.yml b/openshift/sync2jira-dev-pipeline-template.yml index 2e0f3d0..225b30b 100644 --- a/openshift/sync2jira-dev-pipeline-template.yml +++ b/openshift/sync2jira-dev-pipeline-template.yml @@ -52,6 +52,15 @@ parameters: displayName: Container image for Jenkins slave pods required: true value: quay.io/factory2/sync2jira-jenkins-slave:latest +- name: PAGURE_DOC_REPO_NAME + displayName: namespace/project of Pagure doc repo for publishing docs + description: If not emptry and SYNC2JIRA_GIT_REF is master, docs will be published to the specified Pagure doc repo + required: false + value: sync2jira +- name: PAGURE_DOC_SECRET + displayName: Name of the OpenShift SSH secret for publishing docs to Pagure. + required: false + value: pagure-sync2jira-deploy-key - name: SYNC2JIRA_DEV_IMAGE_DESTINATIONS displayName: Comma seperated list of container repository/tag to which the built sync2jira dev image will be pushed description: OpenShift registries must be prefixed with 'atomic:' @@ -76,6 +85,10 @@ parameters: displayName: Whether to push the resulting image regardless of the Git branch value: "false" required: true +- name: FORCE_PUBLISH_DOCS + displayName: Whether to publish docs regardless of the Git branch + value: "false" + required: true - name: TAG_INTO_IMAGESTREAM displayName: Whether to tag the pushed image as dev value: "true" @@ -160,6 +173,8 @@ objects: value: "${SYNC2JIRA_DEV_IMAGE_DESTINATIONS}" - name: "FORCE_PUBLISH_IMAGE" value: "${FORCE_PUBLISH_IMAGE}" + - name: "FORCE_PUBLISH_DOCS" + value: "${FORCE_PUBLISH_DOCS}" - name: "TAG_INTO_IMAGESTREAM" value: "${TAG_INTO_IMAGESTREAM}" jenkinsfile: |- @@ -294,6 +309,50 @@ objects: stage('Build Artifacts') { failFast false parallel { + stage('Branch Docs') { + stages { + stage('Build Docs') { + steps { + sh 'make -C docs html' + } + post { + always { + archiveArtifacts artifacts: 'docs/_build/html/**' + } + } + } + stage('Publish Docs') { + when { + expression { + return "${PAGURE_DOC_REPO_NAME}" && (params.SYNC2JIRA_GIT_REF == "${SYNC2JIRA_MAIN_BRANCH}" || env.FORCE_PUBLISH_DOCS == "true") + } + } + steps { + sshagent (credentials: [env.PIPELINE_NAMESPACE + '-${PAGURE_DOC_SECRET}']) { + sh ''' + mkdir -p ~/.ssh/ + touch ~/.ssh/known_hosts + ssh-keygen -R pagure.io + echo 'pagure.io ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC198DWs0SQ3DX0ptu+8Wq6wnZMrXUCufN+wdSCtlyhHUeQ3q5B4Hgto1n2FMj752vToCfNTn9mWO7l2rNTrKeBsELpubl2jECHu4LqxkRVihu5UEzejfjiWNDN2jdXbYFY27GW9zymD7Gq3u+T/Mkp4lIcQKRoJaLobBmcVxrLPEEJMKI4AJY31jgxMTnxi7KcR+U5udQrZ3dzCn2BqUdiN5dMgckr4yNPjhl3emJeVJ/uhAJrEsgjzqxAb60smMO5/1By+yF85Wih4TnFtF4LwYYuxgqiNv72Xy4D/MGxCqkO/nH5eRNfcJ+AJFE7727F7Tnbo4xmAjilvRria/+l' >>~/.ssh/known_hosts + rm -rf docs-on-pagure + git clone ssh://git@pagure.io/docs/${PAGURE_DOC_REPO_NAME}.git docs-on-pagure + rm -rf docs-on-pagure/* + cp -r docs/_build/html/* docs-on-pagure/ + cd docs-on-pagure + git config user.name 'Pipeline Bot' + git config user.email "pipeline-bot@localhost.localdomain" + git add -A . + if [[ "$(git diff --cached --numstat | wc -l)" -eq 0 ]] ; then + exit 0 # No changes, nothing to commit + fi + git commit -m 'Automatic commit of docs built by Jenkins job ${env.JOB_NAME} #${env.BUILD_NUMBER}' + git push origin master + ''' + } + } + } + } + } stage('Build SRPM') { steps { sh './rpmbuild.sh -bs'