1
0
Fork 0

refactor: move images to images/

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
Vojtěch Mareš 2025-06-13 20:49:15 +02:00
parent ff8f943b3f
commit 1bfc4141b4
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
3 changed files with 13 additions and 19 deletions

View file

@ -3,8 +3,6 @@ image:
entrypoint: [""] entrypoint: [""]
variables: variables:
PACKER_LOG: 1 # enable detailed logging
PACKER_VAR_FILE: "vars.pkrvars.hcl"
PACKER_CONFIG_DIR: $CI_PROJECT_DIR PACKER_CONFIG_DIR: $CI_PROJECT_DIR
cache: cache:
@ -19,13 +17,14 @@ stages:
.parallel: .parallel:
parallel: parallel:
matrix: matrix:
- IMAGE: [ "flatcar" ] - IMAGE:
- flatcar-stable
validate: validate:
extends: .parallel extends: .parallel
stage: validate stage: validate
variables: variables:
PACKER_WORKSPACE: images/$IMAGE PACKER_WORKSPACE: images
script: script:
- packer init $PACKER_WORKSPACE - packer init $PACKER_WORKSPACE
- packer fmt -check $PACKER_WORKSPACE - packer fmt -check $PACKER_WORKSPACE
@ -34,11 +33,7 @@ validate:
build-image: build-image:
extends: .parallel extends: .parallel
stage: build stage: build
variables:
PACKER_FILE: images/$IMAGE/image.pkr.hcl
script: script:
- | - packer build $IMAGE.pkr.hcl
packer build \
$PACKER_FILE
rules: rules:
- if: $CI_COMMIT_BRANCH == "main" - if: $CI_COMMIT_BRANCH == "main"

View file

@ -4,6 +4,6 @@ A collection of custom images on my Hetzner Cloud.
## Images ## Images
| **Name** | **Version** | **Path** | | **Name** | **Version** | **Path** |
| -------- | ----------------- | ---------------- | | :------: | :---------------: | ------------------------------- |
| Flatcar | _Rolling release_ | `images/flatcar` | | Flatcar | _Rolling release_ | `images/flatcar-stable.pkr.hcl` |

View file

@ -2,14 +2,13 @@ packer {
required_plugins { required_plugins {
hcloud = { hcloud = {
source = "github.com/hetznercloud/hcloud" source = "github.com/hetznercloud/hcloud"
version = ">= 1.6.0, <= 2.0.0" version = ">= 1.6.0, < 2.0.0"
} }
} }
} }
variable "channel" { locals {
type = string flatcar_channel = "stable"
default = "stable"
} }
variable "hcloud_token" { variable "hcloud_token" {
@ -37,13 +36,13 @@ build {
source "hcloud.flatcar" { source "hcloud.flatcar" {
name = "x86" name = "x86"
server_type = "cx22" server_type = "cx22"
snapshot_name = "flatcar-${var.channel}-amd64-${formatdate("YYYY-MM-DD", timestamp())}" snapshot_name = "flatcar-${local.flatcar_channel}-amd64-${formatdate("YYYY-MM-DD", timestamp())}"
} }
source "hcloud.flatcar" { source "hcloud.flatcar" {
name = "arm" name = "arm"
server_type = "cax11" server_type = "cax11"
snapshot_name = "flatcar-${var.channel}-arm64-${formatdate("YYYY-MM-DD", timestamp())}" snapshot_name = "flatcar-${local.flatcar_channel}-arm64-${formatdate("YYYY-MM-DD", timestamp())}"
} }
provisioner "shell" { provisioner "shell" {
@ -54,7 +53,7 @@ build {
"chmod +x flatcar-install", "chmod +x flatcar-install",
# Install flatcar # Install flatcar
"./flatcar-install -s -o hetzner -C ${var.channel}", "./flatcar-install -s -o hetzner -C ${local.flatcar_channel}",
] ]
} }
} }