From 29b67bdb7c207a9392e997d8f192302da0ef33bc Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Aug 12 2021 08:23:35 +0000 Subject: [PATCH 1/3] Add F35 + doc --- diff --git a/FZCI.dhall/Branches.dhall b/FZCI.dhall/Branches.dhall index b0562b2..9bd11e5 100644 --- a/FZCI.dhall/Branches.dhall +++ b/FZCI.dhall/Branches.dhall @@ -4,17 +4,23 @@ let Arches = ./Arches.dhall let --| When changing that union, update the `all` attribute too Union = - < Rawhide | F33 | F34 | Epel8 > + < Rawhide | F33 | F34 | F35 | Epel8 > -let eq_def = { Rawhide = False, F33 = False, F34 = False, Epel8 = False } +let eq_def = + { Rawhide = False, F33 = False, F34 = False, F35 = False, Epel8 = False } let show = λ(branch : Union) → merge - { Rawhide = "rawhide", F33 = "f33", F34 = "f34", Epel8 = "epel8" } + { Rawhide = "rawhide" + , F33 = "f33" + , F34 = "f34" + , F35 = "f35" + , Epel8 = "epel8" + } branch -let all = [ Union.Rawhide, Union.F34, Union.F33, Union.Epel8 ] +let all = [ Union.Rawhide, Union.F35, Union.F34, Union.F33, Union.Epel8 ] let isRawhide = λ(branch : Union) → merge (eq_def ⫽ { Rawhide = True }) branch @@ -35,7 +41,12 @@ in { Type = Union , target = λ(branch : Union) → merge - { Rawhide = "rawhide", F33 = "f33", F34 = "f34", Epel8 = "epel8" } + { Rawhide = "rawhide" + , F33 = "f33" + , F34 = "f34" + , F35 = "f35" + , Epel8 = "epel8" + } branch , arches = λ(branch : Union) → @@ -43,6 +54,7 @@ in { Type = Union { Rawhide = Arches.fedora , F33 = Arches.fedora , F34 = Arches.fedora + , F35 = Arches.fedora , Epel8 = Arches.epel8 } branch @@ -55,6 +67,8 @@ in { Type = Union "https://kojipkgs.fedoraproject.org/repos/f33-build/latest/x86_64/" , F34 = "https://kojipkgs.fedoraproject.org/repos/f34-build/latest/x86_64/" + , F35 = + "https://kojipkgs.fedoraproject.org/repos/f35-build/latest/x86_64/" , Epel8 = "https://kojipkgs.fedoraproject.org/repos/epel8-build/latest/x86_64/" } diff --git a/README.md b/README.md index c17943a..471b835 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,124 @@ Software Factory configuration for the Fedora project. Here are configured: -* resources/: Git repositories to be listened by softwarefactory-project.io's Zuul. -* zuul.d/: Zuul pipelines and base Zuul jobs for Fedora. -* playbooks/: Ansible playbooks used by Zuul jobs. -* tools/: Some addtionnal tooling. +- resources/: Git repositories to be listened by softwarefactory-project.io's Zuul. +- zuul.d/: Zuul pipelines and base Zuul jobs for Fedora. +- playbooks/: Ansible playbooks used by Zuul jobs. +- tools/: Some addtionnal tooling. +- FZCI.dhall: [Dhall][dhall-lang] description of Fedora Resources to be used in Zuul job configuration. + +## Prepare your workspace to edit FZCI Dhall config + +### Clone sources + +```ShellSession +cd pagure.io +git clone https://pagure.io/fedora-project-config +git clone https://pagure.io/fedora-zuul-jobs-config +git clone https://pagure.io/fedora-zuul-jobs +``` + +### Ensure tooling installed + +Follow [install Dhall section](#install-dhall). + +Then ensure the dhall-to-yaml process as expected. + +```ShellSession +cd fedora-zuul-jobs-config/zuul.d/ +dhall-to-yaml --generated-comment --file jobs-unformated.yaml +``` + +Install zuul-fmt: + +```ShellSession +python3 -mpip install --user zuulfmt +``` + +### Run zuul-fmt + +```ShellSession +cat jobs-unformated.yaml | zuulfmt > jobs.yaml +``` + +If both dhall-to-yaml and zuul-fmt succeeded then your are ready to move forward. +But first remove `rm -f jobs-unformated.yaml jobs.yaml`. + +Note that it is adviced to get a support for Dhall Lang into your IDE but at least you must have +installed the dhall commands on you system. + +## Adding support for a Fedora Branch + +### Adding new branch definition + +- Edit file [branches.dhall](FZCI.dhall/Branches.dhall) in order to add the . +- The type checker will help you to fill the places where the handling must + be done. + +If you don't have the support of Dhall in your IDE, you might want to check your edit with +the type checker: + +```ShellSession +cd fedora-project-config +dhall <<< './FZCI.dhall/Branches.dhall' +``` + +### Update jobs from fedora-zuul-jobs-config + +In fedora-zuul-jobs-config + +- Edit [jobs.dhall](https://pagure.io/fedora-zuul-jobs-config/raw/master/f/zuul.d/jobs.dhall) to handle the . Again the type checker will help you. + +If the type checker does not complain then nothing needs to be done into that file. + +Then run: + +```ShellSession +cd zuul.d +dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +``` + +### Update jobs from fedora-zuul-jobs + +In fedora-zuul-jobs + +- Edit [jobs.dhall](https://pagure.io/fedora-zuul-jobs/raw/master/f/zuul.d/jobs.dhall) in order to ensure jobs will trigger in the . Again the type checker will help you. + +Then run: + +```ShellSession +cd zuul.d +dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +``` + +### Push changes + +When edits are done on those repos then commits and push changes (as PR) then wait +for CI result. + +# Install Dhall + +### On Fedora 34 + +```ShellSession +dnf install -y dhall dhall-json +``` + +Packages does not provide dhall-to-yaml command yet so you might want to install it via +the [upstream release](#using-upstream-release). + +### Using upstream relase + +```ShellSession +curl -OL https://github.com/dhall-lang/dhall-haskell/releases/download/1.39.0/dhall-1.39.0-x86_64-linux.tar.bz2 +tar -xf dhall-1.39.0-x86_64-linux.tar.bz2 +cp bin/dhall ~/.local/bin/ +``` + +```ShellSession +curl -OL https://github.com/dhall-lang/dhall-haskell/releases/download/1.39.0/dhall-yaml-1.2.7-x86_64-linux.tar.bz2 +tar -xf dhall-yaml-1.2.7-x86_64-linux.tar.bz2 +cp bin/dhall-to-yaml ~/.local/bin/ +``` + +[dhall-lang]: https://dhall-lang.org From 0bff5a9418217ecd35ccfc5b4ebc53a22db88833 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Aug 12 2021 12:47:15 +0000 Subject: [PATCH 2/3] Update REAME.md according to comments --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..58d71ba --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +export FZCI = $(shell pwd)/FZCI.dhall/package.dhall + +define generate_file + @echo "Rendering $(1)" + @dhall-to-yaml --generated-comment --file $(1).dhall | python3 -mzuulfmt > $(1).yaml +endef + +all: render install-req + +render: + @dhall hash --file $$FZCI > /dev/null + $(call generate_file,../fedora-zuul-jobs-config/zuul.d/jobs) + $(call generate_file,../fedora-zuul-jobs/zuul.d/jobs) + +define clone + @test -d ../$(1)/.git || git clone https://pagure.io/$(1).git ../$(1)/ +endef + +install-req: + @type -p dhall-to-yaml > /dev/null || sudo dnf install -y dhall-json + @python3 -mzuulfmt --help > /dev/null || python3 -mpip install --user zuulfmt + $(class clone,fedora-zuul-jobs-config) + $(class clone,fedora-zuul-jobs) diff --git a/README.md b/README.md index 471b835..6aec783 100644 --- a/README.md +++ b/README.md @@ -14,39 +14,18 @@ Here are configured: ### Clone sources -```ShellSession -cd pagure.io -git clone https://pagure.io/fedora-project-config -git clone https://pagure.io/fedora-zuul-jobs-config -git clone https://pagure.io/fedora-zuul-jobs -``` - -### Ensure tooling installed - -Follow [install Dhall section](#install-dhall). - -Then ensure the dhall-to-yaml process as expected. - -```ShellSession -cd fedora-zuul-jobs-config/zuul.d/ -dhall-to-yaml --generated-comment --file jobs-unformated.yaml -``` - -Install zuul-fmt: +Run the following command to install dependencies. ```ShellSession -python3 -mpip install --user zuulfmt +make install-req ``` -### Run zuul-fmt +### Run the rendering ```ShellSession -cat jobs-unformated.yaml | zuulfmt > jobs.yaml +make render ``` -If both dhall-to-yaml and zuul-fmt succeeded then your are ready to move forward. -But first remove `rm -f jobs-unformated.yaml jobs.yaml`. - Note that it is adviced to get a support for Dhall Lang into your IDE but at least you must have installed the dhall commands on you system. @@ -79,6 +58,7 @@ Then run: ```ShellSession cd zuul.d dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +# or run: make render ``` ### Update jobs from fedora-zuul-jobs @@ -92,6 +72,7 @@ Then run: ```ShellSession cd zuul.d dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +# or run: make render ``` ### Push changes @@ -99,29 +80,4 @@ dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml When edits are done on those repos then commits and push changes (as PR) then wait for CI result. -# Install Dhall - -### On Fedora 34 - -```ShellSession -dnf install -y dhall dhall-json -``` - -Packages does not provide dhall-to-yaml command yet so you might want to install it via -the [upstream release](#using-upstream-release). - -### Using upstream relase - -```ShellSession -curl -OL https://github.com/dhall-lang/dhall-haskell/releases/download/1.39.0/dhall-1.39.0-x86_64-linux.tar.bz2 -tar -xf dhall-1.39.0-x86_64-linux.tar.bz2 -cp bin/dhall ~/.local/bin/ -``` - -```ShellSession -curl -OL https://github.com/dhall-lang/dhall-haskell/releases/download/1.39.0/dhall-yaml-1.2.7-x86_64-linux.tar.bz2 -tar -xf dhall-yaml-1.2.7-x86_64-linux.tar.bz2 -cp bin/dhall-to-yaml ~/.local/bin/ -``` - [dhall-lang]: https://dhall-lang.org From 7520b88dbd45cedb6201161b17c6d2f2bdde6ab0 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Aug 12 2021 14:52:02 +0000 Subject: [PATCH 3/3] adress comments --- diff --git a/Makefile b/Makefile index 58d71ba..7bbb4b5 100644 --- a/Makefile +++ b/Makefile @@ -19,5 +19,5 @@ endef install-req: @type -p dhall-to-yaml > /dev/null || sudo dnf install -y dhall-json @python3 -mzuulfmt --help > /dev/null || python3 -mpip install --user zuulfmt - $(class clone,fedora-zuul-jobs-config) - $(class clone,fedora-zuul-jobs) + $(call clone,fedora-zuul-jobs-config) + $(call clone,fedora-zuul-jobs) diff --git a/README.md b/README.md index 6aec783..1938a2d 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Then run: ```ShellSession cd zuul.d -dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +dhall-to-yaml --generated-comment --file jobs.dhall | python3 -mzuulfmt > jobs.yaml # or run: make render ``` @@ -71,7 +71,7 @@ Then run: ```ShellSession cd zuul.d -dhall-to-yaml --generated-comment --file jobs.dhall | zuulfmt > jobs.yaml +dhall-to-yaml --generated-comment --file jobs.dhall | python3 -mzuulfmt > jobs.yaml # or run: make render ```