Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f42a7f9
GitHub Actions: update systemsmanagement:Agama:Staging/agama-cli in OBS
lslezak Jun 6, 2023
e8a7e5e
Update playwright test package
lslezak Jun 6, 2023
5a028e4
Update cockpit-agama package
lslezak Jun 6, 2023
7f9f130
Update rubygem-agama package
lslezak Jun 6, 2023
2d045b1
Fixed cloning
lslezak Jun 6, 2023
9d01210
Fix file owener
lslezak Jun 6, 2023
4c8f9b8
Better commit message
lslezak Jun 6, 2023
2acd243
Even better commit message :smiley:
lslezak Jun 6, 2023
d65617f
Try using a shared workflow
lslezak Jun 7, 2023
24bd453
input test
lslezak Jun 7, 2023
d2aa129
Use inputs
lslezak Jun 7, 2023
54a07cf
Added badges
lslezak Jun 7, 2023
5fe6744
Share workflows
lslezak Jun 7, 2023
3251e38
inline osc configuration
lslezak Jun 7, 2023
7872d26
Delete workflow scripts
lslezak Jun 7, 2023
d7e5231
Fixed updating rubygem-gama
lslezak Jun 7, 2023
5bfd9dd
Generate the gem version
lslezak Jun 7, 2023
3dd3a6d
Install yast-rake
lslezak Jun 7, 2023
1a34416
Install build
lslezak Jun 7, 2023
029ec01
Trust project
lslezak Jun 7, 2023
a65e547
Trust project
lslezak Jun 7, 2023
ba69735
Install sudo
lslezak Jun 7, 2023
68fb777
Privileged container
lslezak Jun 7, 2023
d7b4611
Install obs-service-format_spec_file
lslezak Jun 7, 2023
3e65fc0
Skip package build
lslezak Jun 7, 2023
594e444
Install obs-service-format_spec_file
lslezak Jun 7, 2023
44b5181
Revert "Delete workflow scripts"
lslezak Jun 8, 2023
e7b04e2
Configure osc using a script
lslezak Jun 8, 2023
56a8a83
use shared script
lslezak Jun 8, 2023
ec2b620
Added documentation
lslezak Jun 8, 2023
7e60c7b
Prepare for merge to master
lslezak Jun 8, 2023
85b4fd7
Update README
lslezak Jun 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/configure_osc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash

# This helper script creates the "osc" configuration file with OBS credentials

CONFIG_FILE="$HOME/.config/osc/oscrc"

# do not overwrite the existing config accidentally
if [ -e "$CONFIG_FILE" ]; then
echo "ERROR: $CONFIG_FILE already exists"
exit 1
fi

