From 0493747f5d1b30008b4170b3d48080abfa224700 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Tue, 24 Oct 2017 18:27:27 -0600 Subject: make it work for all 4 git branches --- jjb/yaml/deploy-branch.yaml | 43 +++++++++++++ jjb/yaml/deploy-dev-env.yaml | 33 ---------- jjb/yaml/openbook-all-pipeline.yaml | 116 +++++++++++++++++++---------------- jjb/yaml/openbook-core-pipeline.yaml | 88 ++++++++++++++------------ jjb/yaml/openbook-pipeline.yaml | 114 ++++++++++++++++++++++++++++++---- 5 files changed, 256 insertions(+), 138 deletions(-) create mode 100644 jjb/yaml/deploy-branch.yaml delete mode 100644 jjb/yaml/deploy-dev-env.yaml (limited to 'jjb') diff --git a/jjb/yaml/deploy-branch.yaml b/jjb/yaml/deploy-branch.yaml new file mode 100644 index 0000000..a8a3746 --- /dev/null +++ b/jjb/yaml/deploy-branch.yaml @@ -0,0 +1,43 @@ +--- +- project: + name: "deploy-branch" + branch: + - "unstable" + - "develop" + - "stage" + - "master" + jobs: + - "deploy-branch-{branch}" + +- job-template: + name: "deploy-branch-{branch}" + project-type: freestyle + node: openbook_v4 + properties: + - build-discarder: + days-to-keep: 0 + num-to-keep: 1 + artifact-days-to-keep: 0 + - build-blocker: + use-build-blocker: true + blocking-jobs: + - ".*-pipeline" + block_level: 'GLOBAL' + queue-scanning: 'BUILDABLE' + triggers: + - reverse: + jobs: + - "admin-api-server-{branch}-pipeline" + - "admin-web-ui-{branch}-pipeline" + - "customer-api-server-{branch}-pipeline" + - "customer-web-ui-{branch}-pipeline" + - "job-scheduler-server-{branch}-pipeline" + - "workflow-server-{branch}-pipeline" + scm: + - git: + url: git@github.com:Talligent/openbook-v4-installer.git + branches: + - master + builders: + - shell: | + ./deploy-branch.sh {branch} diff --git a/jjb/yaml/deploy-dev-env.yaml b/jjb/yaml/deploy-dev-env.yaml deleted file mode 100644 index 8172369..0000000 --- a/jjb/yaml/deploy-dev-env.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- job: - name: deploy-dev-env - project-type: freestyle - node: openbook_v4 - properties: - - build-discarder: - days-to-keep: 0 - num-to-keep: 1 - artifact-days-to-keep: 0 - - build-blocker: - use-build-blocker: true - blocking-jobs: - - ".*-pipeline" - block_level: 'GLOBAL' - queue-scanning: 'BUILDABLE' - triggers: - - reverse: - jobs: - - "admin-api-server-pipeline" - - "admin-web-ui-pipeline" - - "customer-api-server-pipeline" - - "customer-web-ui-pipeline" - - "job-scheduler-server-pipeline" - - "workflow-server-pipeline" - scm: - - git: - url: git@github.com:Talligent/openbook-v4-installer.git - branches: - - master - builders: - - shell: | - ./deploy-dev-env.sh diff --git a/jjb/yaml/openbook-all-pipeline.yaml b/jjb/yaml/openbook-all-pipeline.yaml index 1c5fbca..42ed780 100644 --- a/jjb/yaml/openbook-all-pipeline.yaml +++ b/jjb/yaml/openbook-all-pipeline.yaml @@ -1,60 +1,70 @@ --- -- job: - name: openbook-all-pipeline +- project: + name: "openbook-all-pipeline" + branch: + - "unstable" + - "develop" + - "stage" + - "master" + jobs: + - "openbook-all-{branch}-pipeline" + +- job-template: + name: "openbook-all-{branch}-pipeline" project-type: pipeline dsl: | - pipeline { - agent { - node { + pipeline {{ + agent {{ + node {{ label "master" - } - } - stages { - stage("checkout") { - agent { - node { + }} + }} + stages {{ + stage("checkout") {{ + agent {{ + node {{ label "openbook_v4" customWorkspace "workspace/openbook-all" - } - } - steps { - git(poll: false, branch: "unstable", url: "git@github.com:Talligent/openbook-core.git") - } - } - stage("database") { - steps { + }} + }} + steps {{ + git(poll: false, branch: "{branch}", url: "git@github.com:Talligent/openbook-core.git") + }} + }} + stage("database") {{ + steps {{ build(job: "openbook-database") - } - } - stage("admin-api-server") { - steps { - build(job: "admin-api-server-pipeline") - } - } - stage("customer-api-server") { - steps { - build(job: "customer-api-server-pipeline") - } - } - stage("admin-web-ui") { - steps { - build(job: "admin-web-ui-pipeline") - } - } - stage("customer-web-ui") { - steps { - build(job: "customer-web-ui-pipeline") - } - } - stage("job-scheduler-server") { - steps { - build(job: "job-scheduler-server-pipeline") - } - } - stage("workflow-server") { - steps { - build(job: "workflow-server-pipeline") - } - } - } - } + }} + }} + stage("admin-api-server") {{ + steps {{ + build(job: "admin-api-server-{branch}-pipeline") + }} + }} + stage("customer-api-server") {{ + steps {{ + build(job: "customer-api-server-{branch}-pipeline") + }} + }} + stage("admin-web-ui") {{ + steps {{ + build(job: "admin-web-ui-{branch}-pipeline") + }} + }} + stage("customer-web-ui") {{ + steps {{ + build(job: "customer-web-ui-{branch}-pipeline") + }} + }} + stage("job-scheduler-server") {{ + steps {{ + build(job: "job-scheduler-server-{branch}-pipeline") + }} + }} + stage("workflow-server") {{ + steps {{ + build(job: "workflow-server-{branch}-pipeline") + }} + }} + }} + }} diff --git a/jjb/yaml/openbook-core-pipeline.yaml b/jjb/yaml/openbook-core-pipeline.yaml index 7a4da87..d92b605 100644 --- a/jjb/yaml/openbook-core-pipeline.yaml +++ b/jjb/yaml/openbook-core-pipeline.yaml @@ -1,45 +1,55 @@ --- -- job: - name: openbook-core-pipeline +- project: + name: "openbook-core-pipeline" + branch: + - "unstable" + - "develop" + - "stage" + - "master" + jobs: + - "openbook-core-{branch}-pipeline" + +- job-template: + name: "openbook-core-{branch}-pipeline" project-type: pipeline dsl: | - pipeline { - agent { - node { + pipeline {{ + agent {{ + node {{ label "master" - } - } - stages { - stage("checkout") { - agent { - node { + }} + }} + stages {{ + stage("checkout") {{ + agent {{ + node {{ label "openbook_v4" customWorkspace "workspace/openbook-core" - } - } - steps { - git(branch: "unstable", url: "git@github.com:Talligent/openbook-core.git") - } - } - stage("admin-api-server") { - steps { - build(job: "admin-api-server-pipeline") - } - } - stage("customer-api-server") { - steps { - build(job: "customer-api-server-pipeline") - } - } - stage("job-scheduler-server") { - steps { - build(job: "job-scheduler-server-pipeline") - } - } - stage("workflow-server") { - steps { - build(job: "workflow-server-pipeline") - } - } - } - } + }} + }} + steps {{ + git(branch: "{branch}", url: "git@github.com:Talligent/openbook-core.git") + }} + }} + stage("admin-api-server") {{ + steps {{ + build(job: "admin-api-server-{branch}-pipeline") + }} + }} + stage("customer-api-server") {{ + steps {{ + build(job: "customer-api-server-{branch}-pipeline") + }} + }} + stage("job-scheduler-server") {{ + steps {{ + build(job: "job-scheduler-server-{branch}-pipeline") + }} + }} + stage("workflow-server") {{ + steps {{ + build(job: "workflow-server-{branch}-pipeline") + }} + }} + }} + }} diff --git a/jjb/yaml/openbook-pipeline.yaml b/jjb/yaml/openbook-pipeline.yaml index 5fcfbbe..c379af5 100644 --- a/jjb/yaml/openbook-pipeline.yaml +++ b/jjb/yaml/openbook-pipeline.yaml @@ -1,18 +1,106 @@ --- - project: name: "openbook-pipeline" - artifact: - - "admin-api-server" - - "admin-web-ui" - - "customer-api-server" - - "customer-web-ui" - - "job-scheduler-server" - - "workflow-server" jobs: - - "{artifact}-pipeline" + - "{artifact}-{branch}-pipeline": + artifact: "admin-api-server" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "admin-api-server" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "admin-api-server" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "admin-api-server" + branch: "master" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "admin-web-ui" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "admin-web-ui" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "admin-web-ui" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "admin-web-ui" + branch: "master" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-api-server" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "customer-api-server" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-api-server" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-api-server" + branch: "master" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-web-ui" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "customer-web-ui" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-web-ui" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "customer-web-ui" + branch: "master" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "job-scheduler-server" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "job-scheduler-server" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "job-scheduler-server" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "job-scheduler-server" + branch: "master" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "workflow-server" + branch: "unstable" + tag: "4.1" + - "{artifact}-{branch}-pipeline": + artifact: "workflow-server" + branch: "develop" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "workflow-server" + branch: "stage" + tag: "4.0" + - "{artifact}-{branch}-pipeline": + artifact: "workflow-server" + branch: "master" + tag: "4.0" - job-template: - name: "{artifact}-pipeline" + name: "{artifact}-{branch}-pipeline" project-type: pipeline dsl: | pipeline {{ @@ -25,8 +113,8 @@ stages {{ stage("gradle") {{ steps {{ - git(branch: "unstable", url: "git@github.com:Talligent/{artifact}.git") - sh(script: "/var/lib/jenkins/find_next_tag.sh \$(pwd) {artifact} 4.1") + git(branch: "{branch}", url: "git@github.com:Talligent/{artifact}.git") + sh(script: "/var/lib/jenkins/find_next_tag.sh \$(pwd) {artifact} {tag}") sh(script: "./gradlew -PbuildNumber=\$(cat /tmp/newtag_{artifact}) -PbuildMode=buildProd -Dorg.gradle.daemon=false clean shadowJar") stash(includes: "build/libs/*.jar", name: "jar") }} @@ -35,13 +123,13 @@ steps {{ git(poll: false, branch: "master", url: "git@github.com:Talligent/deployment-scripts.git") unstash(name: "jar") - sh(script: "ruby openbook/ruby/upload_jar.rb --webdav-url=${{WEBDAV_URL}} --webdav-username=${{WEBDAV_USERNAME}} --webdav-password=${{WEBDAV_PASSWORD}} --artifact={artifact} --version=\$(cat /tmp/newtag_{artifact}) --filepath=build/libs/{artifact}.\$(cat /tmp/newtag_{artifact}).jar") + sh(script: "ruby openbook/ruby/upload_jar.rb --webdav-url=${{WEBDAV_URL}} --webdav-username=${{WEBDAV_USERNAME}} --webdav-password=${{WEBDAV_PASSWORD}} --artifact={artifact} --branch={branch} --version=\$(cat /tmp/newtag_{artifact}) --filepath=build/libs/{artifact}.\$(cat /tmp/newtag_{artifact}).jar") }} }} stage("docker-container") {{ steps {{ git(poll: false, branch: "master", url: "git@github.com:Talligent/openbook-v4-ci.git") - sh(script: "./build-docker-containers.sh {artifact}") + sh(script: "./build-docker-containers.sh {artifact} {branch}") }} }} }} -- cgit v1.3