coder / coder/terraform-provider-envbuilder

bug: imgutil.GetRemoteImage does not take ENVBUILDER_DOCKER_CONFIG_BASE64 into account

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
13
Forks
6
PR merge metrics
No merged PRs in 30d

Description

# Problem

When using `envbuilder_cached_image` with a cache repo requiring authentication and passing `ENVBUILDER_DOCKER_CONFIG_BASE64` into the provider:

```
Failed to find cached image in repository "docker.local". It will be rebuilt in the next apply. Error: failed to fetch the envbuilder binary from the builder image: check remote image: check remote image: GET http://docker.local/v2/envbuilder/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:envbuilder Type:repository]]
```

This is assuming that the underlying Coder / Coder Provisioner deployment does not have the same image pull secret mounted and does not have `DOCKER_CONFIG=path/to/config.json` set in its env.

# Workaround

Mount the same registry credential on the Coder deployment and set `DOCKER_CONFIG=path/to/config.json`

# Proposed Solution

The Terraform provider should also take the base64-encoded docker config JSON into account when attempting to fetch the Envbuilder binary from the source image.

cc @bjornrobertsson

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing imgutil.GetRemoteImage from the envbuilder_cached_image path and inspect how ENVBUILDER_DOCKER_CONFIG_BASE64 is passed when fetching the source image. Reproduce the authenticated cache-repository case, then verify that the encoded Docker config is used and the image fetch succeeds without a mounted credential or DOCKER_CONFIG setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.