I’m trying to run a build with Gitlab CI using the community packer docker image:
.gitlab-ci.yml looks like so:
--- image: hashicorp/packer:light stages: - build build_ami: stage: build script: - build -var-file variables.json centos-6.6-x86_64.json # vars are set in gitlab itself tags: - docker
Unfortunately, the build doesn’t work, and just seems to print the usage for packer, which indicates that the command isn’t running correctly:
gitlab-ci-multi-runner 1.1.2 (78b3f82) Using Docker executor with image hashicorp/packer:light ... Pulling docker image hashicorp/packer:light ... Running on runner-36f42261-project-326-concurrent-0 via gitlabrunner-3... Cloning repository... Cloning into '/builds/devops/packer-ami'... Checking out 52014387 as ci_build... Note: checking out '52014387c33a80ba117d0dd6860d4aa34cf98fec'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 5201438... HArd to debug this nonsense usage: packer [--version] [--help] <command> [<args>] Available commands are: build build image(s) from template fix fixes templates from old versions of packer inspect see components of a template push push a template and supporting files to a Packer build service validate check that a template is valid version Prints the Packer version ERROR: Build failed: exit code 1
This kinda infers that I’m running the script wrong. The entrypoint for the packer docker container is set to
/sbin/packer so the script seems fine, it’s as if something else is being run before the actual script inside the docker container.
Problem is, I don’t know what it’s running because I can’t seem to get a reasonable debug log. I’ve run the gitlab-runner in debug mode and I’m still none the wiser. I guess I have 2 questions:
- What actually runs inside the docker container on the runner?
- How can I better debug this build error?