From c958bf63f6f2df9b3a5a748691bc49b9dde72eeb Mon Sep 17 00:00:00 2001 From: jamesflukeworkshoporg Date: Fri, 8 Mar 2024 16:19:08 +0000 Subject: [PATCH] updating jamesflukeworkshoporg/ops-controller bundle for bundle-provision --- bundle/bundle.yaml | 2 +- bundle/items.yaml | 36 +++++++++++++++++++++++++++++++++++ bundle/jcasc/credentials.yaml | 9 +++++++++ bundle/jcasc/jenkins.yaml | 4 ++-- controller-provision | 21 ++++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 controller-provision diff --git a/bundle/bundle.yaml b/bundle/bundle.yaml index 1e0f09b..6231711 100644 --- a/bundle/bundle.yaml +++ b/bundle/bundle.yaml @@ -1,5 +1,5 @@ apiVersion: "1" -version: "4" +version: "5" id: "jamesflukeworkshoporg-ops-controller" description: "CloudBees CI configuration bundle for the jamesflukeworkshoporg ops-controller Controller" parent: "base" diff --git a/bundle/items.yaml b/bundle/items.yaml index a2bd0e7..a513753 100644 --- a/bundle/items.yaml +++ b/bundle/items.yaml @@ -13,6 +13,42 @@ items: - org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject filter: true items: + - kind: organizationFolder + name: controller-provision + disabled: false + navigators: + - github: + apiUri: https://api.github.com + traits: + - gitHubBranchDiscovery: + strategyId: 1 + - headWildcardFilter: + excludes: '' + includes: main + repoOwner: ${GITHUB_ORGANIZATION} + credentialsId: cloudbees-ci-casc-workshop-github-app + projectFactories: + - customMultiBranchProjectFactory: + factory: + customBranchProjectFactory: + marker: controller.yaml + definition: + cpsScmFlowDefinition: + scriptPath: controller-provision + scm: + gitSCM: + userRemoteConfigs: + - userRemoteConfig: + credentialsId: cloudbees-ci-casc-workshop-github-app + url: https://github.com/${GITHUB_ORGANIZATION}/ops-controller.git + branches: + - branchSpec: + name: '*/main' + lightweight: true + properties: + - suppressFolderAutomaticTriggering: + strategy: INDEXING + branches: .* - kind: organizationFolder name: controller-casc-update disabled: false diff --git a/bundle/jcasc/credentials.yaml b/bundle/jcasc/credentials.yaml index f8f4dee..1280479 100644 --- a/bundle/jcasc/credentials.yaml +++ b/bundle/jcasc/credentials.yaml @@ -1,4 +1,13 @@ credentials: + restrictedSystem: + domainCredentials: + - allowList: "controller-jobs/controller-provision/**/main" + credentials: + string: + description: "CasC Workshop Controller Provision Secret" + id: "casc-workshop-controller-provision-secret" + scope: GLOBAL + secret: "${cbciCascWorkshopControllerProvisionSecret}" system: domainCredentials: - credentials: diff --git a/bundle/jcasc/jenkins.yaml b/bundle/jcasc/jenkins.yaml index 55e9862..60d48a1 100644 --- a/bundle/jcasc/jenkins.yaml +++ b/bundle/jcasc/jenkins.yaml @@ -10,7 +10,7 @@ jenkins: value: "${GITHUB_USER}" - key: "BUNDLE_ID" value: "${CASC_BUNDLE_ID}" - systemMessage: 'Jenkins configured using CloudBees CI CasC with controller overrides' + systemMessage: 'Jenkins configured using CloudBees CI CasC with controller overrides v2' unclassified: globallibraries: libraries: @@ -24,4 +24,4 @@ unclassified: repoOwner: "${GITHUB_ORGANIZATION}" repository: "pipeline-library" headerLabel: - text: "${GITHUB_APP}-bundle-v4" + text: "${GITHUB_APP}-bundle-v5" diff --git a/controller-provision b/controller-provision new file mode 100644 index 0000000..adc512e --- /dev/null +++ b/controller-provision @@ -0,0 +1,21 @@ +library 'pipeline-library' +pipeline { + agent any + options { + timeout(time: 10, unit: 'MINUTES') + } + stages { + stage('Publish Provision Controller Event') { + when { + branch 'main' + } + environment { PROVISION_SECRET = credentials('casc-workshop-controller-provision-secret') } + steps { + gitHubParseOriginUrl() + publishEvent event:jsonEvent(""" + {'controller':{'name':'${GITHUB_REPO}','action':'provision'},'github':{'organization':'${GITHUB_ORG}','repository':'${GITHUB_REPO}','user':'${GITHUB_USER}'},'secret':'${PROVISION_SECRET}'} + """), verbose: true + } + } + } +}