CI build returns 404...sometimes

Note: This may not be directly related to Gitlab, I’m not sure.

I have two repositories in a self-hosted Gitlab and both are using the same centralized script to do a container build using Kaniko. It does a wget command using the Busybox-based Kaniko image.

wget --no-check-certificate --header "PRIVATE-TOKEN: $BUILD_UTILS_TOKEN" "https://gitlab.example.com/api/v4/projects/117/repository/files/container%2Fkaniko.sh/raw?ref=main" # collapsed multi-line command

It works on one repository but the other says wget: server returned error: HTTP/1.1 404 Not Found. Furthermore, if I click the link in the CI pipeline, it loads the destination as I’d expect. Is there something Gitlab may be doing specific to a repository to cause this to fail?

Update on this. We discovered this problem happens when the pipeline executes from a branch which isn’t main. main works but any sub-branches don’t.

This sounds weird, have you checked the issues list?

The problem was caused by a variable incorrectly set as protected, thus the inconsistency based on branch and system where it was run.

1 Like