mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
Merge branch 'main' into ubi
This commit is contained in:
commit
5422832332
45 changed files with 1021 additions and 541 deletions
17
.github/dependabot.yml
vendored
Normal file
17
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||||
|
directory: "/external" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "lorax"
|
||||||
22
.github/workflows/bot_commands.yml
vendored
22
.github/workflows/bot_commands.yml
vendored
|
|
@ -78,6 +78,22 @@ jobs:
|
||||||
RH_REPO: ${{ secrets.RH_REPO }}
|
RH_REPO: ${{ secrets.RH_REPO }}
|
||||||
RH_ENT: ${{ secrets.RH_ENT }}
|
RH_ENT: ${{ secrets.RH_ENT }}
|
||||||
|
|
||||||
|
run_build_iso:
|
||||||
|
name: Run Build ISO
|
||||||
|
if: >
|
||||||
|
github.event.issue.pull_request &&
|
||||||
|
contains(github.event.comment.body, '/run build iso')
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
statuses: write
|
||||||
|
needs:
|
||||||
|
- permissions
|
||||||
|
uses: ./.github/workflows/build_iso.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ github.event.issue.number }}
|
||||||
|
parent_job_name: Run Build ISO
|
||||||
|
|
||||||
run_test_iso:
|
run_test_iso:
|
||||||
name: Run ISO Tests
|
name: Run ISO Tests
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -92,9 +108,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.issue.number }}
|
pr: ${{ github.event.issue.number }}
|
||||||
parent_job_name: Run ISO Tests
|
parent_job_name: Run ISO Tests
|
||||||
iso_name-38: ${{ needs.load_vars.outputs.IMAGE_NAME }}-38.iso
|
|
||||||
iso_name-39: ${{ needs.load_vars.outputs.IMAGE_NAME }}-39.iso
|
|
||||||
iso_name-40: ${{ needs.load_vars.outputs.IMAGE_NAME }}-40.iso
|
|
||||||
|
|
||||||
run_test_deployment:
|
run_test_deployment:
|
||||||
name: Run ISO Deployment Tests
|
name: Run ISO Deployment Tests
|
||||||
|
|
@ -110,6 +123,3 @@ jobs:
|
||||||
with:
|
with:
|
||||||
pr: ${{ github.event.issue.number }}
|
pr: ${{ github.event.issue.number }}
|
||||||
parent_job_name: Run ISO Deployment Tests
|
parent_job_name: Run ISO Deployment Tests
|
||||||
iso_name-38: ${{ needs.load_vars.outputs.IMAGE_NAME }}-38.iso
|
|
||||||
iso_name-39: ${{ needs.load_vars.outputs.IMAGE_NAME }}-39.iso
|
|
||||||
iso_name-40: ${{ needs.load_vars.outputs.IMAGE_NAME }}-40.iso
|
|
||||||
7
.github/workflows/build_container.yml
vendored
7
.github/workflows/build_container.yml
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: Build Container
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -89,8 +91,9 @@ jobs:
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern=v{{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern=v{{major}}.{{minor}}
|
||||||
|
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
|
||||||
|
|
||||||
- name: Docker meta for PR
|
- name: Docker meta for PR
|
||||||
if: inputs.pr
|
if: inputs.pr
|
||||||
|
|
|
||||||
65
.github/workflows/build_iso.yml
vendored
65
.github/workflows/build_iso.yml
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: Build ISO
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -7,21 +9,20 @@ on:
|
||||||
parent_job_name:
|
parent_job_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
flatpaks_refs:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
flatpaks_refs_dir:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
suffix:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
RH_REPO:
|
RH_REPO:
|
||||||
required: true
|
required: true
|
||||||
RH_ENT:
|
RH_ENT:
|
||||||
required: true
|
required: true
|
||||||
outputs:
|
|
||||||
iso_name-38:
|
|
||||||
description: "Version 38 ISO Name"
|
|
||||||
value: ${{ jobs.build_iso.outputs.iso_name-38 }}
|
|
||||||
iso_name-39:
|
|
||||||
description: "Version 39 ISO Name"
|
|
||||||
value: ${{ jobs.build_iso.outputs.iso_name-39 }}
|
|
||||||
iso_name-40:
|
|
||||||
description: "Version 40 ISO Name"
|
|
||||||
value: ${{ jobs.build_iso.outputs.iso_name-40 }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
load_vars:
|
load_vars:
|
||||||
|
|
@ -43,19 +44,11 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
version:
|
version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }}
|
||||||
- 8
|
|
||||||
- 38
|
|
||||||
- 39
|
|
||||||
- 40
|
|
||||||
include:
|
include:
|
||||||
- version: 8
|
- version: 8
|
||||||
image_tag: 39
|
image_tag: 39
|
||||||
rhel: true
|
rhel: true
|
||||||
outputs:
|
|
||||||
iso_name-38: ${{ steps.save_output.outputs.iso_name-38 }}
|
|
||||||
iso_name-39: ${{ steps.save_output.outputs.iso_name-39 }}
|
|
||||||
iso_name-40: ${{ steps.save_output.outputs.iso_name-40 }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -91,6 +84,22 @@ jobs:
|
||||||
sha: ${{ env.sha }}
|
sha: ${{ env.sha }}
|
||||||
targetUrl: ${{ steps.jobs.outputs.html_url }}
|
targetUrl: ${{ steps.jobs.outputs.html_url }}
|
||||||
|
|
||||||
|
- name: Free Disk Space (Ubuntu)
|
||||||
|
uses: jlumbroso/free-disk-space@main
|
||||||
|
with:
|
||||||
|
# this might remove tools that are actually needed,
|
||||||
|
# if set to "true" but frees about 6 GB
|
||||||
|
tool-cache: false
|
||||||
|
|
||||||
|
# all of these default to true, but feel free to set to
|
||||||
|
# "false" if necessary for your workflow
|
||||||
|
android: true
|
||||||
|
dotnet: true
|
||||||
|
haskell: true
|
||||||
|
large-packages: true
|
||||||
|
docker-images: true
|
||||||
|
swap-storage: true
|
||||||
|
|
||||||
- name: Lowercase Registry
|
- name: Lowercase Registry
|
||||||
id: registry_case
|
id: registry_case
|
||||||
uses: ASzc/change-string-case-action@v6
|
uses: ASzc/change-string-case-action@v6
|
||||||
|
|
@ -128,27 +137,22 @@ jobs:
|
||||||
image_tag: ${{ matrix.image_tag || matrix.version }}
|
image_tag: ${{ matrix.image_tag || matrix.version }}
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
variant: ${{ needs.load_vars.outputs.VARIANT }}
|
variant: ${{ needs.load_vars.outputs.VARIANT }}
|
||||||
flatpak_remote_refs_dir: ${{ ( ! matrix.rhel ) && format('/github/workspace/{0}', needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR ) || '' }}
|
flatpak_remote_refs: ${{ inputs.flatpaks_refs }}
|
||||||
|
flatpak_remote_refs_dir: ${{ inputs.flatpaks_refs_dir }}
|
||||||
secure_boot_key_url: ${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }}
|
secure_boot_key_url: ${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }}
|
||||||
enrollment_password: ${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }}
|
enrollment_password: ${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }}
|
||||||
iso_name: ${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}.iso
|
iso_name: build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso
|
||||||
secrets_dir: ${{ matrix.rhel && format('{0}/ubi', github.workspace) || '' }}
|
secrets_dir: ${{ matrix.rhel && format('{0}/ubi', github.workspace) || '' }}
|
||||||
repos: ${{ matrix.rhel && '/etc/yum.repos.d/redhat.repo' || '/etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo' }}
|
repos: ${{ matrix.rhel && '/etc/yum.repos.d/redhat.repo' || '/etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo' }}
|
||||||
|
|
||||||
- name: Save output
|
|
||||||
id: save_output
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "iso_name-${{ matrix.version }}=${{ steps.build.outputs.iso_name}}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Upload ISO as artifact
|
- name: Upload ISO as artifact
|
||||||
id: upload
|
id: upload
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.build.outputs.iso_name }}
|
name: ${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}
|
||||||
path: |
|
path: |
|
||||||
${{ steps.build.outputs.iso_path }}
|
build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso
|
||||||
${{ steps.build.outputs.iso_path }}-CHECKSUM
|
build/${{ needs.load_vars.outputs.IMAGE_NAME }}-${{ matrix.version }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso-CHECKSUM
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 0
|
retention-days: 0
|
||||||
compression-level: 0
|
compression-level: 0
|
||||||
|
|
@ -163,3 +167,4 @@ jobs:
|
||||||
context: ${{ env.JOB_NAME }} (${{ matrix.version }})
|
context: ${{ env.JOB_NAME }} (${{ matrix.version }})
|
||||||
sha: ${{ env.sha }}
|
sha: ${{ env.sha }}
|
||||||
targetUrl: ${{ steps.jobs.outputs.html_url }}
|
targetUrl: ${{ steps.jobs.outputs.html_url }}
|
||||||
|
|
||||||
|
|
|
||||||
4
.github/workflows/build_vars.yml
vendored
4
.github/workflows/build_vars.yml
vendored
|
|
@ -1,8 +1,12 @@
|
||||||
|
name: Build Vars
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
outputs:
|
outputs:
|
||||||
ARCH:
|
ARCH:
|
||||||
value: 'x86_64'
|
value: 'x86_64'
|
||||||
|
BUILD_VERSIONS:
|
||||||
|
value: '[38, 39, 40]'
|
||||||
IMAGE_NAME:
|
IMAGE_NAME:
|
||||||
value: 'base'
|
value: 'base'
|
||||||
IMAGE_REPO:
|
IMAGE_REPO:
|
||||||
|
|
|
||||||
143
.github/workflows/clean_repo.yml
vendored
Normal file
143
.github/workflows/clean_repo.yml
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
name: Clean Container Registry
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 21 * * 0'
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
delete_untagged:
|
||||||
|
name: Delete Untagged Packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Delete Untagged Packages
|
||||||
|
uses: Chizkiyahu/delete-untagged-ghcr-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PACKAGE_DELETER }}
|
||||||
|
repository_owner: ${{ github.repository_owner }}
|
||||||
|
repository: ${{ github.repository }}
|
||||||
|
untagged_only: true
|
||||||
|
owner_type: user
|
||||||
|
|
||||||
|
delete_old_pr:
|
||||||
|
name: Delete Old PR Packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: read
|
||||||
|
steps:
|
||||||
|
- name: Delete Old PR Packages
|
||||||
|
id: all_tags
|
||||||
|
run: |
|
||||||
|
curl -L \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
"https://api.github.com/user/packages/container/build-container-installer/versions" > all_packages.json
|
||||||
|
curl -L \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/pulls | \
|
||||||
|
jq -r '.[] | select(.state == "open") | .number' | \
|
||||||
|
sed 's/^/pr-/g' > open_prs
|
||||||
|
cat << EOF | python
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
prs = open("open_prs", "r")
|
||||||
|
open_prs = prs.readlines()
|
||||||
|
open_prs = [x.strip() for x in open_prs]
|
||||||
|
|
||||||
|
all_packages = open('all_packages.json')
|
||||||
|
data = json.load(all_packages)
|
||||||
|
|
||||||
|
delete_versions = open("delete_versions", "w")
|
||||||
|
|
||||||
|
for i in data:
|
||||||
|
delete = True
|
||||||
|
for tag in i['metadata']['container']['tags']:
|
||||||
|
if not re.match('pr-.*', tag):
|
||||||
|
delete = False
|
||||||
|
continue
|
||||||
|
if tag in open_prs:
|
||||||
|
delete = False
|
||||||
|
if delete:
|
||||||
|
print("delete", i['id'])
|
||||||
|
delete_versions.write(str(i['id']))
|
||||||
|
delete_versions.write("\n")
|
||||||
|
print(i['metadata']['container']['tags'])
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for id in $(cat delete_versions)
|
||||||
|
do
|
||||||
|
curl -L \
|
||||||
|
-X DELETE \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.PACKAGE_DELETER }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/user/packages/container/build-container-installer/versions/${id}
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
delete_old_branches:
|
||||||
|
name: Delete Old Branch Packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: read
|
||||||
|
steps:
|
||||||
|
- name: Delete Old Branch Packages
|
||||||
|
run: |
|
||||||
|
curl -L \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
"https://api.github.com/user/packages/container/build-container-installer/versions" > all_packages.json
|
||||||
|
curl -L \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/branches | jq -r '.[].name' > branches
|
||||||
|
|
||||||
|
cat << EOF | python
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
branches_f = open("branches", "r")
|
||||||
|
branches = branches_f.readlines()
|
||||||
|
branches = [x.strip() for x in branches]
|
||||||
|
|
||||||
|
all_packages_f = open('all_packages.json')
|
||||||
|
data = json.load(all_packages_f)
|
||||||
|
|
||||||
|
delete_versions = open("delete_versions", "w")
|
||||||
|
|
||||||
|
for i in data:
|
||||||
|
delete = True
|
||||||
|
for tag in i['metadata']['container']['tags']:
|
||||||
|
if re.match('v[0-9]+\\\.[0-9]+\\\.[0-9]+', tag):
|
||||||
|
delete = False
|
||||||
|
continue
|
||||||
|
if re.match('pr-.*', tag):
|
||||||
|
delete = False
|
||||||
|
continue
|
||||||
|
if tag in branches:
|
||||||
|
delete = False
|
||||||
|
continue
|
||||||
|
if tag == "latest":
|
||||||
|
delete = False
|
||||||
|
if delete:
|
||||||
|
print("delete", i['id'])
|
||||||
|
delete_versions.write(str(i['id']))
|
||||||
|
delete_versions.write("\n")
|
||||||
|
print(i['metadata']['container']['tags'])
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for id in $(cat delete_versions)
|
||||||
|
do
|
||||||
|
curl -L \
|
||||||
|
-X DELETE \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.PACKAGE_DELETER }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/user/packages/container/build-container-installer/versions/${id}
|
||||||
|
done
|
||||||
4
.github/workflows/stale.yml
vendored
4
.github/workflows/stale.yml
vendored
|
|
@ -7,7 +7,7 @@ name: Mark stale issues and pull requests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '39 21 * * *'
|
- cron: '0 21 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
|
|
@ -18,7 +18,7 @@ jobs:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v5
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: 'Issue is stale and will be closed in 14 days if there is no further activity'
|
stale-issue-message: 'Issue is stale and will be closed in 14 days if there is no further activity'
|
||||||
|
|
|
||||||
102
.github/workflows/test_deployment.yml
vendored
102
.github/workflows/test_deployment.yml
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: Test Deployment
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -7,18 +9,16 @@ on:
|
||||||
parent_job_name:
|
parent_job_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
iso_name-38:
|
flatpaks_refs:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
iso_name-39:
|
flatpaks_refs_dir:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
iso_name-40:
|
suffix:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
load_vars:
|
load_vars:
|
||||||
name: Load Variables
|
name: Load Variables
|
||||||
|
|
@ -38,10 +38,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
version:
|
version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }}
|
||||||
- 38
|
|
||||||
- 39
|
|
||||||
- 40
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -80,98 +77,33 @@ jobs:
|
||||||
- name: Install test tools
|
- name: Install test tools
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y make
|
sudo apt-get install -y unzip make
|
||||||
sudo make install-test-deps PACKAGE_MANAGER=apt-get
|
sudo make test/vm/install-deps PACKAGE_MANAGER=apt-get
|
||||||
|
|
||||||
- name: Download generated ISO
|
- name: Download generated ISO
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs[format('iso_name-{0}', matrix.version)] }}
|
name: ${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}
|
||||||
|
|
||||||
- name: Add Kickstart and Grub options to ISO
|
- name: Run VM Tests
|
||||||
run: |
|
|
||||||
mv ${{ inputs[format('iso_name-{0}', matrix.version)] }} deploy.iso
|
|
||||||
sudo mkdir /mnt/iso || true
|
|
||||||
sudo mount -o loop deploy.iso /mnt/iso
|
|
||||||
cp /mnt/iso/boot/grub2/grub.cfg grub.cfg
|
|
||||||
sudo umount /mnt/iso
|
|
||||||
sed -i 's/quiet/console=ttyS0,115200n8 inst.ks=cdrom:\/ks.cfg/' grub.cfg
|
|
||||||
sed -i 's/set default="1"/set default="0"/' grub.cfg
|
|
||||||
sed -i 's/set timeout=60/set timeout=1/' grub.cfg
|
|
||||||
cat << EOF > ks.cfg
|
|
||||||
lang en_US.UTF-8
|
|
||||||
keyboard us
|
|
||||||
timezone Americas/New_York
|
|
||||||
zerombr
|
|
||||||
clearpart --all --initlabel
|
|
||||||
autopart
|
|
||||||
poweroff
|
|
||||||
user --name=core --groups=wheel --password=foobar
|
|
||||||
%include /usr/share/anaconda/interactive-defaults.ks
|
|
||||||
EOF
|
|
||||||
xorriso -dialog on << EOF
|
|
||||||
-indev deploy.iso
|
|
||||||
-outdev test.iso
|
|
||||||
-boot_image any replay
|
|
||||||
-map ks.cfg ks.cfg
|
|
||||||
-chmod 0444 ks.cfg
|
|
||||||
-map grub.cfg boot/grub2/grub.cfg
|
|
||||||
-end
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Create VM disk
|
|
||||||
run: |
|
|
||||||
qemu-img create -f qcow2 disk.qcow2 50G
|
|
||||||
|
|
||||||
- name: Install the test VM
|
|
||||||
run: |
|
|
||||||
timeout 1h qemu-system-x86_64 -name "Anaconda" -boot d -m 4096 -cpu qemu64 -display none -cdrom test.iso -smp 2 -hda disk.qcow2 -serial telnet:localhost:4321,server=on,wait=off & QEMU_PID=$!
|
|
||||||
echo "PID: $QEMU_PID"
|
|
||||||
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
|
||||||
(nc localhost 4321 | tee vm.stdout) &
|
|
||||||
wait $QEMU_PID
|
|
||||||
|
|
||||||
- name: Start the test VM
|
|
||||||
env:
|
env:
|
||||||
VM_USER: core
|
VM_USER: core
|
||||||
VM_PASS: foobar
|
VM_PASS: foobar
|
||||||
VM_IP: "127.0.0.1"
|
VM_IP: "127.0.0.1"
|
||||||
VM_PORT: "5555"
|
VM_PORT: "5555"
|
||||||
run: |
|
run: |
|
||||||
mkfifo vm.stdin
|
make test/vm ISO_NAME=${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso \
|
||||||
qemu-system-x86_64 -name "Anaconda" \
|
VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS} \
|
||||||
-m 4096 -cpu qemu64 -display none -smp 2 \
|
|
||||||
-chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \
|
|
||||||
-device e1000,netdev=net0 \
|
|
||||||
-netdev user,id=net0,hostfwd=tcp::${VM_PORT}-:22 \
|
|
||||||
-device virtio-serial \
|
|
||||||
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
|
|
||||||
-boot c -hda disk.qcow2 -serial telnet:localhost:4321,server=on,wait=off & export QEMU_PID=$!
|
|
||||||
echo "PID: $QEMU_PID"
|
|
||||||
|
|
||||||
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
|
||||||
(tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) &
|
|
||||||
|
|
||||||
timeout 30m bash -c "while ! (echo > /dev/tcp/${VM_IP}/${VM_PORT}); do sleep 1; done"
|
|
||||||
|
|
||||||
if ! (echo > /dev/tcp/${VM_IP}/${VM_PORT})
|
|
||||||
then
|
|
||||||
echo "SSH must be installed and enabled inside the container"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}"
|
|
||||||
|
|
||||||
make test-vm VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS} \
|
|
||||||
ARCH=${{ needs.load_vars.outputs.ARCH}} \
|
ARCH=${{ needs.load_vars.outputs.ARCH}} \
|
||||||
IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \
|
IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \
|
||||||
IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \
|
IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \
|
||||||
IMAGE_TAG=${{ matrix.version }} \
|
IMAGE_TAG=${{ matrix.version }} \
|
||||||
VERSION=${{ matrix.version }} \
|
VERSION=${{ matrix.version }} \
|
||||||
VARIANT=${{ needs.load_vars.outputs.VARIANT }} \
|
VARIANT=${{ needs.load_vars.outputs.VARIANT }} \
|
||||||
FLATPAK_REMOTE_REFS_DIR=${{ needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR }} \
|
${{ inputs.flatpaks_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpaks_refs) || '' }} \
|
||||||
|
${{ inputs.flatpaks_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpaks_refs_dir) || '' }} \
|
||||||
SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \
|
SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \
|
||||||
ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }}
|
ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }}
|
||||||
kill $QEMU_PID
|
|
||||||
|
|
||||||
- name: Set status
|
- name: Set status
|
||||||
if: inputs.pr && always()
|
if: inputs.pr && always()
|
||||||
|
|
|
||||||
40
.github/workflows/test_iso.yml
vendored
40
.github/workflows/test_iso.yml
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
name: Test ISO
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -7,16 +9,15 @@ on:
|
||||||
parent_job_name:
|
parent_job_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
iso_name-38:
|
flatpaks_refs:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
iso_name-39:
|
flatpaks_refs_dir:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
iso_name-40:
|
suffix:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
load_vars:
|
load_vars:
|
||||||
|
|
@ -37,10 +38,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
version:
|
version: ${{ fromJson(needs.load_vars.outputs.BUILD_VERSIONS) }}
|
||||||
- 38
|
|
||||||
- 39
|
|
||||||
- 40
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -80,31 +78,27 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y make
|
sudo apt-get install -y make
|
||||||
sudo make install-test-deps PACKAGE_MANAGER=apt-get
|
sudo make test/iso/install-deps PACKAGE_MANAGER=apt-get
|
||||||
|
|
||||||
- name: Download generated ISO
|
- name: Download generated ISO
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs[format('iso_name-{0}', matrix.version)] }}
|
name: ${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}
|
||||||
|
|
||||||
- name: Verify ISO
|
|
||||||
run: |
|
|
||||||
checkisomd5 ${{ inputs[format('iso_name-{0}', matrix.version)] }}
|
|
||||||
sha256sum -c ${{ inputs[format('iso_name-{0}', matrix.version)] }}-CHECKSUM
|
|
||||||
|
|
||||||
- name: Run ISO checks
|
- name: Run ISO checks
|
||||||
run: |
|
run: |
|
||||||
mv ${{ inputs[format('iso_name-{0}', matrix.version)] }} deploy.iso
|
make test/iso \
|
||||||
make test-iso \
|
|
||||||
ARCH=${{ needs.load_vars.outputs.ARCH}} \
|
ARCH=${{ needs.load_vars.outputs.ARCH}} \
|
||||||
IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \
|
IMAGE_NAME=${{ needs.load_vars.outputs.IMAGE_NAME}} \
|
||||||
IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \
|
IMAGE_REPO=${{ needs.load_vars.outputs.IMAGE_REPO}} \
|
||||||
IMAGE_TAG=${{ matrix.version }} \
|
IMAGE_TAG=${{ matrix.version }} \
|
||||||
VERSION=${{ matrix.version }} \
|
VERSION=${{ matrix.version }} \
|
||||||
VARIANT=${{ needs.load_vars.outputs.VARIANT }} \
|
VARIANT=${{ needs.load_vars.outputs.VARIANT }} \
|
||||||
FLATPAK_REMOTE_REFS_DIR=${{ needs.load_vars.outputs.FLATPAK_REMOTE_REFS_DIR }} \
|
${{ inputs.flatpaks_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpaks_refs) || '' }} \
|
||||||
|
${{ inputs.flatpaks_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpaks_refs_dir) || '' }} \
|
||||||
SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \
|
SECURE_BOOT_KEY_URL=${{ needs.load_vars.outputs.SECURE_BOOT_KEY_URL }} \
|
||||||
ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }}
|
ENROLLMENT_PASSWORD=${{ needs.load_vars.outputs.ENROLLMENT_PASSWORD }} \
|
||||||
|
ISO_NAME=${{ format('{0}-{1}', needs.load_vars.outputs.IMAGE_NAME, matrix.version) }}${{ inputs.suffix && format('-{0}', inputs.suffix || '') }}.iso
|
||||||
|
|
||||||
- name: Set status
|
- name: Set status
|
||||||
if: inputs.pr && always()
|
if: inputs.pr && always()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: Repo Tests
|
name: Test Repo
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -24,4 +24,7 @@ jobs:
|
||||||
|
|
||||||
- name: Run test
|
- name: Run test
|
||||||
run: |
|
run: |
|
||||||
/bin/bash tests/repo/vars.sh
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y make
|
||||||
|
sudo make test/repo/install-deps
|
||||||
|
make test/repo
|
||||||
76
.github/workflows/tests.yml
vendored
76
.github/workflows/tests.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Tests
|
name: All Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -39,6 +39,72 @@ jobs:
|
||||||
RH_REPO: ${{ secrets.RH_REPO }}
|
RH_REPO: ${{ secrets.RH_REPO }}
|
||||||
RH_ENT: ${{ secrets.RH_ENT }}
|
RH_ENT: ${{ secrets.RH_ENT }}
|
||||||
|
|
||||||
|
build_iso_flatpaks:
|
||||||
|
name: Build ISO with Flatpaks
|
||||||
|
needs:
|
||||||
|
- build_container
|
||||||
|
uses: ./.github/workflows/build_iso.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO with Flatpaks
|
||||||
|
flatpaks_refs_dir: flatpak_refs
|
||||||
|
suffix: flatpaks
|
||||||
|
|
||||||
|
test_iso_flatpaks:
|
||||||
|
name: Test ISO with Flatpaks
|
||||||
|
needs:
|
||||||
|
- build_iso_flatpaks
|
||||||
|
uses: ./.github/workflows/test_iso.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO with Flatpaks
|
||||||
|
flatpaks_refs_dir: flatpak_refs
|
||||||
|
suffix: flatpaks
|
||||||
|
|
||||||
|
test_deployment_flatpaks:
|
||||||
|
name: Test Deployment with Flatpaks
|
||||||
|
needs:
|
||||||
|
- build_iso_flatpaks
|
||||||
|
uses: ./.github/workflows/test_deployment.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment with Flatpaks
|
||||||
|
flatpaks_refs_dir: flatpak_refs
|
||||||
|
suffix: flatpaks
|
||||||
|
|
||||||
|
build_iso_flatpak_refs:
|
||||||
|
name: Build ISO with Flatpak Refs
|
||||||
|
needs:
|
||||||
|
- build_container
|
||||||
|
uses: ./.github/workflows/build_iso.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Build ISO with Flatpak Refs
|
||||||
|
flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable"
|
||||||
|
suffix: flatpaks_refs
|
||||||
|
|
||||||
|
test_iso_flatpak_refs:
|
||||||
|
name: Test ISO with Flatpak Refs
|
||||||
|
needs:
|
||||||
|
- build_iso_flatpak_refs
|
||||||
|
uses: ./.github/workflows/test_iso.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO with Flatpak Refs
|
||||||
|
flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable"
|
||||||
|
suffix: flatpaks_refs
|
||||||
|
|
||||||
|
test_deployment_flatpak_refs:
|
||||||
|
name: Test Deployment with Flatpak Refs
|
||||||
|
needs:
|
||||||
|
- build_iso_flatpak_refs
|
||||||
|
uses: ./.github/workflows/test_deployment.yml
|
||||||
|
with:
|
||||||
|
pr: ${{ inputs.pr }}
|
||||||
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment with Flatpak Refs
|
||||||
|
flatpaks_refs: "app/org.mozilla.firefox/x86_64/stable app/org.videolan.VLC/x86_64/stable"
|
||||||
|
suffix: flatpaks_refs
|
||||||
|
|
||||||
build_iso:
|
build_iso:
|
||||||
name: Build ISO
|
name: Build ISO
|
||||||
needs:
|
needs:
|
||||||
|
|
@ -59,9 +125,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
pr: ${{ inputs.pr }}
|
pr: ${{ inputs.pr }}
|
||||||
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test ISO
|
||||||
iso_name-38: ${{ needs.build_iso.outputs.iso_name-38 }}
|
|
||||||
iso_name-39: ${{ needs.build_iso.outputs.iso_name-39 }}
|
|
||||||
iso_name-40: ${{ needs.build_iso.outputs.iso_name-40 }}
|
|
||||||
|
|
||||||
test_deployment:
|
test_deployment:
|
||||||
name: Test Deployment
|
name: Test Deployment
|
||||||
|
|
@ -70,7 +133,4 @@ jobs:
|
||||||
uses: ./.github/workflows/test_deployment.yml
|
uses: ./.github/workflows/test_deployment.yml
|
||||||
with:
|
with:
|
||||||
pr: ${{ inputs.pr }}
|
pr: ${{ inputs.pr }}
|
||||||
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment
|
parent_job_name: ${{ inputs.parent_job_name && format('{0} / ', inputs.parent_job_name) }}Test Deployment
|
||||||
iso_name-38: ${{ needs.build_iso.outputs.iso_name-38 }}
|
|
||||||
iso_name-39: ${{ needs.build_iso.outputs.iso_name-39 }}
|
|
||||||
iso_name-40: ${{ needs.build_iso.outputs.iso_name-40 }}
|
|
||||||
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,14 +1,16 @@
|
||||||
/debugdata
|
/debugdata
|
||||||
/build
|
/build
|
||||||
|
/flatpaks/script.sh
|
||||||
|
/flatpaks/repo
|
||||||
|
/flatpaks/list.txt
|
||||||
/lorax_templates/post_*
|
/lorax_templates/post_*
|
||||||
/pkglists
|
/pkglists
|
||||||
/repos
|
/repos/*.repo
|
||||||
/results
|
/results
|
||||||
/xorriso/input.txt
|
/xorriso/input.txt
|
||||||
/xorriso/*.sh
|
|
||||||
/original-pkgsizes.txt
|
/original-pkgsizes.txt
|
||||||
/final-pkgsizes.txt
|
/final-pkgsizes.txt
|
||||||
/lorax.conf
|
/lorax.conf
|
||||||
/output
|
/output
|
||||||
/*.log
|
/*.log
|
||||||
|
/cache
|
||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"Makefile.*": "makefile"
|
||||||
|
}
|
||||||
|
}
|
||||||
294
Makefile
294
Makefile
|
|
@ -1,106 +1,42 @@
|
||||||
# Configuration vars
|
include Makefile.inputs
|
||||||
## Formatting = UPPERCASE
|
|
||||||
# General
|
|
||||||
ADDITIONAL_TEMPLATES =
|
|
||||||
ARCH = x86_64
|
|
||||||
EXTRA_BOOT_PARAMS =
|
|
||||||
IMAGE_NAME = base
|
|
||||||
IMAGE_REPO = quay.io/fedora-ostree-desktops
|
|
||||||
IMAGE_TAG = $(VERSION)
|
|
||||||
REPOS = $(subst :,\:,$(shell ls /etc/yum.repos.d/*.repo))
|
|
||||||
ROOTFS_SIZE = 4
|
|
||||||
VARIANT = Server
|
|
||||||
VERSION = 39
|
|
||||||
WEB_UI = false
|
|
||||||
# Flatpak
|
|
||||||
FLATPAK_REMOTE_NAME = flathub
|
|
||||||
FLATPAK_REMOTE_URL = https://flathub.org/repo/flathub.flatpakrepo
|
|
||||||
FLATPAK_REMOTE_REFS =
|
|
||||||
FLATPAK_REMOTE_REFS_DIR =
|
|
||||||
# Secure boot
|
|
||||||
ENROLLMENT_PASSWORD =
|
|
||||||
SECURE_BOOT_KEY_URL =
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Hidden vars
|
# Hidden vars
|
||||||
|
|
||||||
|
export SHELL := /bin/sh
|
||||||
# Cache
|
# Cache
|
||||||
DNF_CACHE =
|
export DNF_CACHE :=
|
||||||
PACKAGE_MANAGER = dnf
|
export PACKAGE_MANAGER := dnf
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
## Formatting = lowercase
|
## Formatting = lowercase
|
||||||
# Get a list of templates for the feature
|
# Get a list of templates for the feature
|
||||||
# $1 = feature
|
# $1 = feature
|
||||||
get_templates = $(shell ls lorax_templates/$(1)_*.tmpl) \
|
define get_templates
|
||||||
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
|
$(wildcard lorax_templates/$(1)_*.tmpl)
|
||||||
|
$(foreach file,$(notdir $(wildcard lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
|
||||||
|
endef
|
||||||
|
|
||||||
# Get a list of tests for the feature
|
define install_pkg
|
||||||
# $1 = test type
|
$(PACKAGE_MANAGER) install -y $(if $(findstring dnf,$(PACKAGE_MANAGER)),--disablerepo='*-testing')
|
||||||
# $2 = feature
|
endef
|
||||||
run_tests = tests="$(shell ls tests/$(1)/$(2)_*)"; \
|
export install_pkg
|
||||||
if [ -n "$$tests" ]; \
|
|
||||||
then \
|
|
||||||
chmod +x $$tests; \
|
|
||||||
for test in $$tests; \
|
|
||||||
do \
|
|
||||||
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
|
|
||||||
RC=$$?; if [ $$RC != 0 ]; then exit $$RC; fi; \
|
|
||||||
done; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Converts a post script to a template
|
|
||||||
# $1 = script to convert
|
|
||||||
# $2 = file on ISO to write
|
|
||||||
# $3 = whether to copy the '<%' lines to the template
|
|
||||||
convert_post_to_tmpl = header=0; \
|
|
||||||
skip=0; \
|
|
||||||
while read -r line; \
|
|
||||||
do \
|
|
||||||
if [[ $$line =~ ^\<\% ]]; \
|
|
||||||
then \
|
|
||||||
if [[ '$(3)' == 'true' ]]; \
|
|
||||||
then \
|
|
||||||
echo $$line >> lorax_templates/post_$(1).tmpl; \
|
|
||||||
fi; \
|
|
||||||
echo >> lorax_templates/post_$(1).tmpl; \
|
|
||||||
else \
|
|
||||||
if [[ $$header == 0 ]]; \
|
|
||||||
then \
|
|
||||||
if [[ $$line =~ ^\#\#\ (.*)$$ ]]; \
|
|
||||||
then \
|
|
||||||
echo "append $(2) \"%post --erroronfail $${BASH_REMATCH[1]}\"" >> lorax_templates/post_$(1).tmpl; \
|
|
||||||
skip=1; \
|
|
||||||
else \
|
|
||||||
echo "append $(2) \"%post --erroronfail\"" >> lorax_templates/post_$(1).tmpl; \
|
|
||||||
fi; \
|
|
||||||
header=1; \
|
|
||||||
fi; \
|
|
||||||
if [[ $$skip == 0 ]]; \
|
|
||||||
then \
|
|
||||||
echo "append $(2) \"$${line//\"/\\\"}\"" >> lorax_templates/post_$(1).tmpl; \
|
|
||||||
fi; \
|
|
||||||
skip=0; \
|
|
||||||
fi; \
|
|
||||||
done < lorax_templates/scripts/post/$(1); \
|
|
||||||
echo "append $(2) \"%end\"" >> lorax_templates/post_$(1).tmpl
|
|
||||||
|
|
||||||
# Generated/internal vars
|
# Generated/internal vars
|
||||||
## Formatting = _UPPERCASE
|
## Formatting = _UPPERCASE
|
||||||
_BASE_DIR = $(shell pwd)
|
_IMAGE_REPO_ESCAPED := $(subst /,\/,$(IMAGE_REPO))
|
||||||
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
_IMAGE_REPO_DOUBLE_ESCAPED := $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||||
_IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
_LORAX_ARGS :=
|
||||||
_LORAX_ARGS =
|
_LORAX_TEMPLATES := $(call get_templates,install)
|
||||||
_LORAX_TEMPLATES = $(call get_templates,install)
|
_REPO_FILES := $(subst /etc/yum.repos.d,repos,$(REPOS))
|
||||||
_REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS))
|
_TEMP_DIR := $(shell mktemp -d)
|
||||||
_TEMP_DIR = $(shell mktemp -d)
|
_TEMPLATE_VARS := ARCH IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI
|
||||||
_TEMPLATE_VARS = ARCH _BASE_DIR IMAGE_NAME IMAGE_REPO _IMAGE_REPO_DOUBLE_ESCAPED _IMAGE_REPO_ESCAPED IMAGE_TAG REPOS _RHEL VARIANT VERSION WEB_UI
|
_VOLID := $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
||||||
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
|
||||||
|
|
||||||
ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo)
|
ifeq ($(findstring redhat.repo,$(REPOS)),redhat.repo)
|
||||||
_RHEL = true
|
_RHEL := true
|
||||||
else
|
else
|
||||||
_RHEL = false
|
_RHEL := false
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(_RHEL),true)
|
ifeq ($(_RHEL),true)
|
||||||
|
|
@ -121,167 +57,91 @@ _LORAX_TEMPLATES += $(call get_templates,cache)
|
||||||
_TEMPLATE_VARS += DNF_CACHE
|
_TEMPLATE_VARS += DNF_CACHE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(FLATPAK_DIR),)
|
||||||
|
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
||||||
|
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
||||||
|
_LORAX_ARGS += -i flatpak-libs
|
||||||
|
_LORAX_TEMPLATES += $(call get_templates,flatpak)
|
||||||
|
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
||||||
|
else
|
||||||
ifneq ($(FLATPAK_REMOTE_REFS_DIR),)
|
ifneq ($(FLATPAK_REMOTE_REFS_DIR),)
|
||||||
COLLECTED_REFS = $(foreach file,$(shell ls $(FLATPAK_REMOTE_REFS_DIR)/*),$(shell cat $(file)))
|
COLLECTED_REFS := $(foreach file,$(filter-out README.md Makefile,$(wildcard $(FLATPAK_REMOTE_REFS_DIR)/*)),$(shell cat $(file)))
|
||||||
FLATPAK_REMOTE_REFS += $(sort $(COLLECTED_REFS))
|
export FLATPAK_REMOTE_REFS += $(sort $(COLLECTED_REFS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(FLATPAK_REMOTE_REFS),)
|
ifneq ($(FLATPAK_REMOTE_REFS),)
|
||||||
_FLATPAK_REPO_GPG = $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
_FLATPAK_REPO_GPG := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^GPGKey=' | cut -d= -f2)
|
||||||
_FLATPAK_REPO_URL = $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
export _FLATPAK_REPO_URL := $(shell curl -L $(FLATPAK_REMOTE_URL) | grep -i '^URL=' | cut -d= -f2)
|
||||||
_LORAX_ARGS += -i flatpak-libs
|
_LORAX_ARGS += -i flatpak-libs
|
||||||
_LORAX_TEMPLATES += $(call get_templates,flatpak) \
|
_LORAX_TEMPLATES += $(call get_templates,flatpak) \
|
||||||
external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl
|
external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl
|
||||||
_TEMPLATE_VARS += FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
_TEMPLATE_VARS += FLATPAK_DIR FLATPAK_REMOTE_NAME FLATPAK_REMOTE_REFS FLATPAK_REMOTE_URL _FLATPAK_REPO_GPG _FLATPAK_REPO_URL
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(SECURE_BOOT_KEY_URL),)
|
ifneq ($(SECURE_BOOT_KEY_URL),)
|
||||||
_LORAX_TEMPLATES += $(call get_templates,secureboot)
|
_LORAX_TEMPLATES += $(call get_templates,secureboot)
|
||||||
_TEMPLATE_VARS += ENROLLMENT_PASSWORD
|
_TEMPLATE_VARS += ENROLLMENT_PASSWORD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Step 7: Build end ISO
|
_SUBDIRS := container external flatpak_refs lorax_templates repos xorriso test
|
||||||
|
|
||||||
|
# Create checksum
|
||||||
## Default action
|
## Default action
|
||||||
build/deploy.iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt
|
$(ISO_NAME)-CHECKSUM: $(ISO_NAME)
|
||||||
mkdir $(_BASE_DIR)/build || true
|
cd $(dir $(ISO_NAME)) && sha256sum $(notdir $(ISO_NAME)) > $(notdir $(ISO_NAME))-CHECKSUM
|
||||||
xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt
|
|
||||||
implantisomd5 build/deploy.iso
|
|
||||||
|
|
||||||
external/lorax/branch-$(VERSION):
|
# Build end ISO
|
||||||
git config advice.detachedHead false
|
$(ISO_NAME): results/images/boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt
|
||||||
ifeq ($(_RHEL),true)
|
$(if $(wildcard $(dir $(ISO_NAME))),,mkdir -p $(dir $(ISO_NAME)); chmod ugo=rwX $(dir $(ISO_NAME)))
|
||||||
cd external/lorax && git reset --hard HEAD && git checkout origin/rhel$(VERSION)-branch
|
xorriso -dialog on < xorriso/input.txt
|
||||||
else
|
implantisomd5 $(ISO_NAME)
|
||||||
cd external/lorax && git reset --hard HEAD && git checkout tags/$(shell cd external/lorax && git tag -l lorax-$(VERSION).* --sort=creatordate | tail -n 1)
|
chmod ugo=r $(ISO_NAME)
|
||||||
endif
|
$(if $(GITHUB_OUTPUT), echo "iso_name=$(ISO_NAME)" >> $(GITUHB_OUTPUT))
|
||||||
touch external/lorax/branch-$(VERSION)
|
|
||||||
|
|
||||||
# Step 1: Generate Lorax Templates
|
# Download the secure boot key
|
||||||
lorax_templates/post_%.tmpl: lorax_templates/scripts/post/%
|
sb_pubkey.der:
|
||||||
$(call convert_post_to_tmpl,$*,usr/share/anaconda/post-scripts/$*.ks,true)
|
curl --fail -L -o sb_pubkey.der $(SECURE_BOOT_KEY_URL)
|
||||||
|
|
||||||
repos: $(_REPO_FILES)
|
# Build boot.iso using Lorax
|
||||||
|
results/images/boot.iso: external/lorax/branch-$(VERSION) $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES) $(if $(SECURE_BOOT_KEY_URL),sb_pubkey.der)
|
||||||
# Step 2: Replace vars in repo files
|
$(if $(wildcard results), rm -Rf results)
|
||||||
repos/%.repo: /etc/yum.repos.d/%.repo
|
$(if $(wildcard /etc/rpm/macros.image-language-conf),mv /etc/rpm/macros.image-language-conf $(_TEMP_DIR)/macros.image-language-conf)
|
||||||
mkdir repos || true
|
|
||||||
cp /etc/yum.repos.d/$*.repo $(_BASE_DIR)/repos/$*.repo
|
|
||||||
ifeq ($(_RHEL),true)
|
|
||||||
sed -i "s/\/rhel[0-9]+\//\/rhel$(VERSION)\//g" $(_BASE_DIR)/repos/$*.repo
|
|
||||||
else
|
|
||||||
sed -i "s/\$$releasever/$(VERSION)/g" $(_BASE_DIR)/repos/$*.repo
|
|
||||||
sed -i "s/\$$basearch/$(ARCH)/g" $(_BASE_DIR)/repos/$*.repo
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Step 3: Build boot.iso using Lorax
|
|
||||||
boot.iso: external/lorax/branch-$(VERSION) $(filter lorax_templates/%,$(_LORAX_TEMPLATES)) $(_REPO_FILES)
|
|
||||||
rm -Rf $(_BASE_DIR)/results || true
|
|
||||||
mv /etc/rpm/macros.image-language-conf $(_TEMP_DIR)/macros.image-language-conf || true
|
|
||||||
|
|
||||||
# Download the secure boot key
|
|
||||||
if [ -n "$(SECURE_BOOT_KEY_URL)" ]; \
|
|
||||||
then \
|
|
||||||
curl --fail -L -o $(_BASE_DIR)/sb_pubkey.der $(SECURE_BOOT_KEY_URL); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
|
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
|
||||||
--isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(_BASE_DIR)/external/lorax/share/templates.d/99-generic \
|
--isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) --sharedir $(PWD)/external/lorax/share/templates.d/99-generic \
|
||||||
$(_LORAX_ARGS) \
|
$(_LORAX_ARGS) \
|
||||||
$(foreach file,$(_REPO_FILES),--repo $(_BASE_DIR)/$(file)) \
|
$(foreach file,$(_REPO_FILES),--repo $(PWD)/$(file)) \
|
||||||
$(foreach file,$(_LORAX_TEMPLATES),--add-template $(_BASE_DIR)/$(file)) \
|
$(foreach file,$(_LORAX_TEMPLATES),--add-template $(PWD)/$(file)) \
|
||||||
$(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \
|
$(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \
|
||||||
$(foreach file,$(_FLATPAK_TEMPLATES),--add-template $(file)) \
|
$(foreach file,$(_FLATPAK_TEMPLATES),--add-template $(file)) \
|
||||||
$(foreach file,$(_EXTERNAL_TEMPLATES),--add-template $(_BASE_DIR)/external/$(file)) \
|
$(foreach file,$(_EXTERNAL_TEMPLATES),--add-template $(PWD)/external/$(file)) \
|
||||||
--rootfs-size $(ROOTFS_SIZE) \
|
--rootfs-size $(ROOTFS_SIZE) \
|
||||||
$(foreach var,$(_TEMPLATE_VARS),--add-template-var "$(shell echo $(var) | tr '[:upper:]' '[:lower:]')=$($(var))") \
|
$(foreach var,$(_TEMPLATE_VARS),--add-template-var "$(shell echo $(var) | tr '[:upper:]' '[:lower:]')=$($(var))") \
|
||||||
$(_BASE_DIR)/results/
|
results/
|
||||||
mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/
|
$(if $(wildcard $(_TEMP_DIR)/macros.image-language-conf),mv -f $(_TEMP_DIR)/macros.image-language-conf /etc/rpm/macros.image-language-conf)
|
||||||
mv -f $(_TEMP_DIR)/macros.image-language-conf /etc/rpm/macros.image-language-conf || true
|
|
||||||
|
|
||||||
# Step 4: Download container image
|
|
||||||
container/$(IMAGE_NAME)-$(IMAGE_TAG):
|
|
||||||
mkdir $(_BASE_DIR)/container || true
|
|
||||||
skopeo copy docker://$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) oci:$(_BASE_DIR)/container/$(IMAGE_NAME)-$(IMAGE_TAG)
|
|
||||||
|
|
||||||
# Step 5: Generate xorriso script
|
|
||||||
xorriso/%.sh: xorriso/%.sh.in
|
|
||||||
find $(_BASE_DIR)/results
|
|
||||||
sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' results/boot/grub2/grub.cfg || true
|
|
||||||
sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' results/EFI/BOOT/grub.cfg
|
|
||||||
$(eval _VARS = IMAGE_NAME IMAGE_TAG ARCH VERSION)
|
|
||||||
$(foreach var,$(_VARS),$(var)=$($(var))) envsubst '$(foreach var,$(_VARS),$$$(var))' < $(_BASE_DIR)/xorriso/$*.sh.in > $(_BASE_DIR)/xorriso/$*.sh
|
|
||||||
|
|
||||||
# Step 6: Generate xorriso input
|
|
||||||
xorriso/input.txt: xorriso/gen_input.sh
|
|
||||||
bash $(_BASE_DIR)/xorriso/gen_input.sh | tee $(_BASE_DIR)/xorriso/input.txt
|
|
||||||
|
|
||||||
|
|
||||||
|
FILES_TO_CLEAN := $(wildcard build debugdata pkglists results original-pkgsizes.txt final-pkgsizes.txt lorax.conf *.iso *log)
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -Rf $(_BASE_DIR)/build || true
|
rm -Rf $(FILES_TO_CLEAN)
|
||||||
rm -Rf $(_BASE_DIR)/container || true
|
$(foreach DIR,$(_SUBDIRS),$(MAKE) -w -C $(DIR) clean;)
|
||||||
rm -Rf $(_BASE_DIR)/debugdata || true
|
|
||||||
rm -Rf $(_BASE_DIR)/pkglists || true
|
|
||||||
rm -Rf $(_BASE_DIR)/repos || true
|
|
||||||
rm -Rf $(_BASE_DIR)/results || true
|
|
||||||
rm -f $(_BASE_DIR)/lorax_templates/*.tmpl || true
|
|
||||||
rm -f $(_BASE_DIR)/xorriso/input.txt || true
|
|
||||||
rm -f $(_BASE_DIR)/xorriso/*.sh || true
|
|
||||||
rm -f $(_BASE_DIR)/{original,final}-pkgsizes.txt || true
|
|
||||||
rm -f $(_BASE_DIR)/lorax.conf || true
|
|
||||||
rm -f $(_BASE_DIR)/*.iso || true
|
|
||||||
rm -f $(_BASE_DIR)/*.log || true
|
|
||||||
|
|
||||||
|
.PHONY: install-deps
|
||||||
install-deps:
|
install-deps:
|
||||||
$(PACKAGE_MANAGER) install -y ${disable} lorax xorriso skopeo flatpak dbus-daemon ostree coreutils gettext git subscription-manager
|
$(install_pkg) lorax xorriso coreutils gettext
|
||||||
|
$(foreach DIR,$(filter-out test,$(_SUBDIRS)),$(MAKE) -w -C $(DIR) install-deps;)
|
||||||
install-test-deps:
|
|
||||||
$(PACKAGE_MANAGER) install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum ansible make coreutils squashfs-tools
|
|
||||||
|
|
||||||
|
|
||||||
test: test-iso test-vm
|
.PHONY: $(_SUBDIRS) $(wildcard test/*) $(wildcard test/*/*)
|
||||||
|
test $(addsuffix /*,$(_SUBDIRS)):
|
||||||
|
$(eval DIR=$(firstword $(subst /, ,$@)))
|
||||||
|
$(if $(filter-out $(DIR),$@), $(eval TARGET=$(subst $(DIR)/,,$@)),$(eval TARGET=))
|
||||||
|
$(MAKE) -w -C $(DIR) $(TARGET)
|
||||||
|
|
||||||
test-repo:
|
.DEFAULT:
|
||||||
bash tests/repo/vars.sh
|
$(eval DIR=$(firstword $(subst /, ,$@)))
|
||||||
|
$(if $(filter-out $(DIR),$@), $(eval TARGET=$(subst $(DIR)/,,$@)),$(eval TARGET=))
|
||||||
test-iso:
|
$(MAKE) -w -C $(DIR) $(TARGET)
|
||||||
$(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
|
|
||||||
|
|
||||||
sudo modprobe loop
|
|
||||||
sudo mkdir /mnt/iso /mnt/install
|
|
||||||
sudo mount -o loop deploy.iso /mnt/iso
|
|
||||||
sudo mount -t squashfs -o loop /mnt/iso/images/install.img /mnt/install
|
|
||||||
|
|
||||||
# install tests
|
|
||||||
$(call run_tests,iso,install)
|
|
||||||
|
|
||||||
# flapak tests
|
|
||||||
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; then $(call run_tests,iso,flatpak); fi
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
sudo umount /mnt/install
|
|
||||||
sudo umount /mnt/iso
|
|
||||||
|
|
||||||
ansible_inventory:
|
|
||||||
echo "ungrouped:" > ansible_inventory
|
|
||||||
echo " hosts:" >> ansible_inventory
|
|
||||||
echo " vm:" >> ansible_inventory
|
|
||||||
echo " ansible_host: ${VM_IP}" >> ansible_inventory
|
|
||||||
echo " ansible_port: ${VM_PORT}" >> ansible_inventory
|
|
||||||
echo " ansible_user: ${VM_USER}" >> ansible_inventory
|
|
||||||
echo " ansible_password: ${VM_PASS}" >> ansible_inventory
|
|
||||||
echo " ansible_become_pass: ${VM_PASS}" >> ansible_inventory
|
|
||||||
echo " ansible_ssh_common_args: '-o StrictHostKeyChecking=no'" >> ansible_inventory
|
|
||||||
|
|
||||||
test-vm: ansible_inventory
|
|
||||||
$(eval _VARS = IMAGE_REPO IMAGE_NAME IMAGE_TAG)
|
|
||||||
|
|
||||||
ansible -i ansible_inventory -m ansible.builtin.wait_for_connection vm
|
|
||||||
|
|
||||||
# install tests
|
|
||||||
$(call run_tests,vm,install)
|
|
||||||
|
|
||||||
# flapak tests
|
|
||||||
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; then $(call run_tests,vm,flatpak); fi
|
|
||||||
|
|
||||||
.PHONY: clean install-deps install-test-deps test test-iso test-vm
|
|
||||||
|
|
|
||||||
24
Makefile.inputs
Normal file
24
Makefile.inputs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Configuration vars
|
||||||
|
## Formatting = UPPERCASE
|
||||||
|
# General
|
||||||
|
export ADDITIONAL_TEMPLATES :=
|
||||||
|
export ARCH := x86_64
|
||||||
|
export EXTRA_BOOT_PARAMS :=
|
||||||
|
export IMAGE_NAME := base
|
||||||
|
export IMAGE_REPO := quay.io/fedora-ostree-desktops
|
||||||
|
export IMAGE_TAG = $(VERSION)
|
||||||
|
REPOS := $(subst :,\:,$(wildcard /etc/yum.repos.d/*.repo))
|
||||||
|
export ROOTFS_SIZE := 4
|
||||||
|
export VARIANT := Server
|
||||||
|
export VERSION := 39
|
||||||
|
export WEB_UI := false
|
||||||
|
# Flatpak
|
||||||
|
export FLATPAK_REMOTE_NAME := flathub
|
||||||
|
export FLATPAK_REMOTE_URL := https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
export FLATPAK_REMOTE_REFS :=
|
||||||
|
export FLATPAK_REMOTE_REFS_DIR :=
|
||||||
|
export FLATPAK_DIR :=
|
||||||
|
# Secure boot
|
||||||
|
export ENROLLMENT_PASSWORD :=
|
||||||
|
export SECURE_BOOT_KEY_URL :=
|
||||||
|
export ISO_NAME := build/deploy.iso
|
||||||
43
README.md
43
README.md
|
|
@ -1,4 +1,4 @@
|
||||||

|
 [](https://app.codacy.com/gh/JasonN3/build-container-installer/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
||||||
|
|
||||||
# Build Container Installer Action
|
# Build Container Installer Action
|
||||||
This action is used to enerate an ISO for installing an OSTree stored in a container image. This utilizes the anaconda command `ostreecontainer`
|
This action is used to enerate an ISO for installing an OSTree stored in a container image. This utilizes the anaconda command `ostreecontainer`
|
||||||
|
|
@ -38,26 +38,27 @@ See [Customizing](#customizing) for information about customizing the ISO that g
|
||||||
The following variables can be used to customize the created ISO.
|
The following variables can be used to customize the created ISO.
|
||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
| Variable | Description | Default Value | Action | Container | Makefile |
|
| Variable | Description | Default Value | Action | Container/Makefile |
|
||||||
| ----------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- | ------------------ | ------------------ | ------------------ |
|
| ----------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- | ------------------ | ------------------ |
|
||||||
| additional_templates | Space delimited list of additional Lorax templates to include | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| additional_templates | Space delimited list of additional Lorax templates to include | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| arch | Architecture for image to build | x86_64 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| arch | Architecture for image to build | x86_64 | :white_check_mark: | :white_check_mark: |
|
||||||
| enrollment_password | Used for supporting secure boot (requires SECURE_BOOT_KEY_URL to be defined) | container-installer | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| enrollment_password | Used for supporting secure boot (requires SECURE_BOOT_KEY_URL to be defined) | container-installer | :white_check_mark: | :white_check_mark: |
|
||||||
| extra_boot_params | Extra params used by grub to boot the anaconda installer | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| extra_boot_params | Extra params used by grub to boot the anaconda installer | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| flatpak_remote_name | Name of the Flatpak repo on the destination OS | flathub | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| flatpak_remote_name | Name of the Flatpak repo on the destination OS | flathub | :white_check_mark: | :white_check_mark: |
|
||||||
| flatpak_remote_refs | Space separated list of flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| flatpak_remote_refs | Space separated list of flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| flatpak_remote_refs_dir | Directory that contains files that list the flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| flatpak_remote_refs_dir | Directory that contains files that list the flatpak refs to install | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| flatpak_remote_url | URL of the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| flatpak_remote_url | URL of the flatpakrepo file | https://flathub.org/repo/flathub.flatpakrepo | :white_check_mark: | :white_check_mark: |
|
||||||
| image_name | Name of the source container image | base | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| image_name | Name of the source container image | base | :white_check_mark: | :white_check_mark: |
|
||||||
| image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: |
|
||||||
| image_tag | Tag of the source container image | *VERSION* | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| image_tag | Tag of the source container image | *VERSION* | :white_check_mark: | :white_check_mark: |
|
||||||
| iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :x: | :x: |
|
| iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :white_check_mark: |
|
||||||
| repos | List of repo files for Lorax to use | /etc/yum.repos.d/*.repo | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| make_target | Overrides the default make target | *ISO Checksum* | :white_check_mark: | :x: |
|
||||||
| rootfs_size | The size (in GiB) for the squashfs runtime volume | 2 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| repos | List of repo files for Lorax to use | /etc/yum.repos.d/*.repo | :white_check_mark: | :white_check_mark: |
|
||||||
| secure_boot_key_url | Secure boot key that is installed from URL location\*\* | \[empty\] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| rootfs_size | The size (in GiB) for the squashfs runtime volume | 2 | :white_check_mark: | :white_check_mark: |
|
||||||
| variant | Source container variant\* | Server | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| secure_boot_key_url | Secure boot key that is installed from URL location\*\* | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| version | Fedora version of installer to build | 39 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| variant | Source container variant\* | Server | :white_check_mark: | :white_check_mark: |
|
||||||
| web_ui | Enable Anaconda WebUI (experimental) | false | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| version | Fedora version of installer to build | 39 | :white_check_mark: | :white_check_mark: |
|
||||||
|
| web_ui | Enable Anaconda WebUI (experimental) | false | :white_check_mark: | :white_check_mark: |
|
||||||
|
|
||||||
\*Available options for VARIANT can be found by running `dnf provides system-release`.
|
\*Available options for VARIANT can be found by running `dnf provides system-release`.
|
||||||
Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinoite
|
Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinoite
|
||||||
|
|
|
||||||
87
action.yml
87
action.yml
|
|
@ -24,6 +24,10 @@ inputs:
|
||||||
description: Whether to enable caching for skopeo
|
description: Whether to enable caching for skopeo
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
enable_flatpak_dependencies:
|
||||||
|
description: Whether to enable automatically determining Flatpak dependencies
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
enrollment_password:
|
enrollment_password:
|
||||||
description: Used for supporting secure boot (requires secure_boot_key_url to be defined)
|
description: Used for supporting secure boot (requires secure_boot_key_url to be defined)
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -40,7 +44,7 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
flatpak_remote_refs_dir:
|
flatpak_remote_refs_dir:
|
||||||
description: Directory that contains files that list the flatpak refs to install
|
description: Directory that contains files that list the flatpak refs to install relative to the github workspace
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
flatpak_remote_url:
|
flatpak_remote_url:
|
||||||
|
|
@ -62,11 +66,15 @@ inputs:
|
||||||
description: "Name of the resulting ISO. Relative paths are relative to github.workspace"
|
description: "Name of the resulting ISO. Relative paths are relative to github.workspace"
|
||||||
required: false
|
required: false
|
||||||
default: build/deploy.iso
|
default: build/deploy.iso
|
||||||
|
make_target:
|
||||||
|
description: "Overrides the default make target"
|
||||||
|
required: false
|
||||||
repos:
|
repos:
|
||||||
description: List of repo files for Lorax to use
|
description: List of repo files for Lorax to use
|
||||||
required: false
|
required: false
|
||||||
rootfs_size:
|
rootfs_size:
|
||||||
description: The size (in GiB) for the squashfs runtime volume
|
description: The size (in GiB) for the squashfs runtime volume
|
||||||
|
default: "2"
|
||||||
secrets_dir:
|
secrets_dir:
|
||||||
description: The location that will be mounted to /run/secrets
|
description: The location that will be mounted to /run/secrets
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -91,11 +99,14 @@ inputs:
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
iso_name:
|
iso_name:
|
||||||
value: ${{ steps.rename_iso.outputs.iso_name }}
|
value: ${{ steps.docker.outputs.iso_name }}
|
||||||
description: The name of the resulting .iso
|
description: The name of the resulting .iso
|
||||||
iso_path:
|
iso_path:
|
||||||
value: ${{ steps.rename_iso.outputs.iso_path }}
|
value: ${{ steps.docker.outputs.iso_path }}
|
||||||
description: The name and path of the resulting .iso
|
description: The path of the resulting .iso
|
||||||
|
flatpak_refs:
|
||||||
|
value: ${{ steps.docker.outputs.flatpak_refs }}
|
||||||
|
description: The list of Flatpak refs
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
|
|
@ -133,7 +144,23 @@ runs:
|
||||||
mkdir /cache/dnf_new || true
|
mkdir /cache/dnf_new || true
|
||||||
mkdir /cache/skopeo || true
|
mkdir /cache/skopeo || true
|
||||||
|
|
||||||
|
- name: Determine Flatpak dependencies
|
||||||
|
if: inputs.enable_flatpak_dependencies == 'true' && (inputs.flatpak_remote_refs != '' || inputs.flatpak_remote_refs_dir != '')
|
||||||
|
id: flatpak_dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd ${{ github.action_path }}
|
||||||
|
make flatpaks/repo \
|
||||||
|
FLATPAK_REMOTE_NAME="${{ inputs.flatpak_remote_name }}" \
|
||||||
|
${{ inputs.flatpak_remote_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpak_remote_refs) || ''}} \
|
||||||
|
${{ inputs.flatpak_remote_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpak_remote_refs_dir) || ''}} \
|
||||||
|
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
||||||
|
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||||
|
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||||
|
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}"
|
||||||
|
|
||||||
- name: Run docker image
|
- name: Run docker image
|
||||||
|
id: docker
|
||||||
env:
|
env:
|
||||||
ACTION_REPO: ${{ github.action_repository }}
|
ACTION_REPO: ${{ github.action_repository }}
|
||||||
ACTION_REF: ${{ github.action_ref }}
|
ACTION_REF: ${{ github.action_ref }}
|
||||||
|
|
@ -170,14 +197,6 @@ runs:
|
||||||
then
|
then
|
||||||
echo "ERROR: flatpak_remote_refs is mutually exclusive to flatpak_remote_refs_dir"
|
echo "ERROR: flatpak_remote_refs is mutually exclusive to flatpak_remote_refs_dir"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
if [[ -n "${{ inputs.flatpak_remote_refs }}" ]]
|
|
||||||
then
|
|
||||||
vars="${vars} FLATPAK_REMOTE_REFS=\"${{ inputs.flatpak_remote_refs }}\""
|
|
||||||
elif [[ -n "${{ inputs.flatpak_remote_refs_dir }}" ]]
|
|
||||||
then
|
|
||||||
vars="${vars} FLATPAK_REMOTE_REFS_DIR=\"${{ inputs.flatpak_remote_refs_dir }}\""
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ -n "${{ inputs.secrets_dir }}" ]]
|
if [[ -n "${{ inputs.secrets_dir }}" ]]
|
||||||
then
|
then
|
||||||
|
|
@ -189,21 +208,39 @@ runs:
|
||||||
image=${image}-ubi
|
image=${image}-ubi
|
||||||
fi
|
fi
|
||||||
docker run --privileged ${volumes} --volume ${{ github.workspace }}:/github/workspace/ ${cache} ${image}:${tag} \
|
docker run --privileged ${volumes} --volume ${{ github.workspace }}:/github/workspace/ ${cache} ${image}:${tag} \
|
||||||
|
${{ inputs.make_target }} \
|
||||||
ADDITIONAL_TEMPLATES="${{ inputs.additional_templates }}" \
|
ADDITIONAL_TEMPLATES="${{ inputs.additional_templates }}" \
|
||||||
ARCH="${{ inputs.arch }}" \
|
ARCH="${{ inputs.arch }}" \
|
||||||
DNF_CACHE="/cache/dnf" \
|
DNF_CACHE="/cache/dnf" \
|
||||||
ENROLLMENT_PASSWORD="${{ inputs.enrollment_password }}" \
|
ENROLLMENT_PASSWORD="${{ inputs.enrollment_password }}" \
|
||||||
|
EXTRA_BOOT_PARAMS="${{ inputs.extra_boot_params }}" \
|
||||||
FLATPAK_REMOTE_NAME="${{ inputs.flatpak_remote_name }}" \
|
FLATPAK_REMOTE_NAME="${{ inputs.flatpak_remote_name }}" \
|
||||||
${vars} \
|
${{ inputs.flatpak_remote_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpak_remote_refs) || ''}} \
|
||||||
|
${{ inputs.flatpak_remote_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="/github/workspace/{0}"', inputs.flatpak_remote_refs_dir) || ''}} \
|
||||||
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
||||||
|
FLATPAK_DIR="${{ steps.flatpak_dependencies.outputs.flatpak_dir && format('/github/workspace/{0}', steps.flatpak_dependencies.outputs.flatpak_dir) || '' }}" \
|
||||||
IMAGE_NAME="${{ inputs.image_name }}" \
|
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||||
IMAGE_REPO="${{ inputs.image_repo }}" \
|
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||||
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \
|
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \
|
||||||
|
ISO_NAME=/github/workspace/${{ inputs.iso_name }} \
|
||||||
REPOS="${{ inputs.repos }}" \
|
REPOS="${{ inputs.repos }}" \
|
||||||
SECURE_BOOT_KEY_URL="${{ inputs.secure_boot_key_url }}" \
|
SECURE_BOOT_KEY_URL="${{ inputs.secure_boot_key_url }}" \
|
||||||
VARIANT="${{ inputs.variant }}" \
|
VARIANT="${{ inputs.variant }}" \
|
||||||
VERSION="${{ inputs.version }}" \
|
VERSION="${{ inputs.version }}" \
|
||||||
WEB_UI="${{ inputs.web_ui }}"
|
WEB_UI="${{ inputs.web_ui }}"
|
||||||
|
echo "iso_path=$(dirname ${{ inputs.iso_name }})" >> $GITHUB_OUTPUT
|
||||||
|
echo "iso_name=$(basename ${{ inputs.iso_name }})" >> $GITHUB_OUTPUT
|
||||||
|
if [[ "${{ steps.flatpak_dependencies.outputs.flatpak_dir }}" != '' ]]
|
||||||
|
then
|
||||||
|
echo "flatpak_refs=$(cat ${{ github.workspace }}/${{ steps.flatpak_dependencies.outputs.flatpak_dir }}/list.txt | tr '\n' ' ')" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
if [[ "${{ inputs.flatpak_remote_refs_dir }}" != '' ]]
|
||||||
|
then
|
||||||
|
echo "flatpak_refs=$(cat ${{ github.workspace }}/${{ inputs.flatpak_remote_refs_dir }}/* | tr '\n' ' ')" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "flatpak_refs=${{ inputs.flatpak_remote_refs}}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Save dnf cache
|
- name: Save dnf cache
|
||||||
env:
|
env:
|
||||||
|
|
@ -222,27 +259,3 @@ runs:
|
||||||
with:
|
with:
|
||||||
path: /cache/skopeo
|
path: /cache/skopeo
|
||||||
key: ${{ inputs.skopeo_cache_key || env.skopeo_cache_key }}
|
key: ${{ inputs.skopeo_cache_key || env.skopeo_cache_key }}
|
||||||
|
|
||||||
|
|
||||||
- name: Rename ISO file
|
|
||||||
id: rename_iso
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [[ ! ( "${{ inputs.iso_name }}" =~ \.iso$ ) ]]
|
|
||||||
then
|
|
||||||
iso_name="${{ inputs.iso_name }}.iso"
|
|
||||||
else
|
|
||||||
iso_name="${{ inputs.iso_name }}"
|
|
||||||
fi
|
|
||||||
if [[ "${{ inputs.iso_name }}" =~ ^/ ]]
|
|
||||||
then
|
|
||||||
full_path="${iso_name}"
|
|
||||||
else
|
|
||||||
full_path="${{ github.workspace }}/${iso_name}"
|
|
||||||
fi
|
|
||||||
mv ${{ github.workspace }}/build/deploy.iso ${full_path} || true
|
|
||||||
cd $(dirname ${full_path})
|
|
||||||
iso_fn=$(basename ${iso_name})
|
|
||||||
sha256sum ${iso_fn} > ${iso_fn}-CHECKSUM
|
|
||||||
echo "iso_path=${full_path}" >> $GITHUB_OUTPUT
|
|
||||||
echo "iso_name=${iso_fn}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
|
||||||
11
container/Makefile
Normal file
11
container/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
$(IMAGE_NAME)-$(IMAGE_TAG):
|
||||||
|
skopeo copy docker://$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) oci:$(IMAGE_NAME)-$(IMAGE_TAG)
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
$(install_pkg) skopeo
|
||||||
|
|
||||||
|
FILES=$(filter-out Makefile,$(wildcard *))
|
||||||
|
clean:
|
||||||
|
ifneq ($(FILES),)
|
||||||
|
rm -Rf $(FILES)
|
||||||
|
endif
|
||||||
|
|
@ -5,15 +5,6 @@ set -ex
|
||||||
# Create /dev/loop0 if it doesn't already exist. `losetup` has an issue creating it during the first run
|
# Create /dev/loop0 if it doesn't already exist. `losetup` has an issue creating it during the first run
|
||||||
mknod -m 0660 /dev/loop0 b 7 0 2>/dev/null || true
|
mknod -m 0660 /dev/loop0 b 7 0 2>/dev/null || true
|
||||||
|
|
||||||
dnf check-update > /dev/null || true
|
|
||||||
|
|
||||||
for i
|
|
||||||
do
|
|
||||||
key=$(echo ${i} | cut -d= -f1)
|
|
||||||
value=$(echo ${i} | cut -d= -f2-)
|
|
||||||
export ${key}="${value}"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -d /cache/skopeo ]]
|
if [[ -d /cache/skopeo ]]
|
||||||
then
|
then
|
||||||
ln -s /cache/skopeo /build-container-installer/container
|
ln -s /cache/skopeo /build-container-installer/container
|
||||||
|
|
@ -24,18 +15,5 @@ then
|
||||||
mkdir /cache/dnf
|
mkdir /cache/dnf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pull container
|
# Run make command
|
||||||
make container/${IMAGE_NAME}-${IMAGE_TAG} "$@"
|
make "$@"
|
||||||
|
|
||||||
# Build base ISO
|
|
||||||
make boot.iso "$@"
|
|
||||||
|
|
||||||
# Add container to ISO
|
|
||||||
make build/deploy.iso "$@"
|
|
||||||
|
|
||||||
# Make output dir in github workspace
|
|
||||||
mkdir /github/workspace/build || true
|
|
||||||
|
|
||||||
# Copy resulting iso to github workspace and fix permissions
|
|
||||||
cp build/deploy.iso /github/workspace/build
|
|
||||||
chmod -R ugo=rwX /github/workspace/build
|
|
||||||
|
|
|
||||||
12
external/Makefile
vendored
Normal file
12
external/Makefile
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
lorax/branch-$(VERSION):
|
||||||
|
git config advice.detachedHead false
|
||||||
|
cd lorax && git reset --hard HEAD && git checkout tags/$(shell cd lorax && git tag -l lorax-$(VERSION).* --sort=creatordate | tail -n 1)
|
||||||
|
touch lorax/branch-$(VERSION)
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
# Used by external/fedora-lorax-templates/ostree-based-installer/lorax-embed-flatpaks.tmpl
|
||||||
|
$(install_pkg) flatpak dbus-daemon ostree
|
||||||
|
# Used to clone proper lorax branch
|
||||||
|
$(install_pkg) git
|
||||||
|
|
||||||
|
clean:
|
||||||
|
|
@ -1,5 +1 @@
|
||||||
app/org.mozilla.firefox/x86_64/stable
|
app/org.mozilla.firefox/x86_64/stable
|
||||||
|
|
||||||
runtime/org.mozilla.firefox.Locale/x86_64/stable
|
|
||||||
runtime/org.freedesktop.Platform/x86_64/23.08
|
|
||||||
runtime/org.freedesktop.Platform.Locale/x86_64/23.08
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
app/org.videolan.VLC/x86_64/stable
|
app/org.videolan.VLC/x86_64/stable
|
||||||
runtime/org.kde.Platform/x86_64/5.15-23.08
|
|
||||||
42
flatpaks/Makefile
Normal file
42
flatpaks/Makefile
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
IMAGE := $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||||
|
FLATPAK_DIR := $(if $(GITHUB_WORKSPACE),$(shell mktemp -d -p $(GITHUB_WORKSPACE) flatpak.XXX),$(PWD)/flatpaks)
|
||||||
|
|
||||||
|
.PHONY: full_list
|
||||||
|
full_list: repo
|
||||||
|
cat $(FLATPAK_DIR)/list.txt >&2
|
||||||
|
|
||||||
|
|
||||||
|
repo: script.sh
|
||||||
|
$(if $(GITHUB_WORKSPACE),cp script.sh $(FLATPAK_DIR)/)
|
||||||
|
docker run --rm --privileged --entrypoint bash -e FLATPAK_SYSTEM_DIR=/flatpak/flatpak -e FLATPAK_TRIGGERSDIR=/flatpak/triggers --volume $(FLATPAK_DIR):/flatpak_dir $(IMAGE) /flatpak_dir/script.sh
|
||||||
|
$(if $(GITHUB_OUTPUT),echo "flatpak_dir=$(subst $(GITHUB_WORKSPACE)/,,$(FLATPAK_DIR))" >> $(GITHUB_OUTPUT))
|
||||||
|
docker rmi $(IMAGE)
|
||||||
|
|
||||||
|
script.sh:
|
||||||
|
cat << EOF > script.sh
|
||||||
|
mkdir -p /flatpak/flatpak /flatpak/triggers
|
||||||
|
mkdir /var/tmp || true
|
||||||
|
chmod -R 1777 /var/tmp
|
||||||
|
flatpak config --system --set languages "*"
|
||||||
|
flatpak remote-add --system $(FLATPAK_REMOTE_NAME) $(FLATPAK_REMOTE_URL)
|
||||||
|
flatpak install --system -y $(FLATPAK_REMOTE_REFS)
|
||||||
|
ostree init --repo=/flatpak_dir/repo --mode=archive-z2
|
||||||
|
for i in \$$(ostree refs --repo=\$${FLATPAK_SYSTEM_DIR}/repo | grep '^deploy/' | sed 's/^deploy\///g')
|
||||||
|
do
|
||||||
|
echo "Copying \$${i}..."
|
||||||
|
ostree --repo=/flatpak_dir/repo pull-local \$${FLATPAK_SYSTEM_DIR}/repo \$$(ostree --repo=\$${FLATPAK_SYSTEM_DIR}/repo rev-parse $(FLATPAK_REMOTE_NAME)/\$${i})
|
||||||
|
mkdir -p \$$(dirname /flatpak_dir/repo/refs/heads/\$${i})
|
||||||
|
ostree --repo=\$${FLATPAK_SYSTEM_DIR}/repo rev-parse $(FLATPAK_REMOTE_NAME)/\$${i} > /flatpak_dir/repo/refs/heads/\$${i}
|
||||||
|
done
|
||||||
|
flatpak build-update-repo /flatpak_dir/repo
|
||||||
|
ostree refs --repo=/flatpak_dir/repo | tee /flatpak_dir/list.txt
|
||||||
|
EOF
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(if $(wildcard script.sh),rm script.sh)
|
||||||
|
$(if $(wildcard repo),rm -Rf repo)
|
||||||
|
$(if $(wildcard list.txt),rm list.txt)
|
||||||
|
|
||||||
|
.ONESHELL:
|
||||||
48
lorax_templates/Makefile
Normal file
48
lorax_templates/Makefile
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Converts a post script to a template
|
||||||
|
# $1 = script to convert
|
||||||
|
# $2 = file on ISO to write
|
||||||
|
# $3 = whether to copy the '<%' lines to the template
|
||||||
|
define convert_post_to_tmpl
|
||||||
|
header=0; \
|
||||||
|
skip=0; \
|
||||||
|
while read -r line; \
|
||||||
|
do \
|
||||||
|
if [[ $$line =~ ^\<\% ]]; \
|
||||||
|
then \
|
||||||
|
if [[ '$(3)' == 'true' ]]; \
|
||||||
|
then \
|
||||||
|
echo $$line >> post_$(1).tmpl; \
|
||||||
|
fi; \
|
||||||
|
echo >> post_$(1).tmpl; \
|
||||||
|
else \
|
||||||
|
if [[ $$header == 0 ]]; \
|
||||||
|
then \
|
||||||
|
if [[ $$line =~ ^\#\#\ (.*)$$ ]]; \
|
||||||
|
then \
|
||||||
|
echo "append $(2) \"%post --erroronfail $${BASH_REMATCH[1]}\"" >> post_$(1).tmpl; \
|
||||||
|
skip=1; \
|
||||||
|
else \
|
||||||
|
echo "append $(2) \"%post --erroronfail\"" >> post_$(1).tmpl; \
|
||||||
|
fi; \
|
||||||
|
header=1; \
|
||||||
|
fi; \
|
||||||
|
if [[ $$skip == 0 ]]; \
|
||||||
|
then \
|
||||||
|
echo "append $(2) \"$${line//\"/\\\"}\"" >> post_$(1).tmpl; \
|
||||||
|
fi; \
|
||||||
|
skip=0; \
|
||||||
|
fi; \
|
||||||
|
done < scripts/post/$(1); \
|
||||||
|
echo "append $(2) \"%end\"" >> post_$(1).tmpl
|
||||||
|
endef
|
||||||
|
|
||||||
|
post_%.tmpl: scripts/post/%
|
||||||
|
$(call convert_post_to_tmpl,$*,usr/share/anaconda/post-scripts/$*.ks,true)
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
|
||||||
|
FILES=$(wildcard post_*)
|
||||||
|
clean:
|
||||||
|
ifneq ($(FILES),)
|
||||||
|
rm -Rf $(FILES)
|
||||||
|
endif
|
||||||
5
lorax_templates/flatpak_link.tmpl
Normal file
5
lorax_templates/flatpak_link.tmpl
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%page args="flatpak_dir"/>
|
||||||
|
|
||||||
|
%if flatpak_dir != "":
|
||||||
|
symlink /run/install/repo/flatpak /flatpak
|
||||||
|
%endif
|
||||||
15
repos/Makefile
Normal file
15
repos/Makefile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
repos: $(_REPO_FILES)
|
||||||
|
|
||||||
|
# Step 2: Replace vars in repo files
|
||||||
|
%.repo: /etc/yum.repos.d/%.repo
|
||||||
|
cp /etc/yum.repos.d/$*.repo $*.repo
|
||||||
|
sed -i "s/\$$releasever/$(VERSION)/g" $*.repo
|
||||||
|
sed -i "s/\$$basearch/$(ARCH)/g" $*.repo
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
|
||||||
|
FILES=$(wildcard *.repo)
|
||||||
|
clean:
|
||||||
|
ifneq ($(FILES),)
|
||||||
|
rm -Rf $(FILES)
|
||||||
|
endif
|
||||||
23
test/Makefile
Normal file
23
test/Makefile
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
all: $(filter-out README.md Makefile,$(wildcard *))
|
||||||
|
|
||||||
|
$(filter-out README.md Makefile,$(wildcard *)):
|
||||||
|
$(eval DIR=$(firstword $(subst /, ,$@)))
|
||||||
|
$(MAKE) -w -C $(DIR)
|
||||||
|
|
||||||
|
$(filter-out README.md Makefile,$(wildcard */*)):
|
||||||
|
$(eval DIR=$(firstword $(subst /, ,$@)))
|
||||||
|
$(eval TARGET=$(subst $(DIR)/,,$@))
|
||||||
|
$(MAKE) -w -C $(DIR) $(TARGET)
|
||||||
|
|
||||||
|
.DEFAULT:
|
||||||
|
$(eval DIR=$(firstword $(subst /, ,$@)))
|
||||||
|
$(if $(filter-out $(DIR),$@), $(eval TARGET=$(subst $(DIR)/,,$@)),$(eval TARGET=))
|
||||||
|
$(MAKE) -w -C $(DIR) $(TARGET)
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
$(foreach DIR,$(filter-out README.md Makefile,$(wildcard *)),$(MAKE) -w -C $(DIR) install-deps;)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(foreach DIR,$(filter-out README.md Makefile,$(wildcard *)),$(MAKE) -w -C $(DIR) clean;)
|
||||||
|
|
||||||
|
.PHONY: all $(filter-out README.md Makefile,$(wildcard *)) $(filter-out README.md Makefile,$(wildcard */*))
|
||||||
25
test/iso/Makefile
Normal file
25
test/iso/Makefile
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
ISO_NAME=deploy.iso
|
||||||
|
ISO_TESTS=$(wildcard install_*) $(if $(FLATPAK_REMOTE_REFS),$(wildcard flatpak_*))$(if $(FLATPAK_DIR),$(wildcard flatpak_*))
|
||||||
|
|
||||||
|
all: $(ISO_TESTS) clean
|
||||||
|
|
||||||
|
$(ISO_TESTS): mnt/iso
|
||||||
|
$(eval _VARS = ISO_NAME VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
|
||||||
|
chmod +x $@
|
||||||
|
$(foreach var,$(_VARS),$(var)=$($(var))) ./$@
|
||||||
|
|
||||||
|
mnt/iso:
|
||||||
|
sudo modprobe loop
|
||||||
|
sudo mkdir -p mnt/iso mnt/install
|
||||||
|
sudo mount -o loop ../../$(ISO_NAME) mnt/iso
|
||||||
|
sudo mount -t squashfs -o loop mnt/iso/images/install.img mnt/install
|
||||||
|
|
||||||
|
clean:
|
||||||
|
sudo umount mnt/install || true
|
||||||
|
sudo umount mnt/iso || true
|
||||||
|
sudo rmdir mnt/install mnt/iso
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
$(install_pkg) isomd5sum coreutils squashfs-tools curl
|
||||||
|
|
||||||
|
.PHONY: all $(ISO_TESTS) clean
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
add_line=$(grep flatpak_manager.add_remote /mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
|
add_line=$(grep flatpak_manager.add_remote mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
|
||||||
|
|
||||||
add_line_repo=$(echo ${add_line} | grep ${FLATPAK_REMOTE_NAME})
|
add_line_repo=$(echo "${add_line}" | grep "${FLATPAK_REMOTE_NAME}")
|
||||||
add_line_url=$(echo ${add_line} | grep ${_FLATPAK_REPO_URL})
|
add_line_url=$(echo "${add_line}" | grep "${_FLATPAK_REPO_URL}")
|
||||||
|
|
||||||
result=0
|
result=0
|
||||||
if [ -z "${add_line_repo}" ]
|
if [ -z "${add_line_repo}" ]
|
||||||
then
|
then
|
||||||
echo "Repo name not updated on add_remote line"
|
echo "Repo name not updated on add_remote line"
|
||||||
|
echo "${add_line}"
|
||||||
result=1
|
result=1
|
||||||
else
|
else
|
||||||
echo "Repo name found on add_remote line"
|
echo "Repo name found on add_remote line"
|
||||||
|
|
@ -17,18 +18,20 @@ fi
|
||||||
if [ -z "${add_line_url}" ]
|
if [ -z "${add_line_url}" ]
|
||||||
then
|
then
|
||||||
echo "Repo url not updated on add_remote line"
|
echo "Repo url not updated on add_remote line"
|
||||||
|
echo "${add_line}"
|
||||||
result=1
|
result=1
|
||||||
else
|
else
|
||||||
echo "Repo url found on add_remote line"
|
echo "Repo url found on add_remote line"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
replace_line=$(grep flatpak_manager.replace_installed_refs_remote /mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
|
replace_line=$(grep flatpak_manager.replace_installed_refs_remote mnt/install/usr/lib64/python*/site-packages/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py)
|
||||||
|
|
||||||
replace_line_repo=$(echo ${replace_line} | grep ${FLATPAK_REMOTE_NAME})
|
replace_line_repo=$(echo "${replace_line}" | grep "${FLATPAK_REMOTE_NAME}")
|
||||||
|
|
||||||
if [ -z "${replace_line_repo}" ]
|
if [ -z "${replace_line_repo}" ]
|
||||||
then
|
then
|
||||||
echo "Repo name not updated on replace_installed_refs line"
|
echo "Repo name not updated on replace_installed_refs line"
|
||||||
|
echo "${replace_line}"
|
||||||
result=1
|
result=1
|
||||||
else
|
else
|
||||||
echo "Repo name found on replace_installed_refs line"
|
echo "Repo name found on replace_installed_refs line"
|
||||||
14
test/iso/install_hash.sh
Normal file
14
test/iso/install_hash.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#set -ex
|
||||||
|
|
||||||
|
checkisomd5 "../../${ISO_NAME}"
|
||||||
|
if [[ $? != 0 ]]
|
||||||
|
then
|
||||||
|
echo "Found:"
|
||||||
|
checkisomd5 --md5sumonly "../../${ISO_NAME}"
|
||||||
|
echo "Expected:"
|
||||||
|
implantisomd5 --force "../../${ISO_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$(dirname "../../${ISO_NAME}")" && sha256sum -c "$(basename "${ISO_NAME}")-CHECKSUM"
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
FOUND_VERSION=$(cat /mnt/install/etc/os-release | grep VERSION_ID | cut -d= -f2)
|
FOUND_VERSION=$(grep VERSION_ID mnt/install/etc/os-release | cut -d= -f2)
|
||||||
|
|
||||||
if [[ ${FOUND_VERSION} != ${VERSION} ]]
|
if [[ ${FOUND_VERSION} != ${VERSION} ]]
|
||||||
then
|
then
|
||||||
11
test/repo/Makefile
Normal file
11
test/repo/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
REPO_TESTS=$(filter-out README.md Makefile,$(wildcard *))
|
||||||
|
|
||||||
|
all: $(REPO_TESTS)
|
||||||
|
|
||||||
|
$(REPO_TESTS):
|
||||||
|
chmod +x $@
|
||||||
|
./$@
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
|
||||||
|
.PHONY: $(REPO_TESTS)
|
||||||
118
test/repo/vars.py
Executable file
118
test/repo/vars.py
Executable file
|
|
@ -0,0 +1,118 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
makefile = open('../../Makefile.inputs', 'r')
|
||||||
|
makefile_lines = makefile.readlines()
|
||||||
|
|
||||||
|
inputs = {}
|
||||||
|
outputs = {}
|
||||||
|
errors = 0
|
||||||
|
|
||||||
|
for line in makefile_lines:
|
||||||
|
if line.startswith('#'):
|
||||||
|
makefile_lines.remove(line)
|
||||||
|
continue
|
||||||
|
parts = line.split('=', 1)
|
||||||
|
if parts[0].startswith('export'):
|
||||||
|
var_name = parts[0].strip().split(' ')[1].lower()
|
||||||
|
else:
|
||||||
|
var_name = parts[0].strip().lower()
|
||||||
|
inputs[var_name] = {'default_value': parts[1].strip(), 'makefile': True}
|
||||||
|
|
||||||
|
action = open('../../action.yml', 'r')
|
||||||
|
action_lines = action.readlines()
|
||||||
|
|
||||||
|
at_inputs = False
|
||||||
|
at_outputs = False
|
||||||
|
for line in action_lines:
|
||||||
|
if not at_inputs:
|
||||||
|
if line.strip() == 'inputs:':
|
||||||
|
at_inputs = True
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if line.startswith(' '):
|
||||||
|
parts = line.strip().split(':', 1)
|
||||||
|
if parts[0] == 'description':
|
||||||
|
inputs[var_name]['description'] = parts[1].strip()
|
||||||
|
if parts[0] == 'deprecationMessage':
|
||||||
|
inputs[var_name]['deprecated'] = True
|
||||||
|
if parts[0] == 'default':
|
||||||
|
if 'default' in inputs[var_name]:
|
||||||
|
if inputs[var_name]['default_value'] != parts[1].strip().strip('"'):
|
||||||
|
print("ERROR: Default value for " + var_name + " in action.yml does not match Makefile")
|
||||||
|
errors += 1
|
||||||
|
else:
|
||||||
|
inputs[var_name]['default_value'] = parts[1].strip().strip('"')
|
||||||
|
elif line.startswith(' '):
|
||||||
|
var_name = line.strip().strip(':').lower()
|
||||||
|
if not var_name in inputs:
|
||||||
|
inputs[var_name] = {}
|
||||||
|
inputs[var_name]['action'] = True
|
||||||
|
else:
|
||||||
|
at_inputs = False
|
||||||
|
|
||||||
|
if not at_outputs:
|
||||||
|
if line.strip() == 'outputs:':
|
||||||
|
at_outputs = True
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if line.startswith(' '):
|
||||||
|
parts = line.strip().split(':', 1)
|
||||||
|
if parts[0] == 'description':
|
||||||
|
outputs[var_name]['description'] = parts[1].strip()
|
||||||
|
if parts[0] == 'deprecationMessage':
|
||||||
|
outputs[var_name]['deprecated'] = True
|
||||||
|
if parts[0] == 'default':
|
||||||
|
outputs[var_name]['default_value'] = parts[1].strip().strip('"')
|
||||||
|
elif line.startswith(' '):
|
||||||
|
var_name = line.strip().strip(':').lower()
|
||||||
|
outputs[var_name] = {}
|
||||||
|
else:
|
||||||
|
at_outputs = False
|
||||||
|
|
||||||
|
|
||||||
|
readme = open('../../README.md', 'r')
|
||||||
|
readme_lines = readme.readlines()
|
||||||
|
|
||||||
|
at_inputs = False
|
||||||
|
skip_header = True
|
||||||
|
at_outputs = False
|
||||||
|
for line in readme_lines:
|
||||||
|
if not at_inputs:
|
||||||
|
if line.strip() == '### Inputs':
|
||||||
|
at_inputs = True
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if skip_header:
|
||||||
|
if line.startswith('| -----'):
|
||||||
|
skip_header = False
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if not line.startswith('|'):
|
||||||
|
at_inputs = False
|
||||||
|
continue
|
||||||
|
parts = line.split('|')
|
||||||
|
var_name = parts[1].strip().lower()
|
||||||
|
if not var_name in inputs:
|
||||||
|
print("ERROR: " + var_name + " is not listed in action.yml or Makefile")
|
||||||
|
errors += 1
|
||||||
|
continue
|
||||||
|
if 'description' in inputs[var_name]:
|
||||||
|
if parts[2].strip() != inputs[var_name]['description']:
|
||||||
|
print("WARNING: " + var_name + " description in README.md does not match action.yml")
|
||||||
|
if 'default_value' in inputs[var_name]:
|
||||||
|
if not parts[3].strip().strip('"').startswith('*'):
|
||||||
|
if inputs[var_name]['default_value'] == "":
|
||||||
|
if parts[3].strip().strip('"') != '\\[empty\\]':
|
||||||
|
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
||||||
|
errors += 1
|
||||||
|
elif parts[3].strip().strip('"') != inputs[var_name]['default_value']:
|
||||||
|
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
||||||
|
errors += 1
|
||||||
|
if 'action' in inputs[var_name] and inputs[var_name]['action']:
|
||||||
|
if parts[4].strip() != ':white_check_mark:':
|
||||||
|
print("WARNING: " + var_name + " not labeled as in action.yml in the README.md")
|
||||||
|
if 'makefile' in inputs[var_name] and inputs[var_name]['makefile']:
|
||||||
|
if parts[4].strip() != ':white_check_mark:':
|
||||||
|
print("WARNING: " + var_name + " not labeled as in Makefile in the README.md")
|
||||||
|
|
||||||
|
exit(errors)
|
||||||
100
test/vm/Makefile
Normal file
100
test/vm/Makefile
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
VM_TESTS=$(wildcard install_*) $(if $(FLATPAK_REMOTE_REFS),$(wildcard flatpak_*))$(if $(FLATPAK_DIR),$(wildcard flatpak_*))
|
||||||
|
|
||||||
|
all: $(VM_TESTS) clean
|
||||||
|
|
||||||
|
$(VM_TESTS): start_vm ansible_inventory
|
||||||
|
$(eval _VARS = IMAGE_REPO IMAGE_NAME IMAGE_TAG)
|
||||||
|
|
||||||
|
ansible -i ansible_inventory -m ansible.builtin.wait_for_connection vm
|
||||||
|
|
||||||
|
chmod +x $@
|
||||||
|
$(foreach var,$(_VARS),$(var)=$($(var))) ./$@
|
||||||
|
|
||||||
|
ansible_inventory:
|
||||||
|
echo "ungrouped:" > ansible_inventory
|
||||||
|
echo " hosts:" >> ansible_inventory
|
||||||
|
echo " vm:" >> ansible_inventory
|
||||||
|
echo " ansible_host: $(VM_IP)" >> ansible_inventory
|
||||||
|
echo " ansible_port: $(VM_PORT)" >> ansible_inventory
|
||||||
|
echo " ansible_user: $(VM_USER)" >> ansible_inventory
|
||||||
|
echo " ansible_password: $(VM_PASS)" >> ansible_inventory
|
||||||
|
echo " ansible_become_pass: $(VM_PASS)" >> ansible_inventory
|
||||||
|
echo " ansible_ssh_common_args: '-o StrictHostKeyChecking=no'" >> ansible_inventory
|
||||||
|
|
||||||
|
.PHONY: $(VM_TESTS) install-deps
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
$(install_pkg) qemu qemu-utils xorriso qemu-system-x86 netcat socat jq ansible curl
|
||||||
|
|
||||||
|
files/mnt/iso:
|
||||||
|
$(if $(wildcard files/mnt),,mkdir files/mnt)
|
||||||
|
$(if $(wildcard files/mnt/iso),,mkdir files/mnt/iso)
|
||||||
|
sudo mount -o loop ../../$(ISO_NAME) files/mnt/iso
|
||||||
|
|
||||||
|
files/grub.cfg: files/mnt/iso
|
||||||
|
cp files/mnt/iso/boot/grub2/grub.cfg files/grub.cfg
|
||||||
|
sed -i 's/quiet/console=ttyS0,115200n8 inst.ks=cdrom:\/ks.cfg/' files/grub.cfg
|
||||||
|
sed -i 's/set default="1"/set default="0"/' files/grub.cfg
|
||||||
|
sed -i 's/set timeout=60/set timeout=1/' files/grub.cfg
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
$(if $(wildcard start_vm), kill "$(shell cat start_vm)")
|
||||||
|
$(if $(wildcard files/mnt/iso),sudo umount files/mnt/iso)
|
||||||
|
$(if $(wildcard files/mnt/iso),rmdir files/mnt/iso)
|
||||||
|
$(if $(wildcard ansible_inventory),rm ansible_inventory)
|
||||||
|
$(if $(wildcard files/install.iso),rm files/install.iso)
|
||||||
|
$(if $(wildcard files/disk.qcow2),rm files/disk.qcow2)
|
||||||
|
$(if $(wildcard install_os),rm install_os)
|
||||||
|
$(if $(wildcard start_vm),rm start_vm)
|
||||||
|
|
||||||
|
files/install.iso: files/grub.cfg
|
||||||
|
xorriso -dialog on << EOF
|
||||||
|
-indev ../../$(ISO_NAME)
|
||||||
|
-outdev files/install.iso
|
||||||
|
-boot_image any replay
|
||||||
|
-joliet on
|
||||||
|
-compliance joliet_long_names
|
||||||
|
-map files/ks.cfg ks.cfg
|
||||||
|
-chmod 0444 ks.cfg
|
||||||
|
-map files/grub.cfg boot/grub2/grub.cfg
|
||||||
|
-end
|
||||||
|
EOF
|
||||||
|
|
||||||
|
files/disk.qcow2:
|
||||||
|
qemu-img create -f qcow2 files/disk.qcow2 50G
|
||||||
|
|
||||||
|
install_os: files/install.iso files/disk.qcow2
|
||||||
|
timeout 1h qemu-system-x86_64 -name "Anaconda" -boot d -m 4096 -cpu qemu64 -display none -cdrom files/install.iso -smp 2 -hda files/disk.qcow2 -serial telnet:localhost:4321,server=on,wait=off & QEMU_PID=$$!
|
||||||
|
echo "PID: $$QEMU_PID"
|
||||||
|
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
||||||
|
(nc localhost 4321 | tee vm.stdout) &
|
||||||
|
wait $$QEMU_PID
|
||||||
|
touch install_os
|
||||||
|
|
||||||
|
.ONESHELL:
|
||||||
|
|
||||||
|
start_vm: install_os
|
||||||
|
mkfifo vm.stdin
|
||||||
|
qemu-system-x86_64 -name "Anaconda" \
|
||||||
|
-m 4096 -cpu qemu64 -display none -smp 2 \
|
||||||
|
-chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \
|
||||||
|
-device e1000,netdev=net0 \
|
||||||
|
-netdev user,id=net0,hostfwd=tcp::$(VM_PORT)-:22 \
|
||||||
|
-device virtio-serial \
|
||||||
|
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
|
||||||
|
-boot c -hda files/disk.qcow2 -serial telnet:localhost:4321,server=on,wait=off & export QEMU_PID=$$!
|
||||||
|
echo "PID: $$QEMU_PID"
|
||||||
|
|
||||||
|
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
||||||
|
(tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) &
|
||||||
|
|
||||||
|
timeout 30m bash -c "while ! (echo > /dev/tcp/$(VM_IP)/$(VM_PORT)); do sleep 1; done"
|
||||||
|
|
||||||
|
if ! (echo > /dev/tcp/$(VM_IP)/$(VM_PORT))
|
||||||
|
then
|
||||||
|
echo "SSH must be installed and enabled inside the container"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "VM ready for tests at IP $(VM_IP):$(VM_PORT)"
|
||||||
|
echo $$QEMU_PID > start_vm
|
||||||
9
test/vm/files/ks.cfg
Normal file
9
test/vm/files/ks.cfg
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
lang en_US.UTF-8
|
||||||
|
keyboard us
|
||||||
|
timezone Americas/New_York
|
||||||
|
zerombr
|
||||||
|
clearpart --all --initlabel
|
||||||
|
autopart
|
||||||
|
poweroff
|
||||||
|
user --name=core --groups=wheel --password=foobar
|
||||||
|
%include /usr/share/anaconda/interactive-defaults.ks
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env -S ansible-playbook -i ./ansible_inventory
|
#!/usr/bin/env -S ansible-playbook -i ./ansible_inventory
|
||||||
---
|
---
|
||||||
- name: Test for installed flatpaks
|
- name: Test fedora flatpak repo wasn't enabled
|
||||||
hosts: vm
|
hosts: vm
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env -S ansible-playbook -i ./ansible_inventory
|
#!/usr/bin/env -S ansible-playbook -i ./ansible_inventory
|
||||||
---
|
---
|
||||||
- name: Test for flatpaks
|
- name: Test flatpak update
|
||||||
hosts: vm
|
hosts: vm
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
vars=()
|
|
||||||
|
|
||||||
while read -r line
|
|
||||||
do
|
|
||||||
if ! [[ $line =~ ^# ]]
|
|
||||||
then
|
|
||||||
vars+=$(echo $line | cut -d= -f1 | tr [:upper:] [:lower:])
|
|
||||||
fi
|
|
||||||
if [[ $line =~ ^########## ]]
|
|
||||||
then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < Makefile
|
|
||||||
|
|
||||||
result=0
|
|
||||||
|
|
||||||
for var in $vars
|
|
||||||
do
|
|
||||||
grep "^| ${var}" README.md > /dev/null
|
|
||||||
if [[ $? != 0 ]]
|
|
||||||
then
|
|
||||||
echo "$var not found in README.md"
|
|
||||||
result=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for var in $vars
|
|
||||||
do
|
|
||||||
grep "^ ${var}:" action.yml > /dev/null
|
|
||||||
if [[ $? != 0 ]]
|
|
||||||
then
|
|
||||||
echo "$var not found in action.yml"
|
|
||||||
result=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
exit ${result}
|
|
||||||
13
xorriso/Makefile
Normal file
13
xorriso/Makefile
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
input.txt: gen_input.sh
|
||||||
|
sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/boot/grub2/grub.cfg
|
||||||
|
sed -i 's/quiet/quiet $(EXTRA_BOOT_PARAMS)/g' ../results/EFI/BOOT/grub.cfg
|
||||||
|
$(eval _VARS = ARCH FLATPAK_DIR IMAGE_NAME IMAGE_TAG ISO_NAME VERSION)
|
||||||
|
$(foreach var,$(_VARS),$(var)=$($(var))) bash gen_input.sh | tee input.txt
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
|
||||||
|
FILES=$(wildcard input.txt)
|
||||||
|
clean:
|
||||||
|
ifneq ($(FILES),)
|
||||||
|
rm -Rf $(FILES)
|
||||||
|
endif
|
||||||
50
xorriso/gen_input.sh
Normal file
50
xorriso/gen_input.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "-report_about WARNING"
|
||||||
|
echo "-indev ${PWD}/../results/images/boot.iso"
|
||||||
|
echo "-outdev ${ISO_NAME}"
|
||||||
|
echo "-boot_image any replay"
|
||||||
|
echo "-joliet on"
|
||||||
|
echo "-compliance joliet_long_names"
|
||||||
|
pushd "${PWD}/../results" > /dev/null
|
||||||
|
#for file in $(find .)
|
||||||
|
for file in ./boot/grub2/grub.cfg ./EFI/BOOT/grub.cfg
|
||||||
|
do
|
||||||
|
if [[ "$file" == "./images/boot.iso" ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "-map ${PWD}/${file} ${file:2}"
|
||||||
|
echo "-chmod 0444 ${file:2}"
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
if [[ -n "${FLATPAK_DIR}" ]]
|
||||||
|
then
|
||||||
|
pushd "${FLATPAK_DIR}" > /dev/null
|
||||||
|
for file in $(find repo)
|
||||||
|
do
|
||||||
|
if [[ "${file}" == "repo/.lock" ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "-map ${PWD}/${file} flatpak/${file}"
|
||||||
|
echo "-chmod 0444 flatpak/${file}"
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $(pwd)/sb_pubkey.der ]
|
||||||
|
then
|
||||||
|
echo "-map $(pwd)/../sb_pubkey.der sb_pubkey.der"
|
||||||
|
echo "-chmod 0444 /sb_pubkey.der"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd "${PWD}/../container" > /dev/null
|
||||||
|
for file in $(find "${IMAGE_NAME}-${IMAGE_TAG}" -type f)
|
||||||
|
do
|
||||||
|
echo "-map ${PWD}/${file} ${file}"
|
||||||
|
echo "-chmod 0444 ${file}"
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
echo "-end"
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "-indev $(pwd)/boot.iso"
|
|
||||||
echo "-outdev $(pwd)/build/deploy.iso"
|
|
||||||
echo "-boot_image any replay"
|
|
||||||
echo "-joliet on"
|
|
||||||
echo "-compliance joliet_long_names"
|
|
||||||
if [ -f $(pwd)/results/boot/grub2/grub.cfg ]
|
|
||||||
then
|
|
||||||
echo "-map $(pwd)/results/boot/grub2/grub.cfg boot/grub2/grub.cfg"
|
|
||||||
echo "-chmod 0444 boot/grub2/grub.cfg"
|
|
||||||
fi
|
|
||||||
echo "-map $(pwd)/results/EFI/BOOT/grub.cfg EFI/BOOT/grub.cfg"
|
|
||||||
echo "-chmod 0444 EFI/BOOT/grub.cfg"
|
|
||||||
|
|
||||||
if [ -f $(pwd)/sb_pubkey.der ]
|
|
||||||
then
|
|
||||||
echo "-map $(pwd)/sb_pubkey.der sb_pubkey.der"
|
|
||||||
echo "-chmod 0444 /sb_pubkey.der"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd container > /dev/null
|
|
||||||
for file in $(find ${IMAGE_NAME}-${IMAGE_TAG})
|
|
||||||
do
|
|
||||||
echo "-map $(pwd)/${file} ${file}"
|
|
||||||
echo "-chmod 0444 ${file}"
|
|
||||||
done
|
|
||||||
popd > /dev/null
|
|
||||||
echo "-end"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue