Add yaml linter (#1111)

Co-authored-by: Dimitris Karakasilis <jimmykarily@gmail.com>
This commit is contained in:
Itxaka 2024-10-16 17:27:34 +02:00 committed by GitHub
parent 24ed37c490
commit 066659219a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 78 additions and 40 deletions

View File

@ -3,7 +3,7 @@ name: Autobump
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 20 * * *' - cron: '0 20 * * *'
jobs: jobs:
bump: bump:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -62,5 +62,5 @@ jobs:
git reset --hard upstream/${RESET_BRANCH} git reset --hard upstream/${RESET_BRANCH}
git push -fv -u origin $WORK_BRANCH git push -fv -u origin $WORK_BRANCH
export TREE_DIR=$PWD/packages export TREE_DIR=$PWD/packages
luet autobump-github luet autobump-github

View File

@ -1,13 +1,12 @@
name: Build ARM64 name: Build ARM64
concurrency: concurrency:
group: "master-arm64-build" group: "master-arm64-build"
#cancel-in-progress: true
on: on:
push: push:
branches: [ main ] branches:
- main
jobs: jobs:
build: build:
runs-on: ARM64 runs-on: ARM64
env: env:

View File

@ -1,13 +1,12 @@
name: Build name: Build
concurrency: concurrency:
group: "master-build" group: "master-build"
#cancel-in-progress: true
on: on:
push: push:
branches: [ main ] branches:
- main
jobs: jobs:
build: build:
runs-on: fast runs-on: fast
env: env:

13
.github/workflows/lint.yaml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Lint
on:
push:
branches:
- main
pull_request:
permissions: read-all
jobs:
call-workflow:
uses: kairos-io/linting-composite-action/.github/workflows/reusable-linting.yaml@8dd82218a024735daac578d2588522a5b4bb2614 # v0.0.9
with:
yamldirs: ".github/workflows/ packages/static/kairos-overlay-files/files"
is-go: false

21
.yamllint Normal file
View File

@ -0,0 +1,21 @@
extends: default
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 305
level: warning
# accept both key:
# - item
#
# and key:
# - item
indentation:
indent-sequences: whatever
truthy:
check-keys: false
document-start:
present: false

View File

@ -22,6 +22,7 @@ depends() {
# shellcheck disable=SC2144 # shellcheck disable=SC2144
# add network-legacy module if it exists # add network-legacy module if it exists
# shellcheck disable=SC2154
if [ -d "${dracutbasedir}"/modules.d/??network-legacy ]; then if [ -d "${dracutbasedir}"/modules.d/??network-legacy ]; then
network_handler="network-legacy" network_handler="network-legacy"
fi fi

View File

@ -4,14 +4,14 @@ set -euxo pipefail
RELEASE=$1 RELEASE=$1
DOWNLOAD_DIR=$2 DOWNLOAD_DIR=$2
ARCH=$3 ARCH=$3
cd $DOWNLOAD_DIR cd "$DOWNLOAD_DIR"
sudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet,kubectl} sudo curl -L --remote-name-all https://dl.k8s.io/release/"${RELEASE}"/bin/linux/"${ARCH}"/{kubeadm,kubelet,kubectl}
sudo chmod +x {kubeadm,kubelet,kubectl} sudo chmod +x {kubeadm,kubelet,kubectl}
cd - cd -
cat files/etc/systemd/system/kubelet.service | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service sed "s:/usr/bin:${DOWNLOAD_DIR}:g" files/etc/systemd/system/kubelet.service | sudo tee /etc/systemd/system/kubelet.service
sudo mkdir -p /etc/systemd/system/kubelet.service.d sudo mkdir -p /etc/systemd/system/kubelet.service.d
cat files/etc/systemd/system/kubelet.service.d/10-kubeadm.conf | sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf sed "s:/usr/bin:${DOWNLOAD_DIR}:g" files/etc/systemd/system/kubelet.service.d/10-kubeadm.conf | sudo tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
mkdir -p /etc/default mkdir -p /etc/default
cp files/etc/default/kubelet /etc/default cp files/etc/default/kubelet /etc/default
systemctl enable kubelet systemctl enable kubelet

View File

@ -37,6 +37,7 @@ set -e
SCRIPT_DIR="$(dirname $(readlink -f "${0}"))" SCRIPT_DIR="$(dirname $(readlink -f "${0}"))"
SCRIPT_NAME="$(basename "${0}")" SCRIPT_NAME="$(basename "${0}")"
# shellcheck disable=SC1091
. "${SCRIPT_DIR}/nvcommon_build.sh" . "${SCRIPT_DIR}/nvcommon_build.sh"
function usage { function usage {

View File

@ -1,4 +1,4 @@
packages: packages:
- name: "kairos-overlay-files" - name: "kairos-overlay-files"
category: "static" category: "static"
version: "1.3.4" version: "1.4.0"

View File

@ -143,7 +143,7 @@ stages:
- if: '[ ! -f "/run/cos/recovery_mode" ] && [ -f "/sbin/openrc" ]' - if: '[ ! -f "/run/cos/recovery_mode" ] && [ -f "/sbin/openrc" ]'
name: "Restore /etc/machine-id for openrc systems" name: "Restore /etc/machine-id for openrc systems"
commands: commands:
- dbus-uuidgen --ensure # This makes sure that the machine-id exists and its valid - dbus-uuidgen --ensure # This makes sure that the machine-id exists and its valid
- cat /var/lib/dbus/machine-id > /etc/machine-id - cat /var/lib/dbus/machine-id > /etc/machine-id
fs: fs:
- if: '[ ! -f "/run/cos/recovery_mode" ] && [ ! -s /usr/local/etc/machine-id ] ' - if: '[ ! -f "/run/cos/recovery_mode" ] && [ ! -s /usr/local/etc/machine-id ] '

View File

@ -59,4 +59,4 @@ stages:
environment_file: /run/cos/cos-layout.env environment_file: /run/cos/cos-layout.env
environment: environment:
RW_PATHS: "/var /etc /srv /home" RW_PATHS: "/var /etc /srv /home"
OVERLAY: "tmpfs:25%" OVERLAY: "tmpfs:25%"

View File

@ -1,10 +1,10 @@
name: "Default network configuration" name: "Default network configuration"
stages: stages:
rootfs.before: rootfs.before:
- name: "Enable systemd-network config files for DHCP" # Needed if systemd-networkd runs in the initramfs! - name: "Enable systemd-network config files for DHCP" # Needed if systemd-networkd runs in the initramfs!
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
directories: directories:
- path: "/etc/systemd/network/" # doesnt exist on initramfs - path: "/etc/systemd/network/" # doesnt exist on initramfs
permissions: 0775 permissions: 0775
owner: 0 owner: 0
group: 0 group: 0
@ -32,7 +32,7 @@ stages:
[DHCP] [DHCP]
ClientIdentifier=mac ClientIdentifier=mac
commands: commands:
- networkctl reload # make sure it reloads our config files - networkctl reload # make sure it reloads our config files
initramfs: initramfs:
- name: "Enable systemd-network config files for DHCP" - name: "Enable systemd-network config files for DHCP"
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
@ -60,7 +60,7 @@ stages:
[DHCP] [DHCP]
ClientIdentifier=mac ClientIdentifier=mac
commands: commands:
- networkctl reload # make sure it reloads our config files - networkctl reload # make sure it reloads our config files
- name: "Disable NetworkManager and wicked" - name: "Disable NetworkManager and wicked"
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
systemctl: systemctl:
@ -82,12 +82,12 @@ stages:
- name: "Reload systemd-networkd config" - name: "Reload systemd-networkd config"
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
commands: commands:
- networkctl reload # make sure it reloads our config files - networkctl reload # make sure it reloads our config files
fs: fs:
- name: "Reload systemd-networkd config" - name: "Reload systemd-networkd config"
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
commands: commands:
- networkctl reload # make sure it reloads our config files - networkctl reload # make sure it reloads our config files
# dns: # dns:
# path: /etc/resolv.conf # path: /etc/resolv.conf
# nameservers: # nameservers:

View File

@ -109,7 +109,7 @@ stages:
██╔═██╗ ██╔══██║██║██╔══██╗██║ ██║╚════██║ ██╔═██╗ ██╔══██║██║██╔══██╗██║ ██║╚════██║
██║ ██╗██║ ██║██║██║ ██║╚██████╔╝███████║ ██║ ██╗██║ ██║██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
Kernel \r on an \m (\l) Kernel \r on an \m (\l)
permissions: 0755 permissions: 0755

View File

@ -46,12 +46,12 @@ stages:
[Unit] [Unit]
Description=cOS system configuration Description=cOS system configuration
Before=getty.target Before=getty.target
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/usr/bin/kairos-agent run-stage boot ExecStart=/usr/bin/kairos-agent run-stage boot
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/systemd/system/cos-setup-fs.service - path: /etc/systemd/system/cos-setup-fs.service
@ -65,12 +65,12 @@ stages:
After=local-fs.target After=local-fs.target
Wants=local-fs.target Wants=local-fs.target
Before=sysinit.target Before=sysinit.target
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/usr/bin/kairos-agent run-stage fs ExecStart=/usr/bin/kairos-agent run-stage fs
[Install] [Install]
WantedBy=sysinit.target WantedBy=sysinit.target
- path: /etc/systemd/system/cos-setup-network.service - path: /etc/systemd/system/cos-setup-network.service
@ -81,12 +81,12 @@ stages:
[Unit] [Unit]
Description=cOS setup after network Description=cOS setup after network
After=network-online.target After=network-online.target
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/usr/bin/kairos-agent run-stage network ExecStart=/usr/bin/kairos-agent run-stage network
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/systemd/system/cos-setup-reconcile.service - path: /etc/systemd/system/cos-setup-reconcile.service
@ -96,7 +96,7 @@ stages:
content: | content: |
[Unit] [Unit]
Description=cOS setup reconciler Description=cOS setup reconciler
[Service] [Service]
Nice=19 Nice=19
IOSchedulingClass=2 IOSchedulingClass=2
@ -106,7 +106,7 @@ stages:
TimeoutStopSec=180 TimeoutStopSec=180
KillMode=process KillMode=process
KillSignal=SIGINT KillSignal=SIGINT
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/systemd/system/cos-setup-reconcile.timer - path: /etc/systemd/system/cos-setup-reconcile.timer
@ -116,12 +116,12 @@ stages:
content: | content: |
[Unit] [Unit]
Description=cOS setup reconciler Description=cOS setup reconciler
[Timer] [Timer]
OnBootSec=5min OnBootSec=5min
OnUnitActiveSec=60min OnUnitActiveSec=60min
Unit=cos-setup-reconcile.service Unit=cos-setup-reconcile.service
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- name: "Enable systemd services" - name: "Enable systemd services"

View File

@ -45,7 +45,7 @@ stages:
initramfs.after: initramfs.after:
# Run this in the after stage so it doesnt collide with other initramfs changes to the /etc/inittab # Run this in the after stage so it doesnt collide with other initramfs changes to the /etc/inittab
# Otherwise this can lead to 2 steps modifying the inittab at the same time and overriding or not cleaning it properly # Otherwise this can lead to 2 steps modifying the inittab at the same time and overriding or not cleaning it properly
- name: "Enable serial login for alpine" # https://wiki.alpinelinux.org/wiki/Enable_Serial_Console_on_Boot - name: "Enable serial login for alpine" # https://wiki.alpinelinux.org/wiki/Enable_Serial_Console_on_Boot
if: '[ -e /sbin/openrc ]' if: '[ -e /sbin/openrc ]'
commands: commands:
- sed -i -e 's/ttyS0.*//g' /etc/inittab - sed -i -e 's/ttyS0.*//g' /etc/inittab

View File

@ -8,4 +8,4 @@ stages:
- name: "Set a safe date before user creation for RPI without hardware clocks" - name: "Set a safe date before user creation for RPI without hardware clocks"
if: '[ -f "/sbin/openrc" ] && [ -f "/proc/device-tree/model" ] && grep -i "Raspberry Pi" "/proc/device-tree/model"' if: '[ -f "/sbin/openrc" ] && [ -f "/proc/device-tree/model" ] && grep -i "Raspberry Pi" "/proc/device-tree/model"'
commands: commands:
- date -s "2006-08-14 02:34:56-06:00" - date -s "2006-08-14 02:34:56-06:00"

View File

@ -34,4 +34,4 @@ stages:
- sed -i -e 's/tty1.*//g' /etc/inittab - sed -i -e 's/tty1.*//g' /etc/inittab
- sed -i -e 's/ttyS0.*//g' /etc/inittab - sed -i -e 's/ttyS0.*//g' /etc/inittab
- echo "tty1::respawn:/sbin/agetty --autologin root -i --noclear tty1" >> /etc/inittab - echo "tty1::respawn:/sbin/agetty --autologin root -i --noclear tty1" >> /etc/inittab
- echo "ttyS0::respawn:/sbin/agetty --autologin root -i --noclear ttyS0" >> /etc/inittab - echo "ttyS0::respawn:/sbin/agetty --autologin root -i --noclear ttyS0" >> /etc/inittab

View File

@ -22,7 +22,7 @@ stages:
commands: commands:
- | - |
. /etc/os-release . /etc/os-release
[ -f "/etc/kairos-release" ] && . /etc/kairos-release [ -f "/etc/kairos-release" ] && . /etc/kairos-release
echo >> /etc/issue echo >> /etc/issue
echo "You are booting from recovery mode. Run 'kairos-agent reset' to reset the system to $VERSION" >> /etc/issue echo "You are booting from recovery mode. Run 'kairos-agent reset' to reset the system to $VERSION" >> /etc/issue
echo " or 'kairos-agent upgrade' to upgrade the active partition" >> /etc/issue echo " or 'kairos-agent upgrade' to upgrade the active partition" >> /etc/issue

View File

@ -52,8 +52,8 @@ stages:
[ -f "/sbin/openrc" ] [ -f "/sbin/openrc" ]
commands: commands:
- rc-service kairos-webui start - rc-service kairos-webui start
- if: | - if: |
([ -f /run/cos/live_mode ] || [ -f /run/cos/uki_install_mode ]) && \ ([ -f /run/cos/live_mode ] || [ -f /run/cos/uki_install_mode ]) && \
( [ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] ) ( [ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] )
commands: commands:
- systemctl start kairos-webui - systemctl start kairos-webui

View File

@ -4,14 +4,18 @@ HOST_DIR="${HOST_DIR:-/host}"
if [ "$FORCE" != "true" ]; then if [ "$FORCE" != "true" ]; then
if [ -f "/etc/kairos-release" ]; then if [ -f "/etc/kairos-release" ]; then
# shellcheck disable=SC1091
UPDATE_VERSION=$(source /etc/kairos-release && echo "${KAIROS_VERSION}") UPDATE_VERSION=$(source /etc/kairos-release && echo "${KAIROS_VERSION}")
else else
# shellcheck disable=SC1091
UPDATE_VERSION=$(source /etc/os-release && echo "${KAIROS_VERSION}") UPDATE_VERSION=$(source /etc/os-release && echo "${KAIROS_VERSION}")
fi fi
if [ -f "/etc/kairos-release" ]; then if [ -f "/etc/kairos-release" ]; then
# shellcheck disable=SC1091
CURRENT_VERSION=$(source "${HOST_DIR}"/etc/kairos-release && echo "${KAIROS_VERSION}") CURRENT_VERSION=$(source "${HOST_DIR}"/etc/kairos-release && echo "${KAIROS_VERSION}")
else else
# shellcheck disable=SC1091
CURRENT_VERSION=$(source "${HOST_DIR}"/etc/os-release && echo "${KAIROS_VERSION}") CURRENT_VERSION=$(source "${HOST_DIR}"/etc/os-release && echo "${KAIROS_VERSION}")
fi fi
@ -23,8 +27,8 @@ if [ "$FORCE" != "true" ]; then
fi fi
fi fi
mount --rbind $HOST_DIR/dev /dev mount --rbind "$HOST_DIR"/dev /dev
mount --rbind $HOST_DIR/run /run mount --rbind "$HOST_DIR"/run /run
recovery_mode=false recovery_mode=false
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do