test: debug
All checks were successful
Build / build (pull_request) Successful in 5s

This commit is contained in:
Ben Vincent 2025-01-25 17:21:30 +11:00
parent 7a1d25f3b6
commit 54e8412d92
3 changed files with 14 additions and 14 deletions

View File

@ -9,17 +9,10 @@ jobs:
build:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux8:latest
image: git.query.consul/unkin/almalinux9-actionsdind:latest
options: --privileged
steps:
- name: Set up environment
run: |
dnf install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf module enable -y nodejs:20
dnf install -y docker-ce-cli make bash git nodejs
- name: Checkout code
uses: actions/checkout@v3
with:

View File

@ -44,9 +44,11 @@ $(DIRS):
eval $$(vault kv get -format=json kv/service/packer/builder/env | jq -r '.data.data | to_entries[] | "export \(.key)=\(.value)"')
@echo "Environment retrieved for $@"
env | grep -i CONSUL
env | grep -i VAULT
# Check if on master branch
@if [ "$(GIT_BRANCH)" = "master" ]; then \
if [ "$(GIT_BRANCH)" = "master" ]; then \
echo "Current branch is $(GIT_BRANCH), checking latest timestamp in consul."; \
LAST_BUILD_TIMESTAMP=$$(consul kv get infra/packer/$@/timestamp || echo "0"); \
CURRENT_TIME=$$(date +%s); \
@ -60,15 +62,17 @@ $(DIRS):
fi
# Link .hcl files
@find $(LIBRARY_PATH) -name '*.hcl' -exec sh -c 'ln -sf $$PWD/{} $(IMAGES_PATH)/$@/$(SYMLINK_PREFIX)$$(basename {})' \;
@echo "Linking .hcl files for $@"
find $(LIBRARY_PATH) -name '*.hcl' -exec sh -c 'ln -sf $$PWD/{} $(IMAGES_PATH)/$@/$(SYMLINK_PREFIX)$$(basename {})' \;
# Link builds
@for build in $$(cat $(IMAGES_PATH)/$@/builds); do \
@echo "Linking build files for $@"
for build in $$(cat $(IMAGES_PATH)/$@/builds); do \
ln -sf ../../../../builds/$${build}.pkr.hcl $(IMAGES_PATH)/$@/library_$${build}.build.pkr.hcl; \
done
# Build the image
@(cd $(IMAGES_PATH)/$@ && \
(cd $(IMAGES_PATH)/$@ && \
export DATE=$(DATE_TAG) && \
export OS_NAME=$$(echo $@ | cut -d'/' -f1) && \
export OS_VERSION_FULL=$$(echo $@ | cut -d'/' -f2) && \
@ -80,11 +84,15 @@ $(DIRS):
export SUFFIX=$(SUFFIX) && \
export GIT_COMMIT=$(GIT_COMMIT) && \
export GIT_BRANCH=$(GIT_BRANCH) && \
echo "Starting packer init for $@" && \
pwd
ls -lha
packer init . && \
echo "Starting packer build for $@" && \
packer build . )
# Update build timestamp and date in Consul if on master branch
@if [ "$(GIT_BRANCH)" = "master" ]; then \
if [ "$(GIT_BRANCH)" = "master" ]; then \
echo "Current branch is $(GIT_BRANCH), updating consul."; \
CURRENT_TIMESTAMP=$$(date +%s); \
READABLE_DATE=$$(date '+%Y-%m-%d %H:%M:%S %Z'); \

View File

@ -1,7 +1,6 @@
#!/bin/bash
# Check for changes in images/ folder and the builds/ folder
git fetch origin master:master
if [ "$(git branch --show-current)" = "master" ]; then
builds_changes=$(git diff --name-only HEAD^...master | grep -E '^builds/')
images_changes=$(git diff --name-only HEAD^...master | grep -E '^images/')