mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 02:47:56 +01:00
Add image_src variable for container image source override (#121)
This commit is contained in:
parent
e0e4de8f9a
commit
3d7e6b3725
6 changed files with 56 additions and 42 deletions
6
.github/workflows/build_vars.yml
vendored
6
.github/workflows/build_vars.yml
vendored
|
|
@ -9,7 +9,6 @@ on:
|
||||||
value: '
|
value: '
|
||||||
{
|
{
|
||||||
"version": [
|
"version": [
|
||||||
"38",
|
|
||||||
"39",
|
"39",
|
||||||
"40",
|
"40",
|
||||||
],
|
],
|
||||||
|
|
@ -29,11 +28,6 @@ on:
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
|
||||||
"version": "38",
|
|
||||||
"image_repo": "quay.io/fedora-ostree-desktops",
|
|
||||||
"image_name": "base"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"version": "39",
|
"version": "39",
|
||||||
"image_repo": "quay.io/fedora-ostree-desktops",
|
"image_repo": "quay.io/fedora-ostree-desktops",
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export ARCH := x86_64
|
||||||
export EXTRA_BOOT_PARAMS :=
|
export EXTRA_BOOT_PARAMS :=
|
||||||
export IMAGE_NAME := base
|
export IMAGE_NAME := base
|
||||||
export IMAGE_REPO := quay.io/fedora-ostree-desktops
|
export IMAGE_REPO := quay.io/fedora-ostree-desktops
|
||||||
|
export IMAGE_SRC :=
|
||||||
export IMAGE_TAG = $(VERSION)
|
export IMAGE_TAG = $(VERSION)
|
||||||
export IMAGE_SIGNED := true
|
export IMAGE_SIGNED := true
|
||||||
REPOS := $(subst :,\:,$(wildcard /etc/yum.repos.d/*.repo))
|
REPOS := $(subst :,\:,$(wildcard /etc/yum.repos.d/*.repo))
|
||||||
|
|
|
||||||
58
README.md
58
README.md
|
|
@ -8,6 +8,7 @@ This action is used to generate an ISO for installing an OSTree stored in a cont
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This action is designed to be called from a GitHub workflow using the following format
|
This action is designed to be called from a GitHub workflow using the following format
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Build ISO
|
- name: Build ISO
|
||||||
uses: jasonn3/build-container-installer@main
|
uses: jasonn3/build-container-installer@main
|
||||||
|
|
@ -56,6 +57,7 @@ The following variables can be used to customize the created ISO.
|
||||||
| image_name | Name of the source container image | base | :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: |
|
| image_repo | Repository containing the source container image | quay.io/fedora-ostree-desktops | :white_check_mark: | :white_check_mark: |
|
||||||
| image_signed | Whether the container image is signed. The policy to test the signing must be configured inside the container image | true | :white_check_mark: | :white_check_mark: |
|
| image_signed | Whether the container image is signed. The policy to test the signing must be configured inside the container image | true | :white_check_mark: | :white_check_mark: |
|
||||||
|
| image_src | Overrides the source of the container image. Must be formatted for the skopeo copy command | \[empty\] | :white_check_mark: | :white_check_mark: |
|
||||||
| image_tag | Tag of the source container image | *VERSION* | :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: | :white_check_mark: |
|
| iso_name | Name of the ISO you wish to output when completed | build/deploy.iso | :white_check_mark: | :white_check_mark: |
|
||||||
| make_target | Overrides the default make target | *ISO_NAME*-Checksum | :white_check_mark: | :x: |
|
| make_target | Overrides the default make target | *ISO_NAME*-Checksum | :white_check_mark: | :x: |
|
||||||
|
|
@ -84,11 +86,11 @@ For outputs, see example above.
|
||||||
|
|
||||||
### Makefile
|
### Makefile
|
||||||
|
|
||||||
The Makefile contains all of the commands that are run in the action. There are separate targets for each file generated, however `make` can be used to generate the final image and `make clean` can be used to clean up the workspace. The resulting ISO will be stored in the `build` directory.
|
The Makefile contains all commands that are run the action. There are separate targets for each file generated, however `make` can be used to generate the final image and `make clean` can be used to clean up the workspace. The resulting ISO will be stored in the `build` directory.
|
||||||
|
|
||||||
`make install-deps` can be used to install the necessary packages
|
You can use `make install-deps` to install the required packages.
|
||||||
|
|
||||||
See [Customizing](#customizing) for information about customizing the ISO that gets created. All variable should be specified CAPITALIZED.
|
See [Customizing](#customizing) for information about customizing the ISO that gets created. All variables should be specified in CAPITALIZED form.
|
||||||
|
|
||||||
### Container
|
### Container
|
||||||
|
|
||||||
|
|
@ -98,39 +100,42 @@ To use the container file, run `docker run --privileged --volume .:/build-contai
|
||||||
|
|
||||||
This will create an ISO with the baked in defaults of the container image. The resulting file will be called `deploy.iso`
|
This will create an ISO with the baked in defaults of the container image. The resulting file will be called `deploy.iso`
|
||||||
|
|
||||||
See [Customizing](#customizing) for information about customizing the ISO that gets created. The variable can either be defined as environment variables. All variable should be specified CAPITALIZED.
|
See [Customizing](#customizing) for information about customizing the ISO that gets created. All variables should be specified in CAPITALIZED form.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
Building an ISO to install Fedora 38
|
Building an ISO to install Fedora 38
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest VERSION=38 IMAGE_NAME=base IMAGE_TAG=38 VARIANT=Server
|
docker run --rm --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest VERSION=38 IMAGE_NAME=base IMAGE_TAG=38 VARIANT=Server
|
||||||
```
|
```
|
||||||
|
|
||||||
Building an ISO to install Fedora 39
|
Building an ISO to install Fedora 39
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest VERSION=39 IMAGE_NAME=base IMAGE_TAG=39 VARIANT=Server
|
docker run --rm --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest VERSION=39 IMAGE_NAME=base IMAGE_TAG=39 VARIANT=Server
|
||||||
```
|
```
|
||||||
|
|
||||||
### VSCode Dev Container
|
### VSCode Dev Container
|
||||||
|
|
||||||
There is a dev container configuration provided for development. By default it will use the existing container image available at `ghcr.io/jasonn3/build-container-installer:latest`, however, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode.
|
There is a dev container configuration provided for development. By default, it will use the existing container image available at `ghcr.io/jasonn3/build-container-installer:latest`. However, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode.
|
||||||
|
|
||||||
The code from VSCode will be available at `/workspaces/build-container-installer` once the container has started.
|
The code from VSCode will be available at `/workspaces/build-container-installer` once the container has started.
|
||||||
|
|
||||||
Privileged is required for access to loop devices for lorax.
|
Privileged is required for access to loop devices for lorax.
|
||||||
|
|
||||||
Use existing container image:
|
Use existing container image:
|
||||||
```
|
|
||||||
|
```diff
|
||||||
{
|
{
|
||||||
"name": "Existing Dockerfile",
|
"name": "Existing Image",
|
||||||
// "build": {
|
- "build": {
|
||||||
// "context": "..",
|
- "context": "..",
|
||||||
// "dockerfile": "../Containerfile",
|
- "dockerfile": "../Containerfile",
|
||||||
// "args": {
|
- "args": {
|
||||||
// "version": "39"
|
- "version": "39"
|
||||||
// }
|
- }
|
||||||
// },
|
- },
|
||||||
"image": "ghcr.io/jasonn3/build-container-installer:latest",
|
+ "image": "ghcr.io/jasonn3/build-container-installer:latest",
|
||||||
"overrideCommand": true,
|
"overrideCommand": true,
|
||||||
"shutdownAction": "stopContainer",
|
"shutdownAction": "stopContainer",
|
||||||
"privileged": true
|
"privileged": true
|
||||||
|
|
@ -138,17 +143,18 @@ Use existing container image:
|
||||||
```
|
```
|
||||||
|
|
||||||
Build a new container image:
|
Build a new container image:
|
||||||
```
|
|
||||||
|
```diff
|
||||||
{
|
{
|
||||||
"name": "Existing Dockerfile",
|
"name": "New Image",
|
||||||
"build": {
|
+ "build": {
|
||||||
"context": "..",
|
+ "context": "..",
|
||||||
"dockerfile": "../Containerfile",
|
+ "dockerfile": "../Containerfile",
|
||||||
"args": {
|
+ "args": {
|
||||||
"version": "39"
|
+ "version": "39"
|
||||||
}
|
+ }
|
||||||
},
|
+ },
|
||||||
//"image": "ghcr.io/jasonn3/build-container-installer:latest",
|
- "image": "ghcr.io/jasonn3/build-container-installer:latest",
|
||||||
"overrideCommand": true,
|
"overrideCommand": true,
|
||||||
"shutdownAction": "stopContainer",
|
"shutdownAction": "stopContainer",
|
||||||
"privileged": true
|
"privileged": true
|
||||||
|
|
@ -163,4 +169,4 @@ Build a new container image:
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=jasonn3/build-container-installer&type=Date" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=jasonn3/build-container-installer&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=jasonn3/build-container-installer&type=Date" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=jasonn3/build-container-installer&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
21
action.yml
21
action.yml
|
|
@ -29,26 +29,26 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
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
|
||||||
default: "container-installer"
|
default: "container-installer"
|
||||||
extra_boot_params:
|
extra_boot_params:
|
||||||
description: Extra params used by grub to boot the anaconda installer
|
description: Extra params used by grub to boot the anaconda installer
|
||||||
required: false
|
required: false
|
||||||
flatpak_remote_name:
|
flatpak_remote_name:
|
||||||
description: Name of the Flatpak remote repo
|
description: Name of the Flatpak repo on the destination OS
|
||||||
required: false
|
required: false
|
||||||
default: "flathub"
|
default: "flathub"
|
||||||
flatpak_remote_refs:
|
flatpak_remote_refs:
|
||||||
description: Space delimited list of refs to the flatpak packages to install
|
description: Space separated list of flatpak refs to install
|
||||||
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 relative to the github workspace
|
description: Directory that contains files that list the flatpak refs to install
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
flatpak_remote_url:
|
flatpak_remote_url:
|
||||||
description: The URL of the Flatpak remote flatpakrepo file
|
description: URL of the flatpakrepo file
|
||||||
required: false
|
required: false
|
||||||
default: https://flathub.org/repo/flathub.flatpakrepo
|
default: https://flathub.org/repo/flathub.flatpakrepo
|
||||||
image_name:
|
image_name:
|
||||||
|
|
@ -63,15 +63,18 @@ inputs:
|
||||||
description: Whether the container image is signed. The policy to test the signing must be configured inside the container image
|
description: Whether the container image is signed. The policy to test the signing must be configured inside the container image
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
|
image_src:
|
||||||
|
description: Overrides the source of the container image. Must be formatted for the skopeo copy command
|
||||||
|
required: false
|
||||||
image_tag:
|
image_tag:
|
||||||
description: Tag of the source container image. Defaults to the installer version
|
description: Tag of the source container image
|
||||||
required: false
|
required: false
|
||||||
iso_name:
|
iso_name:
|
||||||
description: "Name of the resulting ISO. Relative paths are relative to github.workspace"
|
description: Name of the ISO you wish to output when completed
|
||||||
required: false
|
required: false
|
||||||
default: build/deploy.iso
|
default: build/deploy.iso
|
||||||
make_target:
|
make_target:
|
||||||
description: "Overrides the default make target"
|
description: Overrides the default make target
|
||||||
required: false
|
required: false
|
||||||
repos:
|
repos:
|
||||||
description: List of repo files for Lorax to use
|
description: List of repo files for Lorax to use
|
||||||
|
|
@ -158,6 +161,7 @@ runs:
|
||||||
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
||||||
IMAGE_NAME="${{ inputs.image_name }}" \
|
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||||
IMAGE_REPO="${{ inputs.image_repo }}" \
|
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||||
|
IMAGE_SRC="${{ inputs.image_src }}" \
|
||||||
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}"
|
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}"
|
||||||
|
|
||||||
- name: Run docker image
|
- name: Run docker image
|
||||||
|
|
@ -214,6 +218,7 @@ runs:
|
||||||
IMAGE_NAME="${{ inputs.image_name }}" \
|
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||||
IMAGE_REPO="${{ inputs.image_repo }}" \
|
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||||
IMAGE_SIGNED="${{ inputs.image_signed }}" \
|
IMAGE_SIGNED="${{ inputs.image_signed }}" \
|
||||||
|
IMAGE_SRC="${{ inputs.image_src }}" \
|
||||||
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \
|
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \
|
||||||
ISO_NAME=/github/workspace/${{ inputs.iso_name }} \
|
ISO_NAME=/github/workspace/${{ inputs.iso_name }} \
|
||||||
${{ inputs.repos && format('REPOS="{0}"', inputs.repos) || '' }} \
|
${{ inputs.repos && format('REPOS="{0}"', inputs.repos) || '' }} \
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
|
ifeq ($(IMAGE_SRC),)
|
||||||
|
IMAGE_SRC := docker://$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
$(IMAGE_NAME)-$(IMAGE_TAG):
|
$(IMAGE_NAME)-$(IMAGE_TAG):
|
||||||
skopeo copy docker://$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) oci:$(IMAGE_NAME)-$(IMAGE_TAG)
|
skopeo copy $(IMAGE_SRC) oci:$(IMAGE_NAME)-$(IMAGE_TAG)
|
||||||
|
|
||||||
install-deps:
|
install-deps:
|
||||||
$(install_pkg) skopeo
|
$(install_pkg) skopeo
|
||||||
|
|
|
||||||
|
|
@ -97,16 +97,20 @@ for line in readme_lines:
|
||||||
errors += 1
|
errors += 1
|
||||||
continue
|
continue
|
||||||
if 'description' in inputs[var_name]:
|
if 'description' in inputs[var_name]:
|
||||||
if parts[2].strip() != inputs[var_name]['description']:
|
if parts[2].strip().strip('\*') != inputs[var_name]['description']:
|
||||||
print("WARNING: " + var_name + " description in README.md does not match action.yml")
|
print("WARNING: " + var_name + " description in README.md does not match action.yml")
|
||||||
if 'default_value' in inputs[var_name]:
|
if 'default_value' in inputs[var_name]:
|
||||||
if not parts[3].strip().strip('"<>').startswith('*'):
|
if not parts[3].strip().strip('"<>').startswith('*'):
|
||||||
if inputs[var_name]['default_value'] == "":
|
if inputs[var_name]['default_value'] == "":
|
||||||
if parts[3].strip().strip('"') != '\\[empty\\]':
|
if parts[3].strip().strip('"') != '\\[empty\\]':
|
||||||
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
||||||
|
print("Found " + parts[3].strip().strip('"<>'))
|
||||||
|
print("Expected " + inputs[var_name]['default_value'])
|
||||||
errors += 1
|
errors += 1
|
||||||
elif parts[3].strip().strip('"<>') != inputs[var_name]['default_value']:
|
elif parts[3].strip().strip('"<>') != inputs[var_name]['default_value']:
|
||||||
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
print("ERROR: " + var_name + " default value in README.md does not match action.yml")
|
||||||
|
print("Found " + parts[3].strip().strip('"<>'))
|
||||||
|
print("Expected " + inputs[var_name]['default_value'])
|
||||||
errors += 1
|
errors += 1
|
||||||
if 'action' in inputs[var_name] and inputs[var_name]['action']:
|
if 'action' in inputs[var_name] and inputs[var_name]['action']:
|
||||||
if parts[4].strip() != ':white_check_mark:':
|
if parts[4].strip() != ':white_check_mark:':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue