Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume reusable linting workflow #1371

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,8 @@ on:
env:
FORCE_COLOR: 1
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ^1.20
- name: Install earthly
uses: Luet-lab/luet-install-action@v1
with:
repository: quay.io/kairos/packages
packages: utils/earthly
- name: Run Lint checks
run: |
earthly +lint
call-workflow:
uses: kairos-io/linting-composite-action/.github/workflows/reusable-linting.yaml@main
with:
yamldirs: ".github/workflows/ overlay/"
is-go: false
20 changes: 20 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# We use "override" instead of "ignore" to still see these issues.
# With the "failure-threshold" set to "warning" below, these should not make
# the test fail.
override:
info:
# warning: Specify version with `zypper install -y <package>=<version>`.
- DL3037
# warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
- DL3018
# warning: Specify version with `dnf install -y <package>-<version>`.
- DL3041
# warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
- DL3008
# warning: Always tag the version of an image explicitly
# Reason: We build "latest" images using "latest" base images.
- DL3006
# warning: Use WORKDIR to switch to a directory
# Reason: Sometimes we don't want to change the workdir
- DL3003
failure-threshold: warning
3 changes: 2 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ hadolint:
ARG HADOLINT_VERSION
FROM hadolint/hadolint:$HADOLINT_VERSION
WORKDIR /images
COPY images .
COPY images/Dockerfile* .
COPY .hadolint.yaml .
RUN ls
RUN find . -name "Dockerfile*" -print | xargs -r -n1 hadolint

Expand Down
1 change: 1 addition & 0 deletions examples/byoi/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ RUN systemctl enable cos-setup-reconcile.timer && \
systemctl enable cos-setup-network.service

## Generate initrd
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN kernel=$(ls /boot/vmlinuz-* | head -n1) && \
ln -sf "${kernel#/boot/}" /boot/vmlinuz
RUN kernel=$(ls /lib/modules | head -n1) && \
Expand Down
2 changes: 1 addition & 1 deletion examples/cloud-configs/initramfs-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ stages:
initramfs:
- name: "Setup users"
commands:
- echo "foo" > /etc/kubernetes/...
- echo "foo" > /etc/kubernetes/...
4 changes: 2 additions & 2 deletions examples/cloud-configs/worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ users:
k3s-agent:
enabled: true
env:
K3S_TOKEN: ...
K3S_URL: ...
K3S_TOKEN: ...
K3S_URL: ...
2 changes: 1 addition & 1 deletion examples/plans/network_token_rotation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ spec:
upgrade:
image: quay.io/kairos/kairos
command: ["sh"]
args: [ "/rotate-token/rotate.sh"]
args: ["/rotate-token/rotate.sh"]
19 changes: 9 additions & 10 deletions images/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG BASE_IMAGE=fedora:36
FROM $BASE_IMAGE

RUN echo "install_weak_deps=False" >> /etc/dnf/dnf.conf
RUN dnf install -y "https://zfsonlinux.org/fedora/zfs-release-2-2$(rpm --eval "%{dist}").noarch.rpm"
RUN dnf install -y "https://zfsonlinux.org/fedora/zfs-release-2-2$(rpm --eval "%{dist}").noarch.rpm" && dnf clean all
RUN dnf install -y \
NetworkManager \
squashfs-tools \
Expand Down Expand Up @@ -53,12 +53,11 @@ RUN dnf install -y \
zfs \
rsync && dnf clean all

RUN mkdir -p /run/lock
RUN touch /usr/libexec/.keep
RUN systemctl enable [email protected]
RUN systemctl enable [email protected]
RUN systemctl enable [email protected]

RUN systemctl enable systemd-networkd
RUN systemctl enable systemd-resolved
RUN systemctl enable sshd
RUN mkdir -p /run/lock && \
touch /usr/libexec/.keep && \
systemctl enable [email protected] && \
systemctl enable [email protected] && \
systemctl enable [email protected] && \
systemctl enable systemd-networkd && \
systemctl enable systemd-resolved && \
systemctl enable sshd
2 changes: 1 addition & 1 deletion images/Dockerfile.rockylinux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM $BASE_IMAGE

RUN echo "install_weak_deps=False" >> /etc/dnf/dnf.conf

RUN dnf install -y epel-release
RUN dnf install -y epel-release && dnf clean all
RUN dnf update -y
RUN dnf makecache
RUN dnf install -y \
Expand Down
8 changes: 4 additions & 4 deletions tests/assets/autoinstall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ install:


stages:
initramfs:
- name: "Set user and password"
users:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"
hostname: kairos-{{ trunc 4 .Random }}
hostname: kairos-{{ trunc 4 .Random }}
8 changes: 4 additions & 4 deletions tests/assets/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#cloud-config

stages:
initramfs:
- name: "Set user and password"
users:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"
hostname: kairos-{{ trunc 4 .Random }}
hostname: kairos-{{ trunc 4 .Random }}
8 changes: 4 additions & 4 deletions tests/assets/live-overlay.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#cloud-config

stages:
initramfs:
- name: "Set user and password"
users:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"
hostname: kairos-{{ trunc 4 .Random }}
hostname: kairos-{{ trunc 4 .Random }}
6 changes: 3 additions & 3 deletions tests/assets/single.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#cloud-config

stages:
initramfs:
- name: "Set user and password"
users:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"

Expand Down
14 changes: 7 additions & 7 deletions tests/assets/zfs.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#node-config

stages:
initramfs:
- name: "Set user and password"
users:
initramfs:
- name: "Set user and password"
users:
kairos:
passwd: "kairos"
hostname: kairos-{{ trunc 4 .Random }}
rootfs:
- modules:
- zfs
hostname: kairos-{{ trunc 4 .Random }}
rootfs:
- modules:
- zfs