nhs-england-tools / repository-template

🛠️ 📚💡 This is a detailed and carefully made template for your GitHub projects. It's based on the wide knowledge and practical experience of the engineering community within NHS England. The template includes helpful suggestions, standards and practices - it's something you should consider using for all your repositories.
MIT License
31 stars 12 forks source link

Docker make targets dont appear to work correctly #171

Open aidenvaines-bjss opened 4 months ago

aidenvaines-bjss commented 4 months ago

Is there an existing issue for this?

Current Behavior

The docker related make targets don't appear to work correctly you get

# make runner-act-workflow
source ./scripts/docker/docker.lib.sh
make: source: No such file or directory
make: *** [runner-act-workflow] Error 1

I believe the reason behind this is the docker targets have a flaw in that they use 'source' which is not POSIX compliant, its a bash built-in and not all shells support it. The POSIX compliant way is to use . (https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bourne-Shell-Builtins)

Expected Behavior

# make runner-act workflow=cicd-1-pull-request job=commit-stage
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
[1. CI/CD pull request/Set CI/CD metadata] 🚀  Start image=ghcr.io/catthehacker/ubuntu:full-latest

[1. CI/CD pull request/Set CI/CD metadata]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:full-latest platform=linux/amd64 username= forcePull=fa

Steps To Reproduce

make runner-act workflow=cicd-1-pull-request job=commit-stage

Output

No response

Code of Conduct

Sensitive Information Declaration

Tomdango commented 4 months ago

I've also recently setup a project and I'm seeing these errors - it is also affecting the pre-commit config for Terraform, meaning that for now the Git hooks have to be bypassed on commits, and I'm reliant on the CI to catch any problems here.

regularfry commented 2 months ago

So I believe https://github.com/nhs-england-tools/repository-template/blob/main/scripts/init.mk#L88 ought to be responsible for making that work. Can we understand why it isn't?

I can't see anything wrong with the proposed fix, but there might be something important we're missing here.