Hi all,

during HackWeek I improved a bit the Rake tasks we use in YaST, here is a short
summary of the changes.



Added osc:config Task
---------------------

The packaging configuration might be complex and it might be quite difficult to 
find
where the package will be submitted with the osc:sr task in the end.

This task prints the summary of the packaging configuration:

  rake osc:config
  Package directory: package
  OBS instance:      https://api.opensuse.org/
  OBS project:       devel:languages:ruby:extensions
  OBS package name:  rubygem-packaging_rake_tasks
  OBS build target:  openSUSE_Tumbleweed
  OBS submit target: openSUSE:Factory

It also honors the YAST_SUBMIT variable:

  YAST_SUBMIT=sle15sp1 rake osc:config
  Package directory: package
  OBS instance:      https://api.suse.de/
  OBS project:       Devel:YaST:SLE-15-SP1
  OBS package name:  yast2
  OBS build target:  SUSE_SLE-15-SP1_Update
  OBS submit target: SUSE:SLE-15-SP1:Update



Updated check:committed Task
----------------------------

The osc:build or osc:sr tasks check whether all changes have been committed to 
Git to
avoid missing files and changes. That's good. But if you are testing a fix it is
quite annoying that you have to commit every single change before running a 
testing
build locally.

Usage:

  rake osc:build CHECK_MODIFIED=0

Note: We need to keep the check for *new* files because "rake package" archives 
only
the files known to Git, so the package build would miss them later.



Added run:container[client] Task
---------------------------------

This is similar to the "run[client]" task, but it runs the client in a Docker
container. Because the Docker container environment is quite limited (no 
systemd, no
boot loader, no HW access) some modules will not work properly. But it works 
for some
modules/clients (like "repositories").

It uses the same container as specified in the GitHub Actions, see the "Options"
section below.



Added GitHub Action Tasks
-------------------------

These tasks allow running the GitHub Actions locally

actions:list - print the defined GitHub Action jobs
actions:details - print the details of the defined GitHub Action jobs
actions:run[job] - run the specified GitHub Action job locally,
                   if "job" is not specified then it runs all jobs

You can run the same[*] jobs as the GitHub Actions do on the server!

Options
-------

There are several options you can use in the "actions:run" and
"run:container" tasks:

KEEP_CONTAINER=1 - keeps the container running after finishing the job/client,
  that might be useful for debugging or testing if something fails.

  It prints the instructions how to connect to the container and remove it.
  Do not forget to remove the container manually at the end otherwise it it will
  keep running and consuming some (tiny) system resources!

DOCKER_IMAGE=<image> - it might be useful to use a different Docker image
  than the one which is specified in the GitHub Actions. Of course, when using
  a different image the result might be different than in real GitHub Actions.
  But that might be useful in some cases, see the example below.

Examples:

  rake actions:run[Checks] KEEP_CONTAINER=1

  # use the Leap 15.3 based Docker image if the latest TW image with glibc-2.33
  # does not work with older Docker in your system
  rake actions:run
DOCKER_IMAGE=registry.opensuse.org/yast/head/containers_15.3/yast-ruby:latest



Details
-------

See the details in these pull requests:

https://github.com/yast/yast-rake/pull/83
https://github.com/openSUSE/packaging_rake_tasks/pull/60




    Enjoy!
        
        Ladislav


[*] The Docker containers use the host kernel and depend on the Docker version
installed. So it is not 100% the same, but very very close...


-- 
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8

Reply via email to