| |
@@ -0,0 +1,322 @@
|
| |
+ {-|
|
| |
+ To compute the jobs.yaml run: make render
|
| |
+ -}
|
| |
+ let FZCI = ../package.dhall
|
| |
+
|
| |
+ let Zuul = FZCI.Zuul
|
| |
+
|
| |
+ let Prelude = FZCI.Prelude
|
| |
+
|
| |
+ let --| When setting a custom prefix, redirect the output to a new file to preserve the existing job definition
|
| |
+ job-prefix =
|
| |
+ env:JOB_PREFIX as Text ? ""
|
| |
+
|
| |
+ let Branches = FZCI.Branches
|
| |
+
|
| |
+ let Arches = FZCI.Arches
|
| |
+
|
| |
+ let Nodesets = FZCI.Nodesets
|
| |
+
|
| |
+ let KojiBuild =
|
| |
+ let Union = < Scratch | Final >
|
| |
+
|
| |
+ let eq_def = { Scratch = False, Final = False }
|
| |
+
|
| |
+ in { Type = Union
|
| |
+ , all = [ Union.Scratch, Union.Final ]
|
| |
+ , isScratch = λ(kb : Union) → merge (eq_def ⫽ { Scratch = True }) kb
|
| |
+ , show =
|
| |
+ λ(kb : Union) → merge { Scratch = "scratch", Final = "final" } kb
|
| |
+ }
|
| |
+
|
| |
+ let generateRpmBuildJobName
|
| |
+ : Arches.Type → KojiBuild.Type → Text
|
| |
+ = λ(arch : Arches.Type) →
|
| |
+ λ(kbtype : KojiBuild.Type) →
|
| |
+ let suffix =
|
| |
+ if Arches.isX86_64 arch then "" else "-" ++ Arches.show arch
|
| |
+
|
| |
+ let name =
|
| |
+ if KojiBuild.isScratch kbtype
|
| |
+ then "rpm-scratch-build" ++ suffix
|
| |
+ else "rpm-build"
|
| |
+
|
| |
+ in job-prefix ++ name
|
| |
+
|
| |
+ let Arch =
|
| |
+ Arches
|
| |
+ ⫽ { extras =
|
| |
+ Prelude.List.filter
|
| |
+ Arches.Type
|
| |
+ (λ(arch : Arches.Type) → Prelude.Bool.not (Arches.isX86_64 arch))
|
| |
+ Arches.fedora
|
| |
+ , scratch-job-names =
|
| |
+ Prelude.List.map
|
| |
+ Arches.Type
|
| |
+ Text
|
| |
+ ( λ(arch : Arches.Type) →
|
| |
+ generateRpmBuildJobName arch KojiBuild.Type.Scratch
|
| |
+ )
|
| |
+ }
|
| |
+
|
| |
+ let executor_nodeset = Zuul.Nodeset.Inline Zuul.Nodeset.empty
|
| |
+
|
| |
+ let default_nodeset = Nodesets.getName Nodesets.Type.Fedora-34-Container
|
| |
+
|
| |
+ let check_for_tests =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}check-for-tests"
|
| |
+ , description = Some "Check the project has a tests/tests.yml"
|
| |
+ , branches = Some Branches.allText
|
| |
+ , run = Some "playbooks/rpm/check-for-tests.yaml"
|
| |
+ , nodeset = Some executor_nodeset
|
| |
+ }
|
| |
+
|
| |
+ let check_for_sti_tests =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}check-for-sti-tests"
|
| |
+ , description = Some "Check the project has a tests/tests.yml"
|
| |
+ , branches = Some Branches.allText
|
| |
+ , run = Some "playbooks/rpm/check-for-sti-tests.yaml"
|
| |
+ , nodeset = Some executor_nodeset
|
| |
+ }
|
| |
+
|
| |
+ let check_for_fmf_tests =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}check-for-fmf-tests"
|
| |
+ , description = Some "Check the project has a .fmf directory"
|
| |
+ , branches = Some Branches.allText
|
| |
+ , run = Some "playbooks/rpm/check-for-fmf-tests.yaml"
|
| |
+ , nodeset = Some executor_nodeset
|
| |
+ }
|
| |
+
|
| |
+ let check_for_arches =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}check-for-arches"
|
| |
+ , description = Some "Check the packages needs arches builds"
|
| |
+ , branches = Some Branches.allText
|
| |
+ , run = Some "playbooks/rpm/check-for-arches.yaml"
|
| |
+ , vars = Some
|
| |
+ ( Zuul.Vars.object
|
| |
+ ( toMap
|
| |
+ { arch_jobs =
|
| |
+ Zuul.Vars.array
|
| |
+ ( Prelude.List.map
|
| |
+ Text
|
| |
+ Zuul.Vars.Type
|
| |
+ Zuul.Vars.string
|
| |
+ (Arch.scratch-job-names Arch.extras)
|
| |
+ )
|
| |
+ , check_for_arches_ignore = Zuul.Vars.bool False
|
| |
+ }
|
| |
+ )
|
| |
+ )
|
| |
+ , nodeset = Some default_nodeset
|
| |
+ }
|
| |
+
|
| |
+ let clean_stalled_koji_tasks =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}clean-stalled-koji-tasks"
|
| |
+ , protected = Some True
|
| |
+ , description = Some "Cancel Koji tasks running for more than 12 hours"
|
| |
+ , nodeset = Some default_nodeset
|
| |
+ , roles = Some [ { zuul = "zuul-distro-jobs" } ]
|
| |
+ , run = Some "playbooks/koji/clean-stalled-koji-tasks.yaml"
|
| |
+ , secrets = Some
|
| |
+ [ Zuul.Job.Secret::{ name = "krb_keytab", secret = "krb_keytab" } ]
|
| |
+ }
|
| |
+
|
| |
+ let common_koji_rpm_build =
|
| |
+ Zuul.Job::{
|
| |
+ , name = "${job-prefix}common-koji-rpm-build"
|
| |
+ , abstract = Some True
|
| |
+ , protected = Some True
|
| |
+ , description = Some "Base job for RPM build on Fedora Koji"
|
| |
+ , timeout = Some 21600
|
| |
+ , nodeset = Some (Nodesets.getName Nodesets.Type.Fedora-35-Container)
|
| |
+ , roles = Some [ { zuul = "zuul-distro-jobs" } ]
|
| |
+ , run = Some "playbooks/koji/build-ng.yaml"
|
| |
+ , secrets = Some
|
| |
+ [ Zuul.Job.Secret::{ name = "krb_keytab", secret = "krb_keytab" } ]
|
| |
+ }
|
| |
+
|
| |
+ let setVars =
|
| |
+ λ(target : Text) →
|
| |
+ λ(release : Text) →
|
| |
+ λ(arch : Text) →
|
| |
+ λ(scratch_build : Bool) →
|
| |
+ λ(fetch_artifacts : Bool) →
|
| |
+ let basevars =
|
| |
+ toMap
|
| |
+ { fetch_artifacts = Zuul.Vars.bool fetch_artifacts
|
| |
+ , scratch_build = Zuul.Vars.bool scratch_build
|
| |
+ , target = Zuul.Vars.string target
|
| |
+ , release = Zuul.Vars.string release
|
| |
+ }
|
| |
+
|
| |
+ let vars =
|
| |
+ if scratch_build
|
| |
+ then basevars
|
| |
+ # [ { mapKey = "arches", mapValue = Zuul.Vars.string arch }
|
| |
+ ]
|
| |
+ else basevars
|
| |
+
|
| |
+ in Zuul.Vars.object vars
|
| |
+
|
| |
+ let doFetchArtifact
|
| |
+ : Arch.Type → KojiBuild.Type → Bool
|
| |
+ = λ(arch : Arch.Type) →
|
| |
+ λ(kb : KojiBuild.Type) →
|
| |
+ Arch.isX86_64 arch && KojiBuild.isScratch kb
|
| |
+
|
| |
+ let generateRpmBuildJob =
|
| |
+ λ(kbtype : KojiBuild.Type) →
|
| |
+ λ(branch : Branches.Type) →
|
| |
+ λ(arch : Arch.Type) →
|
| |
+ Zuul.Job::{
|
| |
+ , name = generateRpmBuildJobName arch kbtype
|
| |
+ , parent = Some (Zuul.Job.getName common_koji_rpm_build)
|
| |
+ , final = Some True
|
| |
+ , provides =
|
| |
+ if Arch.isX86_64 arch && KojiBuild.isScratch kbtype
|
| |
+ then Some [ "${job-prefix}repo" ]
|
| |
+ else None (List Text)
|
| |
+ , dependencies =
|
| |
+ if Arch.isX86_64 arch
|
| |
+ then None (List Zuul.Job.Dependency.Union)
|
| |
+ else Some
|
| |
+ [ Zuul.Job.Dependency.Name "${job-prefix}check-for-arches" ]
|
| |
+ , branches = Branches.zuulBranch branch
|
| |
+ , vars = Some
|
| |
+ ( setVars
|
| |
+ (Branches.target branch)
|
| |
+ (Branches.show branch)
|
| |
+ (Arch.show arch)
|
| |
+ (KojiBuild.isScratch kbtype)
|
| |
+ (doFetchArtifact arch kbtype)
|
| |
+ )
|
| |
+ }
|
| |
+
|
| |
+ let generateRpmBuildJobs
|
| |
+ : KojiBuild.Type → List Zuul.Job.Type
|
| |
+ = λ(kbtype : KojiBuild.Type) →
|
| |
+ let forBranch =
|
| |
+ λ(branch : Branches.Type) →
|
| |
+ Prelude.List.map
|
| |
+ Arch.Type
|
| |
+ Zuul.Job.Type
|
| |
+ (generateRpmBuildJob kbtype branch)
|
| |
+ ( if KojiBuild.isScratch kbtype
|
| |
+ then Branches.arches branch
|
| |
+ else [ Arch.Type.X86_64 ]
|
| |
+ )
|
| |
+
|
| |
+ in Prelude.List.concatMap
|
| |
+ Branches.Type
|
| |
+ Zuul.Job.Type
|
| |
+ forBranch
|
| |
+ Branches.all
|
| |
+
|
| |
+ let getTestingFarmJobVars =
|
| |
+ λ(branch : Branches.Type) →
|
| |
+ λ(ttype : Text) →
|
| |
+ let name =
|
| |
+ merge
|
| |
+ { Rawhide = "Fedora-Rawhide"
|
| |
+ , F34 = "Fedora-34"
|
| |
+ , F35 = "Fedora-35"
|
| |
+ , F36 = "Fedora-36"
|
| |
+ , Epel8 = "CentOS-Stream-8"
|
| |
+ }
|
| |
+ branch
|
| |
+
|
| |
+ let distro =
|
| |
+ merge
|
| |
+ { Rawhide = "fedora-rawhide"
|
| |
+ , F34 = "fedora-34"
|
| |
+ , F35 = "fedora-35"
|
| |
+ , F36 = "fedora-36"
|
| |
+ , Epel8 = "centos-stream-8"
|
| |
+ }
|
| |
+ branch
|
| |
+
|
| |
+ in Zuul.Vars.object
|
| |
+ [ { mapKey = "compose", mapValue = Zuul.Vars.string name }
|
| |
+ , { mapKey = "distro", mapValue = Zuul.Vars.string distro }
|
| |
+ , { mapKey = "test_type", mapValue = Zuul.Vars.string ttype }
|
| |
+ ]
|
| |
+
|
| |
+ let generateSTITestsJob =
|
| |
+ λ(branch : Branches.Type) →
|
| |
+ Zuul.Job::{
|
| |
+ , name = "rpm-sti-test"
|
| |
+ , description = Some "Running sti test on Testing Farm"
|
| |
+ , final = Some True
|
| |
+ , branches = Branches.zuulBranch branch
|
| |
+ , roles = Some
|
| |
+ [ { zuul = "zuul-distro-jobs" }, { zuul = "fedora-zuul-jobs" } ]
|
| |
+ , timeout = Some 21600
|
| |
+ , nodeset = Some default_nodeset
|
| |
+ , requires = Some [ "repo" ]
|
| |
+ , secrets = Some
|
| |
+ [ Zuul.Job.Secret::{
|
| |
+ , name = "testing_farm_zuul_ci_key"
|
| |
+ , secret = "testing_farm_zuul_ci_key"
|
| |
+ }
|
| |
+ ]
|
| |
+ , run = Some "playbooks/testing-farm/run.yaml"
|
| |
+ , post-run = Some [ "playbooks/testing-farm/fetch.yaml" ]
|
| |
+ , vars = Some (getTestingFarmJobVars branch "sti")
|
| |
+ }
|
| |
+
|
| |
+ let generateSTITestsJobs =
|
| |
+ Prelude.List.map
|
| |
+ Branches.Type
|
| |
+ Zuul.Job.Type
|
| |
+ generateSTITestsJob
|
| |
+ Branches.all
|
| |
+
|
| |
+ let generateTMTTestsJob =
|
| |
+ λ(branch : Branches.Type) →
|
| |
+ Zuul.Job::{
|
| |
+ , name = "rpm-tmt-test"
|
| |
+ , description = Some "Running fmf test on Testing Farm"
|
| |
+ , final = Some True
|
| |
+ , branches = Branches.zuulBranch branch
|
| |
+ , roles = Some
|
| |
+ [ { zuul = "zuul-distro-jobs" }, { zuul = "fedora-zuul-jobs" } ]
|
| |
+ , timeout = Some 21600
|
| |
+ , nodeset = Some default_nodeset
|
| |
+ , requires = Some [ "repo" ]
|
| |
+ , secrets = Some
|
| |
+ [ Zuul.Job.Secret::{
|
| |
+ , name = "testing_farm_zuul_ci_key"
|
| |
+ , secret = "testing_farm_zuul_ci_key"
|
| |
+ }
|
| |
+ ]
|
| |
+ , run = Some "playbooks/testing-farm/run.yaml"
|
| |
+ , post-run = Some [ "playbooks/testing-farm/fetch.yaml" ]
|
| |
+ , vars = Some (getTestingFarmJobVars branch "fmf")
|
| |
+ }
|
| |
+
|
| |
+ let generateTMTTestsJobs =
|
| |
+ Prelude.List.map
|
| |
+ Branches.Type
|
| |
+ Zuul.Job.Type
|
| |
+ generateTMTTestsJob
|
| |
+ Branches.all
|
| |
+
|
| |
+ let Jobs =
|
| |
+ [ clean_stalled_koji_tasks
|
| |
+ , check_for_tests
|
| |
+ , check_for_sti_tests
|
| |
+ , check_for_fmf_tests
|
| |
+ , check_for_arches
|
| |
+ , common_koji_rpm_build
|
| |
+ ]
|
| |
+ # generateRpmBuildJobs KojiBuild.Type.Scratch
|
| |
+ # generateRpmBuildJobs KojiBuild.Type.Final
|
| |
+ # generateTMTTestsJobs
|
| |
+ # generateSTITestsJobs
|
| |
+
|
| |
+ in Zuul.Job.wrap Jobs
|
| |