Skip to content

Commit

Permalink
Merge e7b04e2 into 321f62c
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Jun 8, 2023
2 parents 321f62c + e7b04e2 commit 27c0a49
Show file tree
Hide file tree
Showing 12 changed files with 244 additions and 4 deletions.
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"
22 changes: 22 additions & 0 deletions .github/workflows/obs-staging-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: OBS:Staging (cockpit-agama-playwright)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
# FIXME: remove this before merging
- obs_sync
# FIXME: enable before merging
# paths:
# # run only when a Playwright source is changed
# # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
# - playwright/**

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

on:
# runs on pushes targeting the default branch
push:
branches:
- master
# FIXME: remove this before merging
- obs_sync
# FIXME: enable before merging
# paths:
# # run only when a Rust source is changed
# # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
# - 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
60 changes: 60 additions & 0 deletions .github/workflows/obs-staging-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: OBS:Staging (rubygem-agama)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
# FIXME: remove this before merging
- obs_sync
# FIXME: enable before merging
# paths:
# # run only when a service source is changed
# # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
# - 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:
SKIP_OSC_BUILD: 1
77 changes: 77 additions & 0 deletions .github/workflows/obs-staging-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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'

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
cpio
obs-service-download_files
obs-service-format_spec_file
obs-service-obs_scm
osc
${{ inputs.install_packages }}

- name: Configure osc
run: |-
CONFIG_FILE="$HOME/.config/osc/oscrc"
mkdir -p $(dirname "$CONFIG_FILE")
echo "$TEMPLATE" > "$CONFIG_FILE"
env:
TEMPLATE: |-
[general]
apiurl = https://api.opensuse.org
[https://api.opensuse.org]
user=${{ secrets.OBS_USER }}
pass=${{ secrets.OBS_PASSWORD }}
credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager
- 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 }}
23 changes: 23 additions & 0 deletions .github/workflows/obs-staging-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: OBS:Staging (cockpit-agama)

on:
# runs on pushes targeting the default branch
push:
branches:
- master
# FIXME: remove this before merging
- obs_sync
# FIXME: enable before merging
# paths:
# # run only when a web frontend source is changed
# # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
# - 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
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")
spec.summary = "Agama Installer Service"
spec.description = "System service for Agama, an experimental YaST-based installer."
spec.author = "YaST Team"
Expand Down

0 comments on commit 27c0a49

Please sign in to comment.