diff --git a/hosts/azure/jenkins-controller/configuration.nix b/hosts/azure/jenkins-controller/configuration.nix index 8d512ef6..01cd2d38 100644 --- a/hosts/azure/jenkins-controller/configuration.nix +++ b/hosts/azure/jenkins-controller/configuration.nix @@ -137,45 +137,6 @@ in # Increase the number of rows shown in Stage View (default is 10) "-Dcom.cloudbees.workflow.rest.external.JobExt.maxRunsPerJob=32" ]; - - # Configure jenkins job(s): - # https://jenkins-job-builder.readthedocs.io/en/latest/project_pipeline.html - # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/continuous-integration/jenkins/job-builder.nix - jobBuilder = { - enable = true; - nixJobs = - lib.mapAttrsToList - (display-name: script: { - job = { - inherit display-name; - name = script; - project-type = "pipeline"; - concurrent = true; - pipeline-scm = { - script-path = "${script}.groovy"; - lightweight-checkout = true; - scm = [ - { - git = { - url = "https://github.com/tiiuae/ghaf-jenkins-pipeline.git"; - clean = true; - branches = [ "*/main" ]; - }; - } - ]; - }; - }; - }) - { - "Ghaf main pipeline" = "ghaf-main-pipeline"; - "Ghaf pre-merge pipeline" = "ghaf-pre-merge-pipeline"; - "Ghaf nightly pipeline" = "ghaf-nightly-pipeline"; - "Ghaf release pipeline" = "ghaf-release-pipeline"; - "Ghaf HW test" = "ghaf-hw-test"; - "Ghaf parallel HW test" = "ghaf-parallel-hw-test"; - "FMO OS main pipeline" = "fmo-os-main-pipeline"; - }; - }; }; systemd.services.jenkins.serviceConfig = { @@ -230,10 +191,15 @@ in '' # Install plugins jenkins-cli ${jenkins-auth} install-plugin \ - "workflow-aggregator" "github" "timestamper" "pipeline-stage-view" "blueocean" \ - "pipeline-graph-view" "github-pullrequest" "antisamy-markup-formatter" \ - "configuration-as-code" "slack" "pipeline-utility-steps" "pipeline-build-step" \ - "robot" "copyartifact" + "configuration-as-code" "job-dsl" \ + "workflow-aggregator" "pipeline-utility-steps" "pipeline-build-step" \ + "github" "github-pullrequest" \ + "blueocean" "pipeline-stage-view" "pipeline-graph-view" \ + "timestamper" \ + "antisamy-markup-formatter" \ + "slack" \ + "robot" \ + "copyartifact" # Disable initial install jenkins-cli ${jenkins-auth} groovy = < ${jenkins-groovy} diff --git a/hosts/azure/jenkins-controller/jenkins-casc.yaml b/hosts/azure/jenkins-controller/jenkins-casc.yaml index 84c7a5ba..8ceeddd6 100644 --- a/hosts/azure/jenkins-controller/jenkins-casc.yaml +++ b/hosts/azure/jenkins-controller/jenkins-casc.yaml @@ -164,3 +164,163 @@ tool: mavenGlobalConfig: globalSettingsProvider: "standard" settingsProvider: "standard" +# https://github.com/jenkinsci/job-dsl-plugin +# https://jenkinsci.github.io/job-dsl-plugin +jobs: + - script: > + pipelineJob('ghaf-main-pipeline') { + displayName('Ghaf main pipeline') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-main-pipeline.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('ghaf-pre-merge-pipeline') { + displayName('Ghaf pre-merge pipeline') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-pre-merge-pipeline.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('ghaf-nightly-pipeline') { + displayName('Ghaf nightly pipeline') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-nightly-pipeline.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('ghaf-release-pipeline') { + displayName('Ghaf release pipeline') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-release-pipeline.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('ghaf-hw-test') { + displayName('Ghaf HW test') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-hw-test.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('ghaf-parallel-hw-test') { + displayName('Ghaf parallel HW test') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('ghaf-parallel-hw-test.groovy') + } + lightweight() + } + } + } + - script: > + pipelineJob('fmo-os-main-pipeline') { + displayName('FMO OS main_pipeline') + definition { + cpsScm { + scm { + git { + remote { + url('https://github.com/tiiuae/ghaf-jenkins-pipeline.git') + } + branch('*/main') + extensions { + cleanBeforeCheckout() + } + } + scriptPath('fmo-os-main-pipeline.groovy') + } + lightweight() + } + } + } + - script: > + queue('ghaf-main-pipeline') + - script: > + queue('ghaf-pre-merge-pipeline') + - script: > + queue('ghaf-nightly-pipeline') + - script: > + queue('ghaf-release-pipeline') + - script: > + queue('fmo-os-main-pipeline')