TEMPLATE=$(dirname "${BASH_SOURCE[0]}")/oscrc.template
mkdir -p $(dirname "$CONFIG_FILE")
sed -e "s/@OBS_USER@/$OBS_USER/g" -e "s/@OBS_PASSWORD@/$OBS_PASSWORD/g" "$TEMPLATE" > "$CONFIG_FILE"
18 changes: 18 additions & 0 deletions .github/workflows/obs-staging-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: OBS:Staging (cockpit-agama-playwright)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
paths:
# run only when a Playwright source is changed
- playwright/**

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
package_name: cockpit-agama-playwright
19 changes: 19 additions & 0 deletions .github/workflows/obs-staging-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: OBS:Staging (agama-cli)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
paths:
# run only when a Rust source is changed
- rust/**

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
install_packages: obs-service-cargo_audit obs-service-cargo_vendor
package_name: agama-cli
58 changes: 58 additions & 0 deletions .github/workflows/obs-staging-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: OBS:Staging (rubygem-agama)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
paths:
# run only when a service source is changed
- service/**

jobs:
update_staging:
# do not run in forks
if: github.repository == 'openSUSE/agama'

runs-on: ubuntu-latest

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest

steps:
- 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

- name: Install tools
run: zypper --non-interactive install --no-recommends
git
obs-service-format_spec_file
osc
ruby
'rubygem(gem2rpm)'
'rubygem(yast-rake)'

- name: Git Checkout
uses: actions/checkout@v3
with:
# fetch all history, we need to find the latest tag and offset for the version number
fetch-depth: 0

- name: Fix file owner
# workaround for a strict git check
run: chown -R -c 0 .

- name: Configure osc
run: .github/workflows/configure_osc.sh
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }}

- name: Commit the rubygem-agama package
run: rake osc:commit
working-directory: ./service
env:
# do not build the package with "osc", it takes long time
# and does not provide much value
SKIP_OSC_BUILD: 1
71 changes: 71 additions & 0 deletions .github/workflows/obs-staging-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# this is a shared workflow, not called as a top level workflow

name: Update OBS Staging

on:
workflow_call:
secrets:
OBS_USER:
required: true
OBS_PASSWORD:
required: true

inputs:
install_packages:
description: Additional packages to install
required: false
type: string

package_name:
description: OBS package name
required: true
type: string

jobs:
update_staging_package:
# do not run in forks
if: github.repository == 'openSUSE/agama'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we here also force only master branch?


runs-on: ubuntu-latest

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest

steps:
- name: Git Checkout
uses: actions/checkout@v3

- 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

- name: Install tools
run: zypper --non-interactive install --no-recommends
cpio
obs-service-download_files
obs-service-format_spec_file
obs-service-obs_scm
osc
${{ inputs.install_packages }}

- name: Configure osc
run: .github/workflows/configure_osc.sh
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }}

- name: Checkout ${{ inputs.package_name }}
run: osc co systemsmanagement:Agama:Staging ${{ inputs.package_name }}

- name: Run services
run: osc service manualrun
working-directory: ./systemsmanagement:Agama:Staging/${{ inputs.package_name }}

- name: Check status
run: osc status
working-directory: ./systemsmanagement:Agama:Staging/${{ inputs.package_name }}

- name: Commit ${{ inputs.package_name }}
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: ./systemsmanagement:Agama:Staging/${{ inputs.package_name }}
19 changes: 19 additions & 0 deletions .github/workflows/obs-staging-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: OBS:Staging (cockpit-agama)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
paths:
# run only when a web frontend source is changed
- web/**

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
install_packages: obs-service-node_modules
package_name: cockpit-agama
7 changes: 7 additions & 0 deletions .github/workflows/oscrc.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[general]
apiurl = https://api.opensuse.org

[https://api.opensuse.org]
user=@OBS_USER@
pass=@OBS_PASSWORD@
credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
[![CI Status](https://github.com/openSUSE/agama/actions/workflows/ci.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/openSUSE/agama/badge.svg?branch=master)](https://coveralls.io/github/openSUSE/agama?branch=master)

**[OBS systemsmanagement:Agama:Staging](https://build.opensuse.org/project/show/systemsmanagement:Agama:Staging)**

[![OBS Staging (agama-cli)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml)
[![OBS:Staging (cockpit-agama)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-web.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-web.yml)
[![OBS:Staging (rubygem-agama)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml)
[![OBS:Staging (cockpit-agama-playwright)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-playwright.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-playwright.yml)

# Agama: A Service-based Linux Installer

Agama is a new Linux installer born in the core of the YaST team. It is designed to offer re-usability, integration with third party tools and the possibility of building advanced user interfaces over it.
Expand Down
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ end

# Removes the "package" task to redefine it later.
Rake::Task["package"].clear

# Disables the osc:build
# Rake::Task["osc:build"].clear
if ENV["SKIP_OSC_BUILD"] == "1"
Rake::Task["osc:build"].clear
end

# TODO: redefine :tarball instead of :package
desc "Prepare sources for rpm build"
Expand All @@ -87,7 +90,7 @@ task package: [] do
sh "gem build #{name}.gemspec"
gem = find_gem(dir).first
gem2rpm = File.join(package_dir, "gem2rpm.yml")
sh "gem2rpm --config #{gem2rpm} --template opensuse #{gem} > package/#{package_name}.spec"
sh "gem2rpm --local --config #{gem2rpm} --template opensuse #{gem} > package/#{package_name}.spec"
FileUtils.mv(gem, package_dir)
end
end
Expand Down
82 changes: 82 additions & 0 deletions doc/obs_integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# The Open Build Service (OBS) Integration

The Agama installer packages are built in the openSUSE [Open Build Service](
https://build.opensuse.org/).

## Staging Project

The [systemsmanagement:Agama:Staging](https://build.opensuse.org/project/show/systemsmanagement:Agama:Staging)
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,
see more details below.

## Development Project

The [systemsmanagement:Agama:Devel](https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel)
contains the latest released version of the Agama project. The packages should
be more stable than in the Staging project.

These packages are updated manually when a new version is released.

## 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 staging 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 same version.

### 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:Staging <package>` - 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.

### Package Versioning

### Staging

The packages in the Staging 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.

### Devel

The Devel packages use the release version (a Git tag) without any additional
number of commits.
2 changes: 2 additions & 0 deletions service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.gem
# the spec file is generated
/package/*.spec
*.rbc
/.config
/coverage/
Expand Down
1 change: 0 additions & 1 deletion service/VERSION

This file was deleted.

4 changes: 3 additions & 1 deletion service/agama.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

Gem::Specification.new do |spec|
spec.name = "agama"
spec.version = File.read("VERSION").chomp
# the version is <version_tag>.devel<number_of_commits_since_the_tag>
# or just <version_tag> if there are no additional commits
spec.version = `git describe --tags`.chomp.sub(/^v/, "").sub(/-([0-9]+)-g\h+\Z/, ".devel\\1")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

spec.summary = "Agama Installer Service"
spec.description = "System service for Agama, an experimental YaST-based installer."
spec.author = "YaST Team"
Expand Down