Skip to content

Minor fixes and improvements #579

Minor fixes and improvements

Minor fixes and improvements #579

Workflow file for this run

name: snapshot-pipeline
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
quality-checks:
runs-on: self-hosted
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_DB: nginx_ignition_tests
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
ports:
- 44554:5432
env:
GOPATH: /data/cache/go
GOMODCACHE: /data/cache/go/pkg/mod
GOTOOLCHAIN: ""
PNPM_HOME: /data/cache/pnpm
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check if CHANGELOG.md was updated
if: github.ref != 'refs/heads/main'
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
BASE="origin/${{ github.base_ref }}"
else
BASE="origin/main"
fi
echo "Comparing against $BASE"
if git diff --quiet $BASE...HEAD -- CHANGELOG.md; then
echo "::error::CHANGELOG.md was not updated in this branch/PR. Please add an entry to the CHANGELOG."
exit 1
fi
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-go@v5
with:
go-version: 1.26.2
- name: Unit tests
env:
TEST_POSTGRES_HOST: runner.local
TEST_POSTGRES_PORT: 44554
run: make test
- name: Lint
run: make lint
- name: Sonarqube
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build:
runs-on: self-hosted
permissions:
contents: write
env:
GOPATH: /data/cache/go
GOMODCACHE: /data/cache/go/pkg/mod
PNPM_HOME: /data/cache/pnpm
steps:
- uses: actions/checkout@v5
- name: Extract version from CHANGELOG.md
id: version
run: echo "VERSION=$(grep -m 1 "^## " CHANGELOG.md | sed 's/## //')" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-go@v5
with:
go-version: 1.26.2
- name: Install nfpm
run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install -y nfpm gettext-base
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
driver: docker-container
driver-opts: |
image=moby/buildkit:master
network=host
platforms: linux/amd64,linux/arm64
- uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and release
run: make build-snapshot PR_ID=${{ github.event.pull_request.number }} VERSION=${{ steps.version.outputs.VERSION }}
- name: Update GitHub Pre-release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RAW_DIGEST=$(docker buildx imagetools inspect dillmann/nginx-ignition:${{ steps.version.outputs.VERSION }}-snapshot --format '{{json .}}' | jq -r '.manifest.manifests[0].digest')
DOCKER_IMAGE_HASH=$(echo $RAW_DIGEST | sed 's/:/-/g')
./.github/scripts/update-release.sh "$DOCKER_IMAGE_HASH" "true" "${{ steps.version.outputs.VERSION }}"