Skip to content

Commit

Permalink
Cockpit removal, Live ISO fixes (#1191)
Browse files Browse the repository at this point in the history
## Problem

- Fix Agama to work without Cockpit

## Solution

This pull request contains several improvements:

- Use `actions/checkout@v4` in the GitHub Actions, the `v3` is
deprecated because it uses old Node.js version 16 which is out of
support, `v4` uses Node.js version 20. *(Later we should probably do
this change in YaST repos as well...)*
- Do not hardcode the target OBS project
(`systemsmanagement:Agama:Staging`) in the GitHub actions code, make it
configurable using GitHub Action variable `OBS_PROJECT`. This allows
automatic submitting from your Git fork to your OBS branch and build
your own Live ISO easily. *(I'll document it in a separate PR, this PR
is already too long and I need to do it from scratch to not forget some
step I did.* :smile: *)*
- The submit GitHub Actions can be now started manually from the GitHub
web UI. Again, this is useful in forks.
- Removed `manifest.json` file, not needed anymore
- Removed some Cockpit configuration files from the Live ISO
- Deleted duplicated `agama.kiwi` and `config.sh` files (I made a
mistake when adding to Git). The ALP removal was re-applied to the
correct files.
- Added `user.js.template` file to set the Firefox home page correctly
- Package `cockpit-agama-playwright` renamed to `agama-playwright`
- Added some `_service` files from OBS to track them in Git as well
- Do not load Cockpit's `manifests.js` file in `index.html`, not needed
anymore
- Updated documentation about `languages.json`

## Testing

- Tested manually
- The Live ISO starts Agama and it can be used both locally and remotely
(see
https://build.opensuse.org/package/show/home:lslezak:branches:systemsmanagement:Agama:Staging/agama-live)
  • Loading branch information
lslezak authored May 10, 2024
2 parents 9801ef2 + a358ee8 commit 6534030
Show file tree
Hide file tree
Showing 40 changed files with 166 additions and 473 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-doc-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
steps:

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

- name: Fix the file owner
# fix the file owner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# TODO: Cache the Ruby gems and node packages

- name: Git Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# fetch complete history with tags, agama.gemspec calls "git describe --tags"
# that would fail with just last commit checked out
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
steps:

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

- name: Rubocop
run: /usr/bin/rubocop.*-1.24.1
2 changes: 1 addition & 1 deletion .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
steps:

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

- name: Configure and refresh repositories
# disable unused repositories to have faster refresh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
steps:

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

- name: Configure and refresh repositories
# disable unused repositories to have faster refresh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install DocBook tooling
run: |
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/obs-service-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ on:
OBS_PASSWORD:
required: true

inputs:
project_name:
description: OBS project name
required: true
type: string

jobs:
update_service:
# do not run in forks
if: github.repository == 'openSUSE/agama'
# do not run in forks which do not set the OBS_PROJECT variable
if: vars.OBS_PROJECT != ''

runs-on: ubuntu-latest

Expand All @@ -34,6 +28,7 @@ jobs:
- name: Install tools
run: zypper --non-interactive install --no-recommends
bzip2
diffutils
git
obs-service-format_spec_file
osc
Expand All @@ -43,33 +38,32 @@ jobs:

- name: Git Checkout (full history)
if: ${{ github.ref_type != 'tag' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# fetch all history, we need to find the latest tag and offset for the version number
fetch-depth: 0

- name: Git Checkout (release tag only)
if: ${{ github.ref_type == 'tag' }}
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Fix file owner
# workaround for a strict git check
run: chown -R -c 0 .
- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- 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-yast package to ${{ inputs.project_name }}
- name: Commit the rubygem-agama-yast package to ${{ vars.OBS_PROJECT }}
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
OBS_PROJECT: ${{ inputs.project_name }}
OBS_PROJECT: ${{ vars.OBS_PROJECT }}

- name: Submit the rubygem-agama-yast package
# only when a tag has been pushed
Expand All @@ -78,4 +72,4 @@ jobs:
run: rake osc:sr:force
working-directory: ./service
env:
OBS_PROJECT: ${{ inputs.project_name }}
OBS_PROJECT: ${{ vars.OBS_PROJECT }}
24 changes: 15 additions & 9 deletions .github/workflows/obs-staging-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,42 @@ on:
# run only when a live ISO source is changed
- live/**

# allow running manually
workflow_dispatch:

jobs:
update_staging_package:
# do not run in forks
if: github.repository_owner == 'openSUSE'
# do not run in forks which do not set the OBS_PROJECT variable
if: vars.OBS_PROJECT != ''

runs-on: ubuntu-latest

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

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

- 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
make osc
git make osc

- name: Git Checkout
uses: actions/checkout@v4

- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

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

- name: Checkout agama-live
run: osc co -o dist systemsmanagement:Agama:Staging agama-live
- name: Checkout ${{ vars.OBS_PROJECT }} agama-live
run: osc co -o dist ${{ vars.OBS_PROJECT }} agama-live
working-directory: ./live

- name: Build sources
Expand All @@ -53,6 +59,6 @@ jobs:
run: osc diff && osc status
working-directory: ./live/dist

- name: Commit agama-live
- name: Commit agama-live to ${{ vars.OBS_PROJECT }}
run: osc commit -m "Updated to Agama $GITHUB_SHA"
working-directory: ./live/dist
9 changes: 6 additions & 3 deletions .github/workflows/obs-staging-playwright.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Submit cockpit-agama-playwright
name: Submit agama-playwright

on:
# runs on pushes targeting the default branch
Expand All @@ -9,11 +9,14 @@ on:
# run only when a Playwright source is changed
- playwright/**

# allow running manually
workflow_dispatch:

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
project_name: systemsmanagement:Agama:Staging
package_name: cockpit-agama-playwright
package_name: agama-playwright
service_file: playwright/package/_service
5 changes: 4 additions & 1 deletion .github/workflows/obs-staging-products.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ on:
# run only when a Rust source is changed
- products.d/**

# allow running manually
workflow_dispatch:

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
project_name: systemsmanagement:Agama:Staging
package_name: agama-products-opensuse
service_file: products.d/_service
7 changes: 5 additions & 2 deletions .github/workflows/obs-staging-rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Submit agama-cli
name: Submit agama

on:
# runs on pushes targeting the default branch
Expand All @@ -9,12 +9,15 @@ on:
# run only when a Rust source is changed
- rust/**

# allow running manually
workflow_dispatch:

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
project_name: systemsmanagement:Agama:Staging
package_name: agama
service_file: rust/package/_service
5 changes: 3 additions & 2 deletions .github/workflows/obs-staging-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ on:
- service/**
- Rakefile

# allow running manually
workflow_dispatch:

jobs:
update_service:
uses: ./.github/workflows/obs-service-shared.yml
# pass all secrets
secrets: inherit
with:
project_name: systemsmanagement:Agama:Staging
49 changes: 32 additions & 17 deletions .github/workflows/obs-staging-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,70 +21,85 @@ on:
required: true
type: string

project_name:
description: OBS project name
required: true
service_file:
description: Optional service file to copy from the sources
required: false
type: string

jobs:
update_staging_package:
# do not run in forks
if: github.repository == 'openSUSE/agama'
# do not run in forks which do not set the OBS_PROJECT variable
if: vars.OBS_PROJECT != ''

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

- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-tags: true

- 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 ${{ inputs.project_name }} ${{ inputs.package_name }}
- name: Checkout ${{ vars.OBS_PROJECT }} ${{ inputs.package_name }}
run: osc co ${{ vars.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' }}
run: |-
echo "Updating revision to ${{ github.ref_name }}"
sed -i -e 's#<param name="revision">.*</param>#<param name="revision">${{ github.ref_name }}</param>#' _service
working-directory: ./${{ inputs.project_name }}/${{ inputs.package_name }}
working-directory: ./${{ vars.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
# default do not inherit the tags so remove the version format option if
# no tag is present
if: inputs.service_file != ''
run: |
sed -e 's#<param name="url">.*</param>#<param name="url">https://github.com/${{ github.repository }}.git</param>#' ${{ inputs.service_file }} > ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}/_service
if [ -z "$(git tag -l)" ]; then sed -i -e 's#<param name="versionformat">.*</param>##' ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}/_service; fi
- name: Run services
run: osc service manualrun
working-directory: ./${{ inputs.project_name }}/${{ inputs.package_name }}
working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}

- name: Check status
run: osc diff && osc status
working-directory: ./${{ inputs.project_name }}/${{ inputs.package_name }}
run: osc addremove && osc diff && osc status
working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}

- name: Commit ${{ inputs.package_name }}
- name: Commit ${{ inputs.package_name }} to ${{ vars.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: ./${{ inputs.project_name }}/${{ inputs.package_name }}
working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}

- name: Submit the package
# only when a tag has been pushed
if: ${{ github.ref_type == 'tag' }}
run: osc sr --yes -m "Releasing version ${{ github.ref_name }}"
working-directory: ./${{ inputs.project_name }}/${{ inputs.package_name }}
working-directory: ./${{ vars.OBS_PROJECT }}/${{ inputs.package_name }}
9 changes: 6 additions & 3 deletions .github/workflows/obs-staging-web.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Submit cockpit-agama
name: Submit agama-web-ui

on:
# runs on pushes targeting the default branch
Expand All @@ -9,12 +9,15 @@ on:
# run only when a web frontend source is changed
- web/**

# allow running manually
workflow_dispatch:

jobs:
update_staging:
uses: ./.github/workflows/obs-staging-shared.yml
# pass all secrets
secrets: inherit
with:
install_packages: obs-service-node_modules
project_name: systemsmanagement:Agama:Staging
package_name: cockpit-agama
package_name: agama-web-ui
service_file: web/package/_service
Loading

0 comments on commit 6534030

Please sign in to comment.