Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use http_ip when running in a container #474

Open
1 task done
AndrewSav opened this issue Oct 9, 2024 · 1 comment · May be fixed by #475
Open
1 task done

Unable to use http_ip when running in a container #474

AndrewSav opened this issue Oct 9, 2024 · 1 comment · May be fixed by #475
Assignees
Milestone

Comments

@AndrewSav
Copy link

Reposting from https://discuss.hashicorp.com/t/1-4-0-breaks-my-workflow/70407since no answer.

Overview of the Issue

There were changes in 1.4.0 that introduced http_interface and http_bind_address. I’m running packer in a container and using vsphere_iso. I use http_ip so that vSphere can talk back to packer. This IP is not available inside the container and is not the bind IP. It’s the IP of the VM the container is running on. This was working before, on 1.3.0

In 1.4.0 I’m getting:

error using IP address 192.168.6.10: 192.168.6.10 is not assigned to an interface

I do not want packer to use this address for binding, so the fact that it is not assigned to an interface is irrelevant. How do I fix my configuration to work with 1.4.0 as it used with 1.3.0?

Reproduction Steps

Run packer inside a container. Use http_ip setting and provide the IP of the host.

Packer Version

1.11.2

Plugin Version and Builders

1.4.0

Please select the builder.

  • vsphere-iso

VMware vSphere Version

7.0.3.01900

Guest Operating System

  • Debian 11

Simplified Packer Buildfile

N/A - all builds using http_ip are failing

Operating System and Environment Details

Run inside a container produced with this Dockerfile:

FROM jetbrains/teamcity-agent:2024.07.1

USER root

RUN bash -c "curl -sSLO https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" && \
    dpkg -i packages-microsoft-prod.deb && \
    apt-get update && apt-get install -y dotnet-sdk-7.0 dotnet-sdk-8.0 powershell jq

RUN bash -c "curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -" && \
    apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && \
    apt-get update && apt-get install -y packer

RUN pwsh -Command 'Set-PSRepository -Name PSGallery -InstallationPolicy Trusted'
RUN pwsh -Command 'Install-Module -Name VMware.PowerCLI -scope AllUsers'
RUN pwsh -Command 'Set-PowerCLIConfiguration -Scope AllUsers -ParticipateInCEIP $false -Confirm:$false'
RUN pwsh -Command 'Set-PowerCLIConfiguration -Scope AllUsers -InvalidCertificateAction Ignore -Confirm:$false'
RUN pwsh -Command 'Set-PowerCLIConfiguration -Scope AllUsers -DefaultVIServerMode Single -Confirm:$false'

USER buildagent

Log Fragments and crash.log Files

It is difficult to get this log from the environment, and it appears that the cause of the issue is the recent changes. Let me know if you still want me to try and get the logs.

@AndrewSav AndrewSav added the bug label Oct 9, 2024
@AndrewSav AndrewSav changed the title Breaking change in 1.4.0 for http_ip Breaking change in 1.4.0 for http_ip, when running packer in a container Oct 9, 2024
@tenthirtyam tenthirtyam self-assigned this Oct 9, 2024
@tenthirtyam tenthirtyam added this to the v1.4.1 milestone Oct 9, 2024
@tenthirtyam tenthirtyam changed the title Breaking change in 1.4.0 for http_ip, when running packer in a container using http_ip when running in a container Oct 9, 2024
@tenthirtyam
Copy link
Collaborator

tenthirtyam commented Oct 9, 2024

In #431 the following was added:

Adds support for http_interface and http_bind_interface from the SDK.

  • The options http_bind_address and http_interface are mutually exclusive, per the SDK.
  • Both http_bind_address and http_interface have higher priority than http_ip.
  • The http_bind_address is matched against the IP addresses of the host's network interfaces. If no match is found, the plugin will terminate.
  • Similarly, http_interface is compared with the host's network interfaces. If there's no corresponding network interface, the plugin will also terminate.
  • If neither http_bind_address, http_interface, and http_ip are provided, the plugin will automatically find and use the IP address of the first non-loopback interface for http_ip.
  • If http_ip is provided and the IP address does not exist on any interface, the build will exit.

For now, use v1.3.0 and I'll take a look at resolving this for v1.4.1 or a subsequent patch release whilst I have availability. Essentially, the error handling may simply need to log this as a warning instead of an error and exit.

Ryan

@tenthirtyam tenthirtyam changed the title using http_ip when running in a container Unable to use http_ip when running in a container Oct 9, 2024
tenthirtyam added a commit that referenced this issue Oct 9, 2024
Updates `ValidateHTTPAddress` to simply log a warning if the `http_ip` is not bound to an interface instead of error.

Ref: #474

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam linked a pull request Oct 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants