From a23e8fc6cefbed986f21a084ad49a040510a5a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 27 Sep 2024 17:10:42 +0200 Subject: [PATCH 1/2] Submit the code from "release" branch to a separate OBS project --- .../obs-staging-autoinstallation.yml | 1 + .../obs-staging-integration-tests.yml | 1 + .github/workflows/obs-staging-live.yml | 1 + .github/workflows/obs-staging-products.yml | 1 + .github/workflows/obs-staging-rust.yml | 1 + .github/workflows/obs-staging-service.yml | 1 + .github/workflows/obs-staging-shared.yml | 46 ++++++++++++------- .github/workflows/obs-staging-web.yml | 1 + autoinstallation/package/_service | 6 ++- doc/obs_integration.md | 26 ++++++++++- products.d/_service | 6 ++- puppeteer/package/_service | 6 ++- rust/package/_service | 6 ++- web/package/_service | 6 ++- 14 files changed, 85 insertions(+), 24 deletions(-) diff --git a/.github/workflows/obs-staging-autoinstallation.yml b/.github/workflows/obs-staging-autoinstallation.yml index e43c9ba155..6888946a16 100644 --- a/.github/workflows/obs-staging-autoinstallation.yml +++ b/.github/workflows/obs-staging-autoinstallation.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when an autoinstallation source is changed - autoinstallation/** diff --git a/.github/workflows/obs-staging-integration-tests.yml b/.github/workflows/obs-staging-integration-tests.yml index 85cdcf8806..63c26e2461 100644 --- a/.github/workflows/obs-staging-integration-tests.yml +++ b/.github/workflows/obs-staging-integration-tests.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a source file is changed - puppeteer/** diff --git a/.github/workflows/obs-staging-live.yml b/.github/workflows/obs-staging-live.yml index 02b530129b..43d9feb8a8 100644 --- a/.github/workflows/obs-staging-live.yml +++ b/.github/workflows/obs-staging-live.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a live ISO source is changed - live/** diff --git a/.github/workflows/obs-staging-products.yml b/.github/workflows/obs-staging-products.yml index 57cca558b6..ea54b77394 100644 --- a/.github/workflows/obs-staging-products.yml +++ b/.github/workflows/obs-staging-products.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a Rust source is changed - products.d/** diff --git a/.github/workflows/obs-staging-rust.yml b/.github/workflows/obs-staging-rust.yml index e14ca8c207..d1c7a80f61 100644 --- a/.github/workflows/obs-staging-rust.yml +++ b/.github/workflows/obs-staging-rust.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a Rust source is changed - rust/** diff --git a/.github/workflows/obs-staging-service.yml b/.github/workflows/obs-staging-service.yml index c9d7cc7c08..e17e560061 100644 --- a/.github/workflows/obs-staging-service.yml +++ b/.github/workflows/obs-staging-service.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a service source is changed - service/** diff --git a/.github/workflows/obs-staging-shared.yml b/.github/workflows/obs-staging-shared.yml index 00d5b3c8ee..2e4a968983 100644 --- a/.github/workflows/obs-staging-shared.yml +++ b/.github/workflows/obs-staging-shared.yml @@ -28,8 +28,9 @@ on: jobs: update_staging_package: - # do not run in forks which do not set the OBS_PROJECT variable - if: vars.OBS_PROJECT != '' + # do not run in forks which do not set the OBS_PROJECT variable, + # for the "release" branch or a git tag use the OBS_PROJECT_RELEASE variable + if: vars.OBS_PROJECT != '' || ((github.ref_name == 'release' || github.ref_type == 'tag') && vars.OBS_PROJECT_RELEASE != '') runs-on: ubuntu-latest @@ -37,6 +38,17 @@ jobs: image: registry.opensuse.org/opensuse/tumbleweed:latest steps: + - name: Select OBS project + id: obs_project + run: |- + if [ "${{ github.ref_name }}" = "release" -o "${{ github.ref_type }}" = "tag" ]; then + echo "OBS_PROJECT=${{ vars.OBS_PROJECT_RELEASE }}" >> "$GITHUB_OUTPUT" + echo "OBS project: ${{ vars.OBS_PROJECT_RELEASE }}" + else + echo "OBS_PROJECT=${{ vars.OBS_PROJECT }}" >> "$GITHUB_OUTPUT" + echo "OBS project: ${{ vars.OBS_PROJECT }}" + fi + - name: Configure and refresh repositories # disable unused repositories to have a faster refresh run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref @@ -64,19 +76,19 @@ jobs: OBS_USER: ${{ secrets.OBS_USER }} OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} - - name: Checkout ${{ vars.OBS_PROJECT }} ${{ inputs.package_name }} - run: osc co ${{ vars.OBS_PROJECT }} ${{ inputs.package_name }} + - name: Checkout ${{ steps.obs_project.outputs.OBS_PROJECT }} ${{ inputs.package_name }} + run: osc co ${{ steps.obs_project.outputs.OBS_PROJECT }} ${{ inputs.package_name }} - name: Configure git run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Update service revision - # only when a tag has been pushed - if: ${{ github.ref_type == 'tag' }} + # only when a tag has been pushed, or "release" branch updated + if: github.ref_type == 'tag' || github.ref_name == 'release' run: |- - echo "Updating revision to ${{ github.ref_name }}" + echo "Updating revision to \"${{ github.ref_name }}\"" sed -i -e 's#.*#${{ github.ref_name }}#' _service - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} - name: Copy optional service file # patch the URL in the file so it works also from forks, forks also by @@ -84,31 +96,31 @@ jobs: # no tag is present if: inputs.service_file != '' run: | - sed -e 's#.*#https://github.com/${{ github.repository }}.git#' ${{ inputs.service_file }} > ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}/_service - if [ -z "$(git tag -l)" ]; then sed -i -e 's#.*##' ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}/_service; fi + sed -e 's#.*#https://github.com/${{ github.repository }}.git#' ${{ inputs.service_file }} > ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }}/_service + if [ -z "$(git tag -l)" ]; then sed -i -e 's#.*##' ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }}/_service; fi - name: Run services run: osc service manualrun - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} - name: Cleanup # sometimes the "osc service" run does not cleanup properly all # downloaded NPM package tarballs and they are accidentally added to the # OBS package, so delete any TGZ files present run: rm -vf *.tgz - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} - name: Check status run: osc addremove && osc diff && osc status - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} - - name: Commit ${{ inputs.package_name }} to ${{ vars.OBS_PROJECT }} + - name: Commit ${{ inputs.package_name }} to ${{ steps.obs_project.outputs.OBS_PROJECT }} run: |- osc commit -m "Updated to $(sed -e '/^version:/!d' -e 's/version: *\(.*\)/\1/' agama.obsinfo) ($(sed -e '/^commit:/!d' -e 's/commit: *\(.*\)/\1/' agama.obsinfo))" - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} - name: Submit the package # only when a tag has been pushed - if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' run: osc sr --yes -m "Releasing version ${{ github.ref_name }}" - working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }} + working-directory: ./${{ steps.obs_project.outputs.OBS_PROJECT }}/${{ inputs.package_name }} diff --git a/.github/workflows/obs-staging-web.yml b/.github/workflows/obs-staging-web.yml index bef124e2fb..6480cfda4a 100644 --- a/.github/workflows/obs-staging-web.yml +++ b/.github/workflows/obs-staging-web.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - release paths: # run only when a web frontend source is changed - web/** diff --git a/autoinstallation/package/_service b/autoinstallation/package/_service index 1a4f3d586c..264b36d000 100644 --- a/autoinstallation/package/_service +++ b/autoinstallation/package/_service @@ -1,9 +1,13 @@ - https://github.com/openSUSE/agama.git + + https://github.com/agama-project/agama.git @PARENT_TAG@+@TAG_OFFSET@ v(.*) git + master autoinstallation enable diff --git a/doc/obs_integration.md b/doc/obs_integration.md index 9b6c347b24..19c91a8ea7 100644 --- a/doc/obs_integration.md +++ b/doc/obs_integration.md @@ -10,7 +10,9 @@ - [GitHub Fork](#github-fork) - [Configuring the GitHub Actions](#configuring-the-github-actions) - [Triggering the Rebuild](#triggering-the-rebuild) - - [Package Versioning](#package-versioning) + - [Devel Package Versioning](#devel-package-versioning) + - [Release Project](#release-project) + - [Release Package Versioning](#release-package-versioning) --- @@ -183,7 +185,7 @@ Alternatively you can trigger the package submission manually. Go to the bar and in the main area click the "Run workflow" selector. Then in the popup keep the default `master` branch and click the "Run workflow" button. -## Package Versioning +### Devel Package Versioning The packages in the Devel project use a version built from the last released version with a number of commits in the `master` branch since that release. @@ -191,3 +193,23 @@ version with a number of commits in the `master` branch since that release. The version is automatically constructed by the OBS service, for the `rubygem-agama` package the version is built using the `git describe --tags` command. + +## Release Project + +For relasing a public version of Agama we use the +[systemsmanagement:Agama:Release]( +https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel) project +and respective [release](https://github.com/agama-project/agama/tree/release) +branch in Git. The reason for a separate project is that we might need to +release a hot fix but the `master` branch might already contain a new feature +for the next version. + +The integration works the same way as for the Devel project above, the only +difference is that it uses the `OBS_PROJECT_RELEASE` GitHub Action variable +to define the target OBS project to allow submitting to a different project. + +### Release Package Versioning + +The packages in the Release project use a version based on the version tag +matching `v[0-9]+`. Use `rake tag` command for creating a tag. See more details +in the [packaging documentation](../PACKAGING.md#bumping-the-version). diff --git a/products.d/_service b/products.d/_service index cd3b780e4f..881ad3ee34 100644 --- a/products.d/_service +++ b/products.d/_service @@ -1,9 +1,13 @@ - https://github.com/openSUSE/agama.git + + https://github.com/agama-project/agama.git @PARENT_TAG@+@TAG_OFFSET@ v(.*) git + master products.d enable diff --git a/puppeteer/package/_service b/puppeteer/package/_service index 440c0e63d5..f11ca977ba 100644 --- a/puppeteer/package/_service +++ b/puppeteer/package/_service @@ -2,8 +2,12 @@ @PARENT_TAG@+@TAG_OFFSET@ v(.*) - https://github.com/openSUSE/agama.git + + https://github.com/agama-project/agama.git git + master puppeteer enable diff --git a/rust/package/_service b/rust/package/_service index 597f32264c..0c4798cd4c 100644 --- a/rust/package/_service +++ b/rust/package/_service @@ -1,9 +1,13 @@ - https://github.com/openSUSE/agama.git + + https://github.com/agama-project/agama.git @PARENT_TAG@+@TAG_OFFSET@ v(.*) git + master rust enable diff --git a/web/package/_service b/web/package/_service index a1ca8be132..0e4837cff3 100644 --- a/web/package/_service +++ b/web/package/_service @@ -2,8 +2,12 @@ @PARENT_TAG@+@TAG_OFFSET@ v(.*) - https://github.com/openSUSE/agama.git + + https://github.com/agama-project/agama.git git + master web enable From 06f0fef50109832a1fb3ca2afe3c89c704206f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 30 Sep 2024 13:41:46 +0200 Subject: [PATCH 2/2] (re)moved doc/obs_integration.md file --- doc/obs_integration.md | 215 ----------------------------------------- 1 file changed, 215 deletions(-) delete mode 100644 doc/obs_integration.md diff --git a/doc/obs_integration.md b/doc/obs_integration.md deleted file mode 100644 index 19c91a8ea7..0000000000 --- a/doc/obs_integration.md +++ /dev/null @@ -1,215 +0,0 @@ -# The Open Build Service (OBS) Integration - -- [The Open Build Service (OBS) Integration](#the-open-build-service-obs-integration) - - [Development Project](#development-project) - - [Releasing a New Version](#releasing-a-new-version) - - [OBS Synchronization](#obs-synchronization) - - [Details](#details) - - [Synchronizing GitHub Fork with OBS Branch](#synchronizing-github-fork-with-obs-branch) - - [OBS Branch](#obs-branch) - - [GitHub Fork](#github-fork) - - [Configuring the GitHub Actions](#configuring-the-github-actions) - - [Triggering the Rebuild](#triggering-the-rebuild) - - [Devel Package Versioning](#devel-package-versioning) - - [Release Project](#release-project) - - [Release Package Versioning](#release-package-versioning) - ---- - -The Agama installer packages are built in the openSUSE [Open Build Service]( -https://build.opensuse.org/). - -## Development Project - -The [systemsmanagement:Agama:Devel](https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel) -contains the latest packages built from the `master` Git branch. This project -contains unstable development version of Agama. It is intended for development -and testing. - -The packages are automatically updated whenever the `master` branch is changed -or when a new version is released. See more details below. - -## Releasing a New Version - -For releasing a new version just create a new version tag. The process is then -fully automated. See more details in the [Packaging documentation]( -../PACKAGING.md#bumping-the-version). - -## OBS Synchronization - -The automatic OBS synchronization is implemented using the [GitHub Actions]( -https://github.com/features/actions). The actions are defined in the -`obs-staging-*.yml` files in the [.github/workflows](../.github/workflows) -directory. - -Because the process of updating a package is the same for several packages -the definition is shared in the [obs-staging-shared.yml]( -../.github/workflows/obs-staging-shared.yml) file. - -The packages in the devel project are updated only when a respective source -file is changed. That saves some resources for rebuilding and makes -synchronization faster. But that also means the packages might not have exactly -the same version. - -The project to which the packages are submitted is configured in the -`OBS_PROJECT` GitHub Actions variable. - -### Details - -The packages in OBS are updated by running the OBS service which downloads the -sources from GitHub and dependencies from other repositories (Rust or NPM -packages). - -The process of updating a package is basically: - -- `osc co systemsmanagement:Agama:Devel ` - checkout the package - from OBS -- `osc service manualrun` - update the sources and dependencies by running - the OBS services locally -- `osc commit` - upload the changes to the OBS server, it will rebuild the - updated package automatically - -To run the services locally you need to install the OSC tool and several -packages with the used OBS services: - -```shell -zypper install osc obs-service-cargo_audit obs-service-cargo_vendor \ - obs-service-download_files obs-service-format_spec_file obs-service-obs_scm \ - obs-service-node_modules -``` - -The `rubygem-agama` package uses a different approach because the Ruby packages -use `*.gem` files which are not supported by OBS services. It uses the -[osc:commit](https://github.com/openSUSE/packaging_rake_tasks#osccommit) Rake -task, same as the YaST packages. - -## Synchronizing GitHub Fork with OBS Branch - -It is possible to synchronize your GitHub fork with your OBS brach -automatically. This allows easily build your own updated packages or even the -Live ISO. - -### OBS Branch - -First you need to create an OBS project where the packages will be built. - -The easiest way is to branch the Agama package which you want to modify from the -[systemsmanagement:Agama:Devel]( -https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel) -repository. This will inherit the repository setup for building the packages, -images and containers. - -``` shell -osc branch systemsmanagement:Agama:Devel agama-web-ui -``` - -This will create `home:$OBS_USER:branches:systemsmanagement:Agama:Devel` -project where `$OBS_USER` is your OBS account name. This `$OBS_USER` placeholder -is also used in the following text. - -By default the project will build packages and ISO images for all architectures. -But if you want to test the packages on a single architecture then it is a good -idea to remove the other architectures and save some OBS build power. - -To remove all architectures except the x86_64 run this command: - -``` shell -osc meta prj home:$OBS_USER:branches:systemsmanagement:Agama:Devel | \ -sed "/aarch64<\/arch>/d;/i586<\/arch>/d;/ppc64le<\/arch>/d;/s390x<\/arch>/d;" | \ -osc meta prj -F - home:$OBS_USER:branches:systemsmanagement:Agama:Devel -``` - -The branched package is still linked to the original package. This might cause -conflicts after the original package is updated. To avoid this problem you -should detach the branched package from the original repository: - -``` shell -osc detachbranch home:$OBS_USER:branches:systemsmanagement:Agama:Devel agama-web-ui -``` - -If you want to also build the Live ISO from your modified packaged then you need -to branch (and detach) also the `agama-installer` package: - -``` shell -osc branch systemsmanagement:Agama:Devel agama-installer -osc detachbranch home:$OBS_USER:branches:systemsmanagement:Agama:Devel agama-installer -``` - -*Please delete your branched OBS project once you do not need it anymore, it -will save quite some OBS build power.* - -### GitHub Fork - -Then you can fork the [Agama](https://github.com/openSUSE/agama) repository at -GitHub. - -When creating a fork GitHub by default copies only the `master` branch. It does -not copy the other branches nor tags. The code supports this option, just be -prepared that the package versions might be different than in the original Agama -OBS repository because the tags are used to get the version number. If tags are -missing the version will be set to the commit Unix time stamp followed by a -short commit hash. - -If you want to have similar versions as the original packages then create a full -fork including all branches and tags (unselect the "Copy the master branch only" -option). - -### Configuring the GitHub Actions - -The GitHub Actions needs some configuration to allow the automatic submission. - -1. Go to the Settings -> Secrets and variables -> Actions -> New Repository - Secret option in your Agama GitHub fork. Create two secrets with names - `OBS_USER` and `OBS_PASSWORD` and set them to your OBS credentials. - - Tip: If you do not want to put your credentials for your main OBS account - to GitHub then you might create a new separate testing OBS account. - -2. Switch to "Variables" tabs and click "New Repository Variable". - Create `OBS_PROJECT` variable with name of your OBS branch project - ("home:$OBS_USER:branches:systemsmanagement:Agama:Devel"). If the variable - is not created or is empty the autosubmission is disabled. - -3. Enable the GitHub Actions in the "Actions" tab. - -### Triggering the Rebuild - -*The autosubmission only works in the `master` branch in your fork, not in any -other branch!* - -To trigger an update and rebuild of your package with the new sources just push -a commit to the `master` branch. - -Alternatively you can trigger the package submission manually. Go to the -"Action" tab in GitHub, select the respective "Submit" action in the left side -bar and in the main area click the "Run workflow" selector. Then in the popup -keep the default `master` branch and click the "Run workflow" button. - -### Devel Package Versioning - -The packages in the Devel project use a version built from the last released -version with a number of commits in the `master` branch since that release. - -The version is automatically constructed by the OBS service, for the -`rubygem-agama` package the version is built using the `git describe --tags` -command. - -## Release Project - -For relasing a public version of Agama we use the -[systemsmanagement:Agama:Release]( -https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel) project -and respective [release](https://github.com/agama-project/agama/tree/release) -branch in Git. The reason for a separate project is that we might need to -release a hot fix but the `master` branch might already contain a new feature -for the next version. - -The integration works the same way as for the Devel project above, the only -difference is that it uses the `OBS_PROJECT_RELEASE` GitHub Action variable -to define the target OBS project to allow submitting to a different project. - -### Release Package Versioning - -The packages in the Release project use a version based on the version tag -matching `v[0-9]+`. Use `rake tag` command for creating a tag. See more details -in the [packaging documentation](../PACKAGING.md#bumping-the-version).