From 41f70f1cf447b83ac2497d8cfefd52c52bc2c936 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 22 2021 17:39:16 +0000 Subject: [PATCH 1/4] Generate jobs.yaml with dhall Depends-on: https://pagure.io/fedora-zuul-jobs-config/pull-request/100 --- diff --git a/zuul.d/dhall/nodesets.dhall b/zuul.d/dhall/nodesets.dhall new file mode 100644 index 0000000..c743195 --- /dev/null +++ b/zuul.d/dhall/nodesets.dhall @@ -0,0 +1,124 @@ +let Zuul = + ~/git/softwarefactory-project.io/software-factory/dhall-zuul/package.dhall + ? https://raw.githubusercontent.com/softwarefactory-project/dhall-zuul/master/package.dhall + +let Prelude = + https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e + +let Nodeset = + let Union = + < Fedora-Latest-Container + | Fedora-33-Container + | Fedora-32-Container + | Fedora-31-Container + | Fedora-30-Container + | Centos-8-Container + | Centos-7-Container + | Fedora-Rawhide-VM + | Fedora-33-VM + | Fedora-32-VM + | Fedora-31-VM + | Fedora-30-VM + | Fedora-Rawhide-VM-Medium + | Fedora-33-VM-Medium + | Fedora-32-VM-Medium + | Fedora-31-VM-Medium + | Fedora-30-VM-Medium + | Centos-8-VM + > + + let all = + [ Union.Fedora-Latest-Container + , Union.Fedora-33-Container + , Union.Fedora-32-Container + , Union.Fedora-31-Container + , Union.Fedora-30-Container + , Union.Centos-8-Container + , Union.Centos-7-Container + , Union.Fedora-Rawhide-VM + , Union.Fedora-33-VM + , Union.Fedora-32-VM + , Union.Fedora-31-VM + , Union.Fedora-30-VM + , Union.Fedora-Rawhide-VM-Medium + , Union.Fedora-33-VM-Medium + , Union.Fedora-32-VM-Medium + , Union.Fedora-31-VM-Medium + , Union.Fedora-30-VM-Medium + , Union.Centos-8-VM + ] + + let create + : Text → Text → Text → Zuul.Nodeset.Type + = λ(name : Text) → + λ(label : Text) → + λ(host : Text) → + Zuul.Nodeset::{ + , name + , nodes = [ { name = host, label } ] : List Zuul.Nodeset.NodeType + } + + let show + : Union → Zuul.Nodeset.Type + = λ(nodeset : Union) → + merge + { Fedora-Latest-Container = + create "fedora-latest-container" "pod-fedora-33" "container" + , Fedora-33-Container = + create "fedora-33-container" "pod-fedora-33" "container" + , Fedora-32-Container = + create "fedora-32-container" "pod-fedora-32" "container" + , Fedora-31-Container = + create "fedora-31-container" "pod-fedora-31" "container" + , Fedora-30-Container = + create "fedora-30-container" "pod-fedora-30" "container" + , Centos-8-Container = + create "centos-8-container" "pod-centos-8" "container" + , Centos-7-Container = + create "centos-7-container" "pod-centos-7" "container" + , Fedora-Rawhide-VM = + create + "fedora-rawhide-vm" + "cloud-fedora-rawhide-small" + "cloud-host" + , Fedora-33-VM = + create "fedora-33-vm" "cloud-fedora-33-small" "cloud-host" + , Fedora-32-VM = + create "fedora-32-vm" "cloud-fedora-32-small" "cloud-host" + , Fedora-31-VM = + create "fedora-31-vm" "cloud-fedora-31-small" "cloud-host" + , Fedora-30-VM = + create "fedora-30-vm" "cloud-fedora-30-small" "cloud-host" + , Fedora-Rawhide-VM-Medium = + create + "fedora-rawhide-vm-medium" + "cloud-fedora-rawhide-medium" + "cloud-host" + , Fedora-33-VM-Medium = + create + "fedora-33-vm-medium" + "cloud-fedora-33-medium" + "cloud-host" + , Fedora-32-VM-Medium = + create + "fedora-32-vm-medium" + "cloud-fedora-32-medium" + "cloud-host" + , Fedora-31-VM-Medium = + create + "fedora-31-vm-medium" + "cloud-fedora-31-medium" + "cloud-host" + , Fedora-30-VM-Medium = + create + "fedora-30-vm-medium" + "cloud-fedora-30-medium" + "cloud-host" + , Centos-8-VM = + create "centos-8-vm" "cloud-centos-8" "cloud-host" + } + nodeset + + in { Type = Union, show, all, create } + +in Nodeset diff --git a/zuul.d/jobs.dhall b/zuul.d/jobs.dhall new file mode 100644 index 0000000..4cf991f --- /dev/null +++ b/zuul.d/jobs.dhall @@ -0,0 +1,181 @@ +{-| + +This Dhall definition helps to maintain the jobs.yaml definition for Zuul. +The Dhall-Zuul library is used to benefit base Dhall type and function for Zuul +objects. + +To compute the jobs.yaml run: + + dhall-to-yaml --file jobs.dhall | zuulfmt > jobs.yaml + +Install dhall by following https://docs.dhall-lang.org/tutorials/Getting-started_Generate-JSON-or-YAML.html#installation +Install zuulfmt by running: `python3 -mpip install --user zuulfmt` + +-} + +let Zuul = + ~/git/softwarefactory-project.io/software-factory/dhall-zuul/package.dhall + ? https://raw.githubusercontent.com/softwarefactory-project/dhall-zuul/master/package.dhall + +let Prelude = + https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e + +let Nodesets = ./dhall/nodesets.dhall + +let Branches = + ~/git/pagure.io/fedora-zuul-jobs-config/zuul.d/dhall/branches.dhall + +let createJobVars + : Text → Zuul.Vars.Type + = λ(url : Text) → + Zuul.Vars.object + [ { mapKey = "repos" + , mapValue = + Zuul.Vars.array + [ Zuul.Vars.object + [ { mapKey = "name" + , mapValue = Zuul.Vars.string "distro-build" + } + , { mapKey = "url", mapValue = Zuul.Vars.string url } + ] + ] + } + ] + +let getNodeset = + λ(nodeset : Nodesets.Type) → + Zuul.Nodeset.Union.Name (Nodesets.show nodeset).name + +let createRpmInstallTestJob + : Branches.Type → Zuul.Job.Type + = λ(branch : Branches.Type) → + let getNodesetByBranch = + λ(branch : Branches.Type) → + merge + { Master = getNodeset Nodesets.Type.Fedora-Rawhide-VM + , F32 = getNodeset Nodesets.Type.Fedora-32-Container + , F33 = getNodeset Nodesets.Type.Fedora-33-Container + , Epel8 = getNodeset Nodesets.Type.Centos-8-VM + } + branch + + let job = + Zuul.Job::{ + , name = "rpm-install-test" + , description = Some + "Install the built rpms (${Branches.show branch} variant)" + , roles = Some [ { zuul = "zuul-distro-jobs" } ] + , requires = Some [ "repo" ] + , run = Some "playbooks/rpm/rpm-install-test.yaml" + , branches = Some [ Branches.show branch ] + , nodeset = Some (getNodesetByBranch branch) + , vars = Some (createJobVars (Branches.kojirepos branch)) + } + + let job = + if Branches.isEpel8 branch + then job ⫽ { pre-run = Some [ "playbooks/epel8/install.yaml" ] } + else job + + in job + +let createRpmTestJob + : Branches.Type → Zuul.Job.Type + = λ(branch : Branches.Type) → + let getNodesetByBranch = + λ(branch : Branches.Type) → + merge + { Master = getNodeset Nodesets.Type.Fedora-Rawhide-VM-Medium + , F32 = getNodeset Nodesets.Type.Fedora-32-VM-Medium + , F33 = getNodeset Nodesets.Type.Fedora-33-VM-Medium + , Epel8 = getNodeset Nodesets.Type.Centos-8-VM + } + branch + + let job = + Zuul.Job::{ + , name = "rpm-test" + , description = Some + "Install the built rpms and run STI tests (${Branches.show + branch} variant)" + , roles = Some [ { zuul = "zuul-distro-jobs" } ] + , timeout = Some 18000 + , requires = Some [ "repo" ] + , run = Some "playbooks/rpm/rpmtest.yaml" + , post-run = Some [ "playbooks/rpm/rpmtest-fetch-artifacts.yaml" ] + , branches = Some [ Branches.show branch ] + , nodeset = Some (getNodesetByBranch branch) + , vars = Some (createJobVars (Branches.kojirepos branch)) + } + + let job = + if Branches.isEpel8 branch + then job ⫽ { pre-run = Some [ "playbooks/epel8/install.yaml" ] } + else job + + in job + +let createRpmInspectJob + : Branches.Type → Zuul.Job.Type + = λ(branch : Branches.Type) → + let job = + Zuul.Job::{ + , name = "rpm-rpminspect" + , description = Some + "Run the rpminspect report tests (${Branches.show + branch} variant)" + , parent = Some "rpminspect" + , requires = Some [ "repo" ] + , run = Some "playbooks/rpm/rpmtest.yaml" + , branches = Some [ Branches.show branch ] + , nodeset = Some (getNodeset Nodesets.Type.Fedora-33-VM-Medium) + , vars = Some + ( Zuul.Vars.object + [ { mapKey = "rpminspect_cmd" + , mapValue = Zuul.Vars.string "rpminspect-fedora" + } + , { mapKey = "check_previous_build_enabled" + , mapValue = Zuul.Vars.bool True + } + , { mapKey = "target" + , mapValue = Zuul.Vars.string (Branches.target branch) + } + ] + ) + } + + in job + +let rpm_linter_job = + Zuul.Job::{ + , name = "rpm-linter" + , parent = Some "repo-rpm-lint" + , requires = Some [ "repo" ] + , nodeset = Some (getNodeset Nodesets.Type.Fedora-33-VM-Medium) + , branches = Some Branches.allText + } + +let rpm_install_test_jobs = + Prelude.List.map + Branches.Type + Zuul.Job.Type + createRpmInstallTestJob + Branches.all + +let rpm_test_jobs = + Prelude.List.map Branches.Type Zuul.Job.Type createRpmTestJob Branches.all + +let rpminspect_jobs = + Prelude.List.map + Branches.Type + Zuul.Job.Type + createRpmInspectJob + Branches.all + +let jobs = + rpm_install_test_jobs + # rpm_test_jobs + # rpminspect_jobs + # [ rpm_linter_job ] + +in Zuul.Job.wrap jobs diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 5d099d3..aa40c7a 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -1,176 +1,216 @@ ---- -### rpm-install-test ### -- job: - name: base-rpm-install-test - description: Install the built rpms - roles: - - zuul: zuul-distro-jobs - requires: repo - run: playbooks/rpm/rpm-install-test.yaml - host-vars: - cloud-host: - ansible_python_interpreter: /usr/bin/python3 - job: name: rpm-install-test - parent: base-rpm-install-test - branches: master + description: "Install the built rpms (master variant)" + run: playbooks/rpm/rpm-install-test.yaml + branches: + - master nodeset: fedora-rawhide-vm + requires: + - repo + roles: + - zuul: zuul-distro-jobs vars: repos: - - name: rawhide-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/ - job: name: rpm-install-test - parent: base-rpm-install-test - branches: f33 + description: "Install the built rpms (f33 variant)" + run: playbooks/rpm/rpm-install-test.yaml + branches: + - f33 nodeset: fedora-33-container + requires: + - repo + roles: + - zuul: zuul-distro-jobs vars: repos: - - name: f33-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/f33-build/latest/x86_64/ - job: name: rpm-install-test - parent: base-rpm-install-test - branches: f32 + description: "Install the built rpms (f32 variant)" + run: playbooks/rpm/rpm-install-test.yaml + branches: + - f32 nodeset: fedora-32-container + requires: + - repo + roles: + - zuul: zuul-distro-jobs vars: repos: - - name: f32-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/f32-build/latest/x86_64/ - - job: name: rpm-install-test - parent: base-rpm-install-test - branches: epel8 + description: "Install the built rpms (epel8 variant)" + run: playbooks/rpm/rpm-install-test.yaml + pre-run: + - playbooks/epel8/install.yaml + branches: + - epel8 nodeset: centos-8-vm + requires: + - repo + roles: + - zuul: zuul-distro-jobs vars: repos: - - name: epel8-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/epel8-build/latest/x86_64/ - pre-run: playbooks/epel8/install.yaml - -### rpm-test ### -- job: - name: base-rpm-test - description: Run the test.yml test - abstract: true - # 5h timeout - timeout: 18000 - roles: - - zuul: zuul-distro-jobs - requires: repo - run: playbooks/rpm/rpmtest.yaml - post-run: playbooks/rpm/rpmtest-fetch-artifacts.yaml - job: name: rpm-test - parent: base-rpm-test - branches: master + description: "Install the built rpms and run STI tests (master variant)" + run: playbooks/rpm/rpmtest.yaml + post-run: + - playbooks/rpm/rpmtest-fetch-artifacts.yaml + branches: + - master nodeset: fedora-rawhide-vm-medium + requires: + - repo + roles: + - zuul: zuul-distro-jobs + timeout: 18000 vars: repos: - - name: rawhide-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/ - host-vars: - cloud-host: - ansible_python_interpreter: /usr/bin/python3 - job: name: rpm-test - parent: base-rpm-test - branches: f33 + description: "Install the built rpms and run STI tests (f33 variant)" + run: playbooks/rpm/rpmtest.yaml + post-run: + - playbooks/rpm/rpmtest-fetch-artifacts.yaml + branches: + - f33 nodeset: fedora-33-vm-medium + requires: + - repo + roles: + - zuul: zuul-distro-jobs + timeout: 18000 vars: repos: - - name: f33-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/f33-build/latest/x86_64/ - host-vars: - cloud-host: - ansible_python_interpreter: /usr/bin/python3 - job: name: rpm-test - parent: base-rpm-test - branches: f32 + description: "Install the built rpms and run STI tests (f32 variant)" + run: playbooks/rpm/rpmtest.yaml + post-run: + - playbooks/rpm/rpmtest-fetch-artifacts.yaml + branches: + - f32 nodeset: fedora-32-vm-medium + requires: + - repo + roles: + - zuul: zuul-distro-jobs + timeout: 18000 vars: repos: - - name: f32-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/f32-build/latest/x86_64/ - host-vars: - cloud-host: - ansible_python_interpreter: /usr/bin/python3 - job: name: rpm-test - parent: base-rpm-test - branches: epel8 + description: "Install the built rpms and run STI tests (epel8 variant)" + run: playbooks/rpm/rpmtest.yaml + pre-run: + - playbooks/epel8/install.yaml + post-run: + - playbooks/rpm/rpmtest-fetch-artifacts.yaml + branches: + - epel8 nodeset: centos-8-vm + requires: + - repo + roles: + - zuul: zuul-distro-jobs + timeout: 18000 vars: repos: - - name: epel8-build + - name: distro-build url: https://kojipkgs.fedoraproject.org/repos/epel8-build/latest/x86_64/ - pre-run: playbooks/epel8/install.yaml -### rpm-linter ### - job: - name: rpm-linter - parent: repo-rpm-lint - requires: repo - nodeset: fedora-33-container + name: rpm-rpminspect + parent: rpminspect + description: "Run the rpminspect report tests (master variant)" + run: playbooks/rpm/rpmtest.yaml branches: - - f32 - - f33 - - epel8 - master - host-vars: - cloud-host: - ansible_python_interpreter: /usr/bin/python3 - -### rpm-inspect ### -- job: - name: base-rpm-rpminspect - parent: rpminspect - requires: repo - nodeset: fedora-33-container + nodeset: fedora-33-vm-medium + requires: + - repo vars: + check_previous_build_enabled: true rpminspect_cmd: rpminspect-fedora - host-vars: - node: - ansible_python_interpreter: /usr/bin/python3 + target: rawhide - job: name: rpm-rpminspect - parent: base-rpm-rpminspect - branches: master + parent: rpminspect + description: "Run the rpminspect report tests (f33 variant)" + run: playbooks/rpm/rpmtest.yaml + branches: + - f33 + nodeset: fedora-33-vm-medium + requires: + - repo vars: - target: rawhide check_previous_build_enabled: true + rpminspect_cmd: rpminspect-fedora + target: f33 - job: name: rpm-rpminspect - parent: base-rpm-rpminspect - branches: f33 + parent: rpminspect + description: "Run the rpminspect report tests (f32 variant)" + run: playbooks/rpm/rpmtest.yaml + branches: + - f32 + nodeset: fedora-33-vm-medium + requires: + - repo vars: - target: f33 check_previous_build_enabled: true + rpminspect_cmd: rpminspect-fedora + target: f32 - job: name: rpm-rpminspect - parent: base-rpm-rpminspect - branches: f32 + parent: rpminspect + description: "Run the rpminspect report tests (epel8 variant)" + run: playbooks/rpm/rpmtest.yaml + branches: + - epel8 + nodeset: fedora-33-vm-medium + requires: + - repo vars: - target: f32 check_previous_build_enabled: true + rpminspect_cmd: rpminspect-fedora + target: epel8 - job: - name: rpm-rpminspect - parent: base-rpm-rpminspect - branches: epel8 - vars: - target: epel8 - check_previous_build_enabled: true + name: rpm-linter + parent: repo-rpm-lint + branches: + - master + - f33 + - f32 + - epel8 + nodeset: fedora-33-vm-medium + requires: + - repo diff --git a/zuul.d/nodesets.dhall b/zuul.d/nodesets.dhall index 6dbb5df..a29eeb5 100644 --- a/zuul.d/nodesets.dhall +++ b/zuul.d/nodesets.dhall @@ -19,123 +19,12 @@ let Zuul = let Prelude = https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e -let Nodeset = - let NodesetDetails = { name : Text, label : Text, host : Text } - - let Union = - < Fedora-Latest-Container - | Fedora-33-Container - | Fedora-32-Container - | Fedora-31-Container - | Fedora-30-Container - | Centos-8-Container - | Centos-7-Container - | Fedora-Rawhide-VM - | Fedora-33-VM - | Fedora-32-VM - | Fedora-31-VM - | Fedora-30-VM - | Fedora-Rawhide-VM-Medium - | Fedora-33-VM-Medium - | Fedora-32-VM-Medium - | Fedora-31-VM-Medium - | Fedora-30-VM-Medium - | Centos-8-VM - > - - let all = - [ Union.Fedora-Latest-Container - , Union.Fedora-33-Container - , Union.Fedora-32-Container - , Union.Fedora-31-Container - , Union.Fedora-30-Container - , Union.Centos-8-Container - , Union.Centos-7-Container - , Union.Fedora-Rawhide-VM - , Union.Fedora-33-VM - , Union.Fedora-32-VM - , Union.Fedora-31-VM - , Union.Fedora-30-VM - , Union.Fedora-Rawhide-VM-Medium - , Union.Fedora-33-VM-Medium - , Union.Fedora-32-VM-Medium - , Union.Fedora-31-VM-Medium - , Union.Fedora-30-VM-Medium - , Union.Centos-8-VM - ] - - let create - : Text → Text → Text → Zuul.Nodeset.Type - = λ(name : Text) → - λ(label : Text) → - λ(host : Text) → - Zuul.Nodeset::{ - , name = Some name - , nodes = [ { name = host, label } ] : List Zuul.Nodeset.NodeType - } - - let show - : Union → Zuul.Nodeset.Type - = λ(nodeset : Union) → - merge - { Fedora-Latest-Container = - create "fedora-latest-container" "pod-fedora-33" "container" - , Fedora-33-Container = - create "fedora-33-container" "pod-fedora-33" "container" - , Fedora-32-Container = - create "fedora-32-container" "pod-fedora-32" "container" - , Fedora-31-Container = - create "fedora-31-container" "pod-fedora-31" "container" - , Fedora-30-Container = - create "fedora-30-container" "pod-fedora-30" "container" - , Centos-8-Container = - create "centos-8-container" "pod-centos-8" "container" - , Centos-7-Container = - create "centos-7-container" "pod-centos-7" "container" - , Fedora-Rawhide-VM = - create - "fedora-rawhide-vm" - "cloud-fedora-rawhide-small" - "cloud-host" - , Fedora-33-VM = - create "fedora-33-vm" "cloud-fedora-33-small" "cloud-host" - , Fedora-32-VM = - create "fedora-32-vm" "cloud-fedora-32-small" "cloud-host" - , Fedora-31-VM = - create "fedora-31-vm" "cloud-fedora-31-small" "cloud-host" - , Fedora-30-VM = - create "fedora-30-vm" "cloud-fedora-30-small" "cloud-host" - , Fedora-Rawhide-VM-Medium = - create - "fedora-rawhide-vm-medium" - "cloud-fedora-rawhide-medium" - "cloud-host" - , Fedora-33-VM-Medium = - create - "fedora-33-vm-medium" - "cloud-fedora-33-medium" - "cloud-host" - , Fedora-32-VM-Medium = - create - "fedora-32-vm-medium" - "cloud-fedora-32-medium" - "cloud-host" - , Fedora-31-VM-Medium = - create - "fedora-31-vm-medium" - "cloud-fedora-31-medium" - "cloud-host" - , Fedora-30-VM-Medium = - create - "fedora-30-vm-medium" - "cloud-fedora-30-medium" - "cloud-host" - , Centos-8-VM = - create "centos-8-vm" "cloud-centos-8" "cloud-host" - } - nodeset - - in { Type = Union, show, all, create } +let Nodesets = ./dhall/nodesets.dhall in Zuul.Nodeset.wrap - (Prelude.List.map Nodeset.Type Zuul.Nodeset.Type Nodeset.show Nodeset.all) + ( Prelude.List.map + Nodesets.Type + Zuul.Nodeset.Type + Nodesets.show + Nodesets.all + ) From 5b358606927cfe5b0eaa2644e954b05191b454b5 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 25 2021 10:22:10 +0000 Subject: [PATCH 2/4] Use FZCI.dhall --- diff --git a/zuul.d/dhall/nodesets.dhall b/zuul.d/dhall/nodesets.dhall deleted file mode 100644 index c743195..0000000 --- a/zuul.d/dhall/nodesets.dhall +++ /dev/null @@ -1,124 +0,0 @@ -let Zuul = - ~/git/softwarefactory-project.io/software-factory/dhall-zuul/package.dhall - ? https://raw.githubusercontent.com/softwarefactory-project/dhall-zuul/master/package.dhall - -let Prelude = - https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e - -let Nodeset = - let Union = - < Fedora-Latest-Container - | Fedora-33-Container - | Fedora-32-Container - | Fedora-31-Container - | Fedora-30-Container - | Centos-8-Container - | Centos-7-Container - | Fedora-Rawhide-VM - | Fedora-33-VM - | Fedora-32-VM - | Fedora-31-VM - | Fedora-30-VM - | Fedora-Rawhide-VM-Medium - | Fedora-33-VM-Medium - | Fedora-32-VM-Medium - | Fedora-31-VM-Medium - | Fedora-30-VM-Medium - | Centos-8-VM - > - - let all = - [ Union.Fedora-Latest-Container - , Union.Fedora-33-Container - , Union.Fedora-32-Container - , Union.Fedora-31-Container - , Union.Fedora-30-Container - , Union.Centos-8-Container - , Union.Centos-7-Container - , Union.Fedora-Rawhide-VM - , Union.Fedora-33-VM - , Union.Fedora-32-VM - , Union.Fedora-31-VM - , Union.Fedora-30-VM - , Union.Fedora-Rawhide-VM-Medium - , Union.Fedora-33-VM-Medium - , Union.Fedora-32-VM-Medium - , Union.Fedora-31-VM-Medium - , Union.Fedora-30-VM-Medium - , Union.Centos-8-VM - ] - - let create - : Text → Text → Text → Zuul.Nodeset.Type - = λ(name : Text) → - λ(label : Text) → - λ(host : Text) → - Zuul.Nodeset::{ - , name - , nodes = [ { name = host, label } ] : List Zuul.Nodeset.NodeType - } - - let show - : Union → Zuul.Nodeset.Type - = λ(nodeset : Union) → - merge - { Fedora-Latest-Container = - create "fedora-latest-container" "pod-fedora-33" "container" - , Fedora-33-Container = - create "fedora-33-container" "pod-fedora-33" "container" - , Fedora-32-Container = - create "fedora-32-container" "pod-fedora-32" "container" - , Fedora-31-Container = - create "fedora-31-container" "pod-fedora-31" "container" - , Fedora-30-Container = - create "fedora-30-container" "pod-fedora-30" "container" - , Centos-8-Container = - create "centos-8-container" "pod-centos-8" "container" - , Centos-7-Container = - create "centos-7-container" "pod-centos-7" "container" - , Fedora-Rawhide-VM = - create - "fedora-rawhide-vm" - "cloud-fedora-rawhide-small" - "cloud-host" - , Fedora-33-VM = - create "fedora-33-vm" "cloud-fedora-33-small" "cloud-host" - , Fedora-32-VM = - create "fedora-32-vm" "cloud-fedora-32-small" "cloud-host" - , Fedora-31-VM = - create "fedora-31-vm" "cloud-fedora-31-small" "cloud-host" - , Fedora-30-VM = - create "fedora-30-vm" "cloud-fedora-30-small" "cloud-host" - , Fedora-Rawhide-VM-Medium = - create - "fedora-rawhide-vm-medium" - "cloud-fedora-rawhide-medium" - "cloud-host" - , Fedora-33-VM-Medium = - create - "fedora-33-vm-medium" - "cloud-fedora-33-medium" - "cloud-host" - , Fedora-32-VM-Medium = - create - "fedora-32-vm-medium" - "cloud-fedora-32-medium" - "cloud-host" - , Fedora-31-VM-Medium = - create - "fedora-31-vm-medium" - "cloud-fedora-31-medium" - "cloud-host" - , Fedora-30-VM-Medium = - create - "fedora-30-vm-medium" - "cloud-fedora-30-medium" - "cloud-host" - , Centos-8-VM = - create "centos-8-vm" "cloud-centos-8" "cloud-host" - } - nodeset - - in { Type = Union, show, all, create } - -in Nodeset diff --git a/zuul.d/jobs.dhall b/zuul.d/jobs.dhall index 4cf991f..37f9c76 100644 --- a/zuul.d/jobs.dhall +++ b/zuul.d/jobs.dhall @@ -15,15 +15,16 @@ Install zuulfmt by running: `python3 -mpip install --user zuulfmt` let Zuul = ~/git/softwarefactory-project.io/software-factory/dhall-zuul/package.dhall - ? https://raw.githubusercontent.com/softwarefactory-project/dhall-zuul/master/package.dhall + ? https://softwarefactory-project.io/cgit/software-factory/dhall-zuul/plain/package.dhall?h=0.4.0 sha256:1e74901df84e6428f15cbe6cac4f66be41030addb689177c14cbbd8f8802e77c let Prelude = https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e -let Nodesets = ./dhall/nodesets.dhall +let FZCI = ~/git/pagure.io/fedora-project-config/FZCI.dhall/package.dhall -let Branches = - ~/git/pagure.io/fedora-zuul-jobs-config/zuul.d/dhall/branches.dhall +let Nodesets = FZCI.Nodesets + +let Branches = FZCI.Branches let createJobVars : Text → Zuul.Vars.Type @@ -42,20 +43,16 @@ let createJobVars } ] -let getNodeset = - λ(nodeset : Nodesets.Type) → - Zuul.Nodeset.Union.Name (Nodesets.show nodeset).name - let createRpmInstallTestJob : Branches.Type → Zuul.Job.Type = λ(branch : Branches.Type) → let getNodesetByBranch = λ(branch : Branches.Type) → merge - { Master = getNodeset Nodesets.Type.Fedora-Rawhide-VM - , F32 = getNodeset Nodesets.Type.Fedora-32-Container - , F33 = getNodeset Nodesets.Type.Fedora-33-Container - , Epel8 = getNodeset Nodesets.Type.Centos-8-VM + { Master = Nodesets.getName Nodesets.Type.Fedora-Rawhide-VM + , F32 = Nodesets.getName Nodesets.Type.Fedora-32-Container + , F33 = Nodesets.getName Nodesets.Type.Fedora-33-Container + , Epel8 = Nodesets.getName Nodesets.Type.Centos-8-VM } branch @@ -85,10 +82,11 @@ let createRpmTestJob let getNodesetByBranch = λ(branch : Branches.Type) → merge - { Master = getNodeset Nodesets.Type.Fedora-Rawhide-VM-Medium - , F32 = getNodeset Nodesets.Type.Fedora-32-VM-Medium - , F33 = getNodeset Nodesets.Type.Fedora-33-VM-Medium - , Epel8 = getNodeset Nodesets.Type.Centos-8-VM + { Master = + Nodesets.getName Nodesets.Type.Fedora-Rawhide-VM-Medium + , F32 = Nodesets.getName Nodesets.Type.Fedora-32-VM-Medium + , F33 = Nodesets.getName Nodesets.Type.Fedora-33-VM-Medium + , Epel8 = Nodesets.getName Nodesets.Type.Centos-8-VM } branch @@ -128,7 +126,8 @@ let createRpmInspectJob , requires = Some [ "repo" ] , run = Some "playbooks/rpm/rpmtest.yaml" , branches = Some [ Branches.show branch ] - , nodeset = Some (getNodeset Nodesets.Type.Fedora-33-VM-Medium) + , nodeset = Some + (Nodesets.getName Nodesets.Type.Fedora-33-VM-Medium) , vars = Some ( Zuul.Vars.object [ { mapKey = "rpminspect_cmd" @@ -151,7 +150,7 @@ let rpm_linter_job = , name = "rpm-linter" , parent = Some "repo-rpm-lint" , requires = Some [ "repo" ] - , nodeset = Some (getNodeset Nodesets.Type.Fedora-33-VM-Medium) + , nodeset = Some (Nodesets.getName Nodesets.Type.Fedora-33-VM-Medium) , branches = Some Branches.allText } diff --git a/zuul.d/nodesets.dhall b/zuul.d/nodesets.dhall index a29eeb5..afae952 100644 --- a/zuul.d/nodesets.dhall +++ b/zuul.d/nodesets.dhall @@ -19,12 +19,14 @@ let Zuul = let Prelude = https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e -let Nodesets = ./dhall/nodesets.dhall +let FZCI = ~/git/pagure.io/fedora-project-config/FZCI.dhall/package.dhall + +let Nodesets = FZCI.Nodesets in Zuul.Nodeset.wrap ( Prelude.List.map Nodesets.Type Zuul.Nodeset.Type - Nodesets.show + Nodesets.toNodeset Nodesets.all ) From 8fe44a806e1ec82439dc3c1f0d0665f967bdc209 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 25 2021 10:41:17 +0000 Subject: [PATCH 3/4] Remove zuul package hash waiting for 0.5.0 release --- diff --git a/zuul.d/jobs.dhall b/zuul.d/jobs.dhall index 37f9c76..2620bfc 100644 --- a/zuul.d/jobs.dhall +++ b/zuul.d/jobs.dhall @@ -15,7 +15,7 @@ Install zuulfmt by running: `python3 -mpip install --user zuulfmt` let Zuul = ~/git/softwarefactory-project.io/software-factory/dhall-zuul/package.dhall - ? https://softwarefactory-project.io/cgit/software-factory/dhall-zuul/plain/package.dhall?h=0.4.0 sha256:1e74901df84e6428f15cbe6cac4f66be41030addb689177c14cbbd8f8802e77c + ? https://softwarefactory-project.io/cgit/software-factory/dhall-zuul/plain/package.dhall let Prelude = https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e From af42fa44ec85d341893c9e0f70dcf3b3dc514b57 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 25 2021 10:48:45 +0000 Subject: [PATCH 4/4] Add dhall generated comment --- diff --git a/zuul.d/jobs.dhall b/zuul.d/jobs.dhall index 2620bfc..d1b559a 100644 --- a/zuul.d/jobs.dhall +++ b/zuul.d/jobs.dhall @@ -6,7 +6,7 @@ objects. To compute the jobs.yaml run: - dhall-to-yaml --file jobs.dhall | zuulfmt > jobs.yaml + dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml Install dhall by following https://docs.dhall-lang.org/tutorials/Getting-started_Generate-JSON-or-YAML.html#installation Install zuulfmt by running: `python3 -mpip install --user zuulfmt`