From b5f7e9cdd5f9fb55b08f2300046d56aa4d157d01 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 25 Jan 2025 17:21:30 +1100 Subject: [PATCH] test: debug --- .gitea/workflows/deploy.yaml | 9 +-------- Makefile | 19 ++++++++++++------- ci/build.sh | 1 - 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 0d155c2..ec56b72 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -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: diff --git a/Makefile b/Makefile index 35a9d55..fa98ee7 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,8 @@ $(DIRS): export VAULT_TOKEN=$$(vault write -field=token auth/approle/login role_id=$$VAULT_ROLEID) && \ eval $$(vault kv get -format=json kv/service/packer/builder/env | jq -r '.data.data | to_entries[] | "export \(.key)=\(.value)"') - @echo "Environment retrieved for $@" - # 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 +58,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 +80,16 @@ $(DIRS): export SUFFIX=$(SUFFIX) && \ export GIT_COMMIT=$(GIT_COMMIT) && \ export GIT_BRANCH=$(GIT_BRANCH) && \ + echo "Starting packer init for $@" && \ + pwd + ls -lha + env 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'); \ diff --git a/ci/build.sh b/ci/build.sh index 46fe8ca..f8be9e2 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -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/')