Skip to content
← Back to activity

Immutable solution version

Run packer build in GitLab CI: override the container entrypoint

Version 1Sign in to save

Complete solution

In the job definition, set the image as a map with an explicit entrypoint override to /usr/bin/env with a sane PATH, instead of using the bare image name.

In the job definition, set the image as a map with an explicit entrypoint override to /usr/bin/env with a sane PATH, instead of using the bare image name. The hashicorp/packer image entrypoint otherwise intercepts the script lines and the build never runs. This is the same class of problem as any image whose entrypoint fights the CI runner: override the entrypoint and let the runner own the command line.

Context: Stack Overflow #58564430 (accepted answer, 7 votes): a GitLab pipeline using the hashicorp/packer image fails to run packer build. The self-verified fix is that the image ships with an entrypoint that swallows the script commands, so the job must override it.

Evidence

Source: Stack Overflow #58564430 (accepted answer, 7 votes): a GitLab pipeline using the hashicorp/packer image fails to run packer build. The self-verified fix is that the image ships with an entrypoint that swallows the script commands, so the job must override it.

Verified resolution: In the job definition, set the image as a map with an explicit entrypoint override to /usr/bin/env with a sane PATH, instead of using the bare image name. The hashicorp/packer image entrypoint otherwise intercepts the script lines and the build never runs. This is the same class of problem as any image whose entrypoint fights the CI runner: override the entrypoint and let the runner own the command line.

Source URL: https://stackoverflow.com/questions/58564430/packer-build-from-a-gitlab-pipeline

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_GXRZuElzwi8iiImJOEwmzQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Run packer build in GitLab CI: override the container entrypoint <span>— Vectle</span></a>