Skip to content

Commit

Permalink
support building hetzner disk images
Browse files Browse the repository at this point in the history
  • Loading branch information
dustymabe committed Feb 13, 2025
1 parent e1943d6 commit 7087148
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/builds/cosa_v1.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package builds

// generated by 'make schema'
// source hash: d7b6e01415317b89e346747884eb3536cc9e78049a2c71615739afd51fa65569
// source hash: 58da31f35c1405d5a752a297d0ee012f577720f810113d38cdabca102ec7edd8

type AdvisoryDiff []AdvisoryDiffItems

Expand Down Expand Up @@ -93,6 +93,7 @@ type BuildArtifacts struct {
Exoscale *Artifact `json:"exoscale,omitempty"`
ExtensionsContainer *Artifact `json:"extensions-container,omitempty"`
Gcp *Artifact `json:"gcp,omitempty"`
Hetzner *Artifact `json:"hetzner,omitempty"`
HyperV *Artifact `json:"hyperv,omitempty"`
IbmCloud *Artifact `json:"ibmcloud,omitempty"`
Initramfs *Artifact `json:"initramfs,omitempty"`
Expand Down
9 changes: 8 additions & 1 deletion pkg/builds/schema_doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by ./generate-schema.sh
// Source hash: d7b6e01415317b89e346747884eb3536cc9e78049a2c71615739afd51fa65569
// Source hash: 58da31f35c1405d5a752a297d0ee012f577720f810113d38cdabca102ec7edd8
// DO NOT EDIT

package builds
Expand Down Expand Up @@ -458,6 +458,7 @@ var generatedSchemaJSON = `{
"legacy-oscontainer",
"gcp",
"kubevirt",
"hetzner",
"hyperv",
"ibmcloud",
"powervs",
Expand Down Expand Up @@ -684,6 +685,12 @@ var generatedSchemaJSON = `{
"type": "object",
"title": "HyperV",
"$ref": "#/definitions/artifact"
},
"hetzner": {
"$id": "#/properties/images/properties/hetzner",
"type": "object",
"title": "Hetzner",
"$ref": "#/definitions/artifact"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/cmd-buildextend-hetzner
1 change: 1 addition & 0 deletions src/cmd-osbuild
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dn=$(dirname "$0")
declare -A SUPPORTED_PLATFORMS=(
['applehv']='raw'
['gcp']='tar.gz'
['hetzner']='raw'
['hyperv']='vhdx'
['metal4k']='raw'
['metal']='raw'
Expand Down
2 changes: 2 additions & 0 deletions src/osbuild-manifests/coreos.osbuild.aarch64.mpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ pipelines:
path: platform.applehv.ipp.yaml
- mpp-import-pipelines:
path: platform.gcp.ipp.yaml
- mpp-import-pipelines:
path: platform.hetzner.ipp.yaml
- mpp-import-pipelines:
path: platform.hyperv.ipp.yaml
- mpp-import-pipelines:
Expand Down
2 changes: 2 additions & 0 deletions src/osbuild-manifests/coreos.osbuild.x86_64.mpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ pipelines:
path: platform.applehv.ipp.yaml
- mpp-import-pipelines:
path: platform.gcp.ipp.yaml
- mpp-import-pipelines:
path: platform.hetzner.ipp.yaml
- mpp-import-pipelines:
path: platform.hyperv.ipp.yaml
- mpp-import-pipelines:
Expand Down
69 changes: 69 additions & 0 deletions src/osbuild-manifests/platform.hetzner.ipp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This file isn't yet being used today but holds an OSBuild image
# definition for the hyperv platform.
version: '2'
pipelines:
- name: raw-hetzner-image
build:
mpp-format-string: '{buildroot}'
stages:
- type: org.osbuild.copy
inputs:
tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:raw-image
options:
paths:
- from: input://tree/disk.img
to: tree:///disk.img
# Increase the size to the cloud image size
- type: org.osbuild.truncate
options:
filename: disk.img
size:
mpp-format-string: "{cloud_image_size_mb * 1024 * 1024}"
- type: org.osbuild.coreos.platform
options:
platform: hetzner
devices:
disk:
type: org.osbuild.loopback
options:
filename: disk.img
partscan: true
mounts:
- name: root
type: org.osbuild.xfs
source: disk
partition:
mpp-format-int: '{image.layout[''root''].partnum}'
target: /
- name: ostree.deployment
type: org.osbuild.ostree.deployment
options:
source: mount
deployment:
default: true
- name: boot
type: org.osbuild.ext4
source: disk
partition:
mpp-format-int: '{image.layout[''boot''].partnum}'
target: /boot
- name: hetzner
build:
mpp-format-string: '{buildroot}'
stages:
- type: org.osbuild.copy
inputs:
tree:
type: org.osbuild.tree
origin: org.osbuild.pipeline
references:
- name:raw-hetzner-image
options:
paths:
- from: input://tree/disk.img
to:
mpp-format-string: 'tree:///{artifact_name_prefix}-hetzner.{arch}.raw'
7 changes: 7 additions & 0 deletions src/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
"legacy-oscontainer",
"gcp",
"kubevirt",
"hetzner",
"hyperv",
"ibmcloud",
"powervs",
Expand Down Expand Up @@ -678,6 +679,12 @@
"type": "object",
"title": "HyperV",
"$ref": "#/definitions/artifact"
},
"hetzner": {
"$id": "#/properties/images/properties/hetzner",
"type": "object",
"title": "Hetzner",
"$ref": "#/definitions/artifact"
}
}
},
Expand Down

0 comments on commit 7087148

Please sign in to comment.