mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-16 03:23:43 +03:00
Merge pull request #53 from ublue-os/tepene/51_build-args
chore(main): include latest changes
This commit is contained in:
commit
bb80ee34fb
10
.vscode/cspell_custom.txt
vendored
10
.vscode/cspell_custom.txt
vendored
|
@ -1,19 +1,25 @@
|
|||
aggrid
|
||||
AKMODS
|
||||
CHACHA
|
||||
configmap
|
||||
Containerfile
|
||||
containerignore
|
||||
devcontainer
|
||||
devcontainers
|
||||
dialtimeout
|
||||
dotenv
|
||||
ENDCOLOR
|
||||
ensurepath
|
||||
envsubst
|
||||
filepicker
|
||||
forwardingtimeouts
|
||||
getent
|
||||
gitmessage
|
||||
HHMMSS
|
||||
hostvars
|
||||
humanfriendly
|
||||
idleconntimeout
|
||||
idletimeout
|
||||
keygen
|
||||
LAZYGIT
|
||||
lightspeed
|
||||
|
@ -30,10 +36,13 @@ notranslate
|
|||
pipx
|
||||
posix
|
||||
Proto
|
||||
readtimeout
|
||||
redirections
|
||||
refreshable
|
||||
rvproxy
|
||||
serverstransport
|
||||
serverstransports
|
||||
silverblue
|
||||
traefik
|
||||
ublue
|
||||
varnames
|
||||
|
@ -41,3 +50,4 @@ venvs
|
|||
VIRTUALENVS
|
||||
wantlist
|
||||
websecure
|
||||
writetimeout
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
---
|
||||
forge_container_name: "{{ forge_registry_url }}/{{ forge_git_repository_url | regex_search('(?<=/)[^/]+(?=\\.git)') }}"
|
||||
forge_container_tag: "{{ ansible_date_time.date }}_{{ ansible_date_time.time | replace(':','')}}"
|
||||
forge_container_file: "Containerfile"
|
||||
forge_container_format: "oci"
|
||||
forge_container_extra_args: []
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
# git variables
|
||||
forge_git_repository_url: "https://github.com/ublue-os/bluefin.git"
|
||||
forge_git_repository_destination: "{{ forge_data_volume_mountpoint }}/data/bluefin"
|
||||
forge_git_repository_url: ""
|
||||
forge_git_repository_destination: ""
|
||||
forge_git_repository_version: "main"
|
||||
|
|
|
@ -36,19 +36,19 @@
|
|||
changed_when: false
|
||||
become: true
|
||||
|
||||
- name: Create example extra-vars configuration file
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ forge_data_volume_mountpoint }}/forge_example_vars.yml"
|
||||
content: |
|
||||
## ublue-os forge extra-vars example configuration
|
||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
||||
---
|
||||
{% for item in __vars_used %}
|
||||
{{ item }}: {{ lookup('ansible.builtin.vars', item) }}
|
||||
{% endfor %}
|
||||
- name: Create example directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ forge_data_volume_mountpoint }}/examples/"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Create example configuration files
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ forge_data_volume_mountpoint }}/examples/{{ item | regex_search(__regex_search) }}"
|
||||
backup: true
|
||||
owner: "{{ ansible_facts.env.USER }}"
|
||||
mode: "0644"
|
||||
with_fileglob: "files/examples/*"
|
||||
vars:
|
||||
__vars_used: "{{ lookup('ansible.builtin.varnames', __regex_search, wantlist=true) }}"
|
||||
__regex_search: ^forge_(?!data).+
|
||||
__regex_search: "[^\/]+$"
|
||||
|
|
11
anvil/ansible/playbooks/files/examples/bluefin-39.yml
Normal file
11
anvil/ansible/playbooks/files/examples/bluefin-39.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
## ublue-os forge example configuration for bluefin
|
||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
||||
---
|
||||
forge_git_repository_url: https://github.com/ublue-os/bluefin.git
|
||||
forge_git_repository_destination: "{{ forge_data_volume_mountpoint }}/data/bluefin"
|
||||
forge_container_extra_args:
|
||||
- --build-arg="BASE_IMAGE_NAME=silverblue"
|
||||
- --build-arg="IMAGE_FLAVOR=main"
|
||||
- --build-arg="AKMODS_FLAVOR=main"
|
||||
- --build-arg="FEDORA_MAJOR_VERSION=39"
|
||||
- --build-arg="TARGET_BASE=bluefin"
|
|
@ -8,34 +8,59 @@
|
|||
name: debug_forge_vars
|
||||
|
||||
tasks:
|
||||
- name: Build and push image to registry
|
||||
- name: Build and upload container image
|
||||
containers.podman.podman_image:
|
||||
name: "{{ forge_git_repository_url | regex_search(__regex_search) }}"
|
||||
name: "{{ forge_container_name }}"
|
||||
tag: latest
|
||||
path: "{{ forge_git_repository_destination }}"
|
||||
build:
|
||||
file: "{{ forge_container_file | default('Containerfile') }}"
|
||||
format: "{{ forge_container_format | default('oci') }}"
|
||||
file: "{{ forge_container_file }}"
|
||||
format: "{{ forge_container_format }}"
|
||||
extra_args: "{{ forge_container_extra_args | join(' ') }}"
|
||||
pull: false
|
||||
push: true
|
||||
push_args:
|
||||
dest: "{{ forge_registry_url }}"
|
||||
vars:
|
||||
__regex_search: (?<=/)[^/]+(?=\.git)
|
||||
async: 1800
|
||||
async: 900
|
||||
poll: 0
|
||||
register: __podman_image
|
||||
|
||||
- name: Waiting for container build to finish
|
||||
- name: Waiting for container build and upload to finish
|
||||
ansible.builtin.async_status:
|
||||
jid: "{{ __podman_image.ansible_job_id }}"
|
||||
register: __job_result
|
||||
until: __job_result.finished
|
||||
retries: 1800
|
||||
retries: 900
|
||||
delay: 1
|
||||
|
||||
- name: INFO | Status from build and push
|
||||
- name: INFO | Result from container image build
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "{{ __job_result.actions | to_nice_yaml(indent=2) }}"
|
||||
- "{{ __job_result.image | to_nice_yaml(indent=2) }}"
|
||||
|
||||
- name: Add additional tag to container image
|
||||
containers.podman.podman_tag:
|
||||
image: "{{ forge_container_name }}:latest"
|
||||
target_names:
|
||||
- "{{ forge_container_name }}:{{ forge_container_tag }}"
|
||||
|
||||
- name: Push additional container image tag to registry
|
||||
containers.podman.podman_image:
|
||||
name: "{{ forge_container_name }}"
|
||||
tag: "{{ forge_container_tag }}"
|
||||
pull: false
|
||||
push: true
|
||||
async: 15
|
||||
poll: 0
|
||||
register: __podman_image
|
||||
|
||||
- name: Waiting for additional container image tag push to finish
|
||||
ansible.builtin.async_status:
|
||||
jid: "{{ __podman_image.ansible_job_id }}"
|
||||
register: __job_result
|
||||
until: __job_result.finished
|
||||
retries: 15
|
||||
delay: 1
|
||||
|
||||
- name: INFO | Result from additional container image tag push
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ __job_result.actions | to_nice_yaml(indent=2) }}"
|
||||
|
|
|
@ -14,7 +14,9 @@ ANSIBLE_EXTRA_VARS = None
|
|||
async def load_configuration_file() -> None:
|
||||
global ANSIBLE_EXTRA_VARS
|
||||
result = await local_file_picker(
|
||||
directory="/data", multiple=False, file_name_filter=".yml"
|
||||
directory="/data",
|
||||
multiple=False,
|
||||
# file_name_filter=".yml", # TODO: limit to yml files but make sure folders are visible as well
|
||||
)
|
||||
file_path = result[0]
|
||||
with open(file_path, "r") as file:
|
||||
|
|
|
@ -6,7 +6,7 @@ from utils.registry import DockerRegistry
|
|||
|
||||
## TODO: this should be async but I currently don't know how to implement this without button press
|
||||
def get_image_info() -> pandas.DataFrame:
|
||||
data = pandas.DataFrame(columns=["image_name", "tag", "size"])
|
||||
data = pandas.DataFrame(columns=["image", "tag", "size"])
|
||||
try:
|
||||
registry = DockerRegistry()
|
||||
all_image_info = registry.get_all_image_info()
|
||||
|
@ -24,8 +24,10 @@ def get_image_info() -> pandas.DataFrame:
|
|||
lambda layers: sum(layer["size"] for layer in layers)
|
||||
)
|
||||
)
|
||||
data = data[["image_name", "name", "size"]].rename(
|
||||
columns={"image_name": "image", "name": "tag", "size": "size"}
|
||||
data = (
|
||||
data[["image_name", "name", "size"]]
|
||||
.rename(columns={"image_name": "image", "name": "tag", "size": "size"})
|
||||
.sort_values(by=["image", "tag"], ascending=False)
|
||||
)
|
||||
data["size"] = data["size"].apply(humanize.naturalsize)
|
||||
return data
|
||||
|
@ -39,4 +41,7 @@ def content() -> None:
|
|||
with ui.card().classes("w-full"):
|
||||
ui.label("Image Overview").classes("text-h5")
|
||||
data = get_image_info()
|
||||
ui.table.from_pandas(df=data).classes("w-full")
|
||||
with ui.table.from_pandas(df=data).classes("w-full") as table:
|
||||
table.columns[0]["sortable"] = True
|
||||
table.columns[1]["sortable"] = True
|
||||
table.columns[2]["sortable"] = True
|
||||
|
|
|
@ -35,9 +35,10 @@ def frame(
|
|||
with ui.grid(columns=3).classes("w-full gap-0"):
|
||||
with ui.row(wrap=False).classes("col-span-1 justify-start"):
|
||||
menu()
|
||||
ui.image(source=f"{project_root}/pages/assets/ublue-mini.svg").props(
|
||||
"width=33px hight=auto"
|
||||
)
|
||||
with ui.link(target="/"):
|
||||
ui.image(
|
||||
source=f"{project_root}/pages/assets/ublue-mini.svg"
|
||||
).props("width=33px hight=auto")
|
||||
ui.label(text="Forge").classes("text-h5")
|
||||
with ui.row(wrap=False).classes("col-span-1 justify-center"):
|
||||
ui.label(text=navigation_title).classes("text-h5")
|
||||
|
|
|
@ -41,21 +41,24 @@ ln -s $FORGE_POD_DATA_DIR $HOME/ublue-os_forge-data
|
|||
|
||||
With this the data folder would be available in your home directory under `~/ublue-os_forge-data`
|
||||
|
||||
In that folder you will find an example configuration similar to this:
|
||||
In that folder you will find an **examples** folder with example configurations similar to this:
|
||||
|
||||
```yaml
|
||||
## ublue-os forge extra-vars example configuration
|
||||
## ublue-os forge example configuration
|
||||
## For more details got to https://github.com/ublue-os/forge/blob/main/docs/variables.md
|
||||
---
|
||||
forge_git_repository_url: https://github.com/ublue-os/bluefin.git
|
||||
forge_git_repository_destination: /var/home/stephan/.local/share/containers/storage/volumes/ublue-os_forge-data/_data/data/bluefin
|
||||
forge_git_repository_version: main
|
||||
forge_registry_url: registry.ublue.local
|
||||
forge_git_repository_destination: "/var/home/stephan/.local/share/containers/storage/volumes/ublue-os_forge-data/_data/data/bluefin"
|
||||
forge_container_extra_args:
|
||||
- --build-arg="BASE_IMAGE_NAME=silverblue"
|
||||
- --build-arg="IMAGE_FLAVOR=main"
|
||||
- --build-arg="AKMODS_FLAVOR=main"
|
||||
- --build-arg="FEDORA_MAJOR_VERSION=39"
|
||||
- --build-arg="TARGET_BASE=bluefin"
|
||||
```
|
||||
|
||||
This file acts as a template. It has all available settings outlined for you. Simple copy
|
||||
it and modify it to your liking. For each project you want to handle with the forge you can
|
||||
create a dedicated file.
|
||||
These files are a good starting point for your custom configuration. Simple copy those examples
|
||||
you are interested in modify them to your liking.
|
||||
|
||||
Details about the available variables are documented [here](./variables.md).
|
||||
|
||||
|
|
|
@ -10,16 +10,16 @@ The following configuration variables are available and can be set to your likin
|
|||
|
||||
<!-- markdownlint-disable MD013 -->
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---------------------------------- | ---- | ------------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| `forge_container_file` | str | Containerfile | Path to the Containerfile for Podman to build |
|
||||
| `forge_container_format` | str | oci | Format of the image Podman will build. Can be either `oci` or `docker` |
|
||||
| `forge_git_repository_url` | str | <https://github.com/ublue-os/bluefin.git> | Git repository url |
|
||||
| `forge_git_repository_destination` | str | `{{ forge_data_volume_mountpoint }}`/data/bluefin | Git destination where repository is cloned to. Can be any directory on your host |
|
||||
| `forge_git_repository_version` | str | main | Git repository branch or tag or commit version |
|
||||
| `forge_registry_url` | str | registry.ublue.local | Container registry url |
|
||||
| Name | Type | Default value | Description |
|
||||
| ---------------------------------- | ---- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `forge_container_name` | str | Project name derived from `forge_git_repository_url` Example: `bluefin` | Container image name. |
|
||||
| `forge_container_tag` | str | Evaluates to: `YYY-MM-DD_HHMMSS` Example: `2024-05-26_192206` | Container image tag. |
|
||||
| `forge_container_file` | str | Containerfile | Path to the Containerfile for Podman to build |
|
||||
| `forge_container_format` | str | oci | Format of the image Podman will build. Can be either `oci` or `docker` |
|
||||
| `forge_container_extra_args` | list | [] | List of extra arguments which gets passed to the podman build process. Example: `[--build-arg="BASE_IMAGE_NAME=silverblue"]` |
|
||||
| `forge_git_repository_url` | str | | Git repository url |
|
||||
| `forge_git_repository_destination` | str | | Git destination where repository is cloned to. |
|
||||
| `forge_git_repository_version` | str | main | Git repository branch or tag or commit version |
|
||||
| `forge_registry_url` | str | registry.ublue.local | Container registry url |
|
||||
|
||||
<!-- markdownlint-enable MD013-->
|
||||
|
||||
**_Note:_** The `{{ forge_data_volume_mountpoint }}` points to your ublue-os_forge-data
|
||||
podman volume.
|
||||
|
|
|
@ -27,10 +27,6 @@ spec:
|
|||
containers:
|
||||
- name: traefik.${FORGE_DOMAIN_NAME}
|
||||
image: traefik # will be built on pod start
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 200m
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/podman.sock
|
||||
name: podman-socket
|
||||
|
@ -77,10 +73,6 @@ spec:
|
|||
containers:
|
||||
- name: docker.${FORGE_DOMAIN_NAME}
|
||||
image: registry # will be built on pod start
|
||||
resources:
|
||||
limits:
|
||||
memory: 512Mi
|
||||
cpu: 200m
|
||||
volumeMounts:
|
||||
- mountPath: /certs
|
||||
name: ublue-os_forge-certs-pvc
|
||||
|
|
Loading…
Reference in a new issue