8000 Make the Docker images usable in CI · Issue #37 · hashicorp/docker-hub-images · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Make the Docker images usable in CI #37

Closed
Vinnl opened this issue May 14, 2017 · 14 comments
Closed
8000

Make the Docker images usable in CI #37

Vinnl opened this issue May 14, 2017 · 14 comments

Comments

@Vinnl
Copy link
Vinnl commented May 14, 2017

I'm not too familiar with Docker, so my apologies in advance if this issue is misguided...

So as I understand it, the official Docker images define an ENTRYPOINT, which make it difficult to use TerraForm in CI, having to explicitly override it. To exacerbate this issue, GitLab CI doesn't even allow you to override it, leading to various forks being created with varying degrees of up-to-date-ness.

Now, I'm not sure if there's a way to make the current image more suitable for CI use, or whether an additional image would be a feasible solution, but... It would be really nice to be able to easily use TerraForm in CI without having to fork it yourself or having to trust someone other than Hashicorp.

@Vinnl
Copy link
Author
Vinnl commented Jul 30, 2017

For those watching this issue and using GitLab CI: apparently GitLab now lets you override the entry point using the entrypoint option. I haven't tried it yet, but that should allow you to fix this issue from GitLab CI's point of view :)

@Vinnl
Copy link
Author
Vinnl commented Aug 4, 2017

@christophgysin, @3bola and @brunoleite: have you happened to have a chance to look at whether you could override the entrypoint from GitLab CI's configuration, as should be possible from GitLab 9.4? I've spent the past day trying to implement it, but can't seem to get it to work, so I'm wondering whether it's 8000 possible and if so, how other people do it :)

(Tagging you due to your +1's on this issue.)

@rpadovani
Copy link

@Vinnl I tried various things, but I always have something like:

ERROR: Job failed (system failure): Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"/bin/sh -c\\\": stat /bin/sh -c: no such file or directory\"\n"

@rpadovani
Copy link

Actually, using an empty entry point did the trick:

  image:
    name: hashicorp/packer:light
    entrypoint: [""]

@Vinnl
Copy link
Author
Vinnl commented Oct 3, 2017

@rpadovani That unfortunately also results in the following for me:

ERROR: Job failed (system failure): Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"\\\": executable file not found in $PATH\"\n"

That said, I'm using TerraForm, not Packer:

image:
  name: hashicorp/terraform:0.10.2
  entrypoint: [ "" ]

@rpadovani
Copy link

@Vinnl try with your own runner - it doesn't work on shared runners for me

@illagrenan
Copy link
illagrenan commented Oct 4, 2017

I had similar problems with Packer base image on CircleCI. Here is my .circleci/config.yml that successfully validates my templates during build:

# CircleCI 2.0 configuration file
version: 2
jobs:
  build:
    working_directory: ~/app
    docker:
      - image: hashicorp/packer:light
        entrypoint: ''

    steps:
      - checkout

      - run:
          name: Validate Packer templates
          command: |
            /bin/sh -c '/bin/packer validate ./templates/my_template.json'

@gaui
Copy link
gaui commented Nov 22, 2017

Tried the entrypoint: [""] but got this error:

Running with gitlab-runner 10.1.0 (c1ecf97f)
  on Linux Docker Runner (ca1d6ff7)
Using Docker executor with image ubuntu:16.04 ...
Starting service hashicorp/terraform:0.11.0 ...
Pulling docker image hashicorp/terraform:0.11.0 ...
Using docker image hashicorp/terraform:0.11.0 ID=sha256:3e31037bdba8c194bdd718da76b535c015c0851f2fc085398d9b7b42f1837594 for hashicorp/terraform service...
ERROR: Preparation failed: Error response from daemon: No command specified

@Vinnl
Copy link
Author
Vinnl commented Jan 9, 2018

@jonatanblue Sorry for dragging you in like this, but I saw your comment in your Docker image without ENTRYPOINT in which you mention that you're able to use HashiCorp's official Docker images in GitLab CI. Could I ask you how you managed to do that? As can be seen above, there's a bunch of us who haven't managed :)

@lagartoflojo
Copy link

Using this template worked for us:

https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Terraform.gitlab-ci.yml

@jonatanblue
Copy link

No worries :) Either you change the CI config (GitLab now allows for this), or you build your own image without an entrypoint, which is what I did in the gitlab-ci-terraform project.

@Vinnl
Copy link
Author
Vinnl commented Jan 9, 2018

Thanks you both! I did not manage to change the GitLab config as required, but @lagartoflojo's configuration of setting the entrypoint to /usr/bin/env and specifying the $PATH did the trick. Awesome!

@Vinnl Vinnl closed this as completed Jan 9, 2018
@skubi
Copy link
skubi commented Nov 20, 2018

However, Bamboo still does not seem to have a possibility to overwrite the entrypoint with Docker Runner (not Docker CLI, but when you run the jobs/deployment inside the container, in as called "isolated" environment - https://confluence.atlassian.com/bamboo/docker-runner-946020207.html).

It is neither defined in the Bamboo Spec documentation nor available on the UI.
https://docs.atlassian.com/bamboo-specs/6.7.1/com/atlassian/bamboo/specs/api/builders/docker/DockerConfiguration.html

Thus, I would be happy to have this issue reopened.

@Cajga
Copy link
Cajga commented Dec 9, 2020

We are using rootless podman through a custom executor for GitLab. As the custom executors are not receiving the entrypoint we cannot overwrite it and cannot use the official terraform images.
It would be nice to have an official image which does not have the hardcoded /bin/terraform ENTRYPOINT.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
0