Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Add support for environment variables with pack build #581

Merged
merged 2 commits into from
Oct 17, 2020

Conversation

aranw
Copy link
Contributor

@aranw aranw commented Oct 17, 2020

This PR adds support for environment variables with the pack build phase

Some buildpacks allow configuration via environment variables such as https://github.com/GoogleCloudPlatform/buildpacks see https://github.com/GoogleCloudPlatform/buildpacks#common-options for available environment variables

I copied the configuration style from the docker build stage so configuration looks like the following:

    build {
        use "pack" {
            builder     = "gcr.io/buildpacks/builder"
            static_environment = {
                "GOOGLE_BUILDABLE" : "./cmd/webhook"
            }
        }
    }

I've tested it locally and can see from the output that it used my environment variable as expected

 │ [builder] Running "go build -o /layers/google.go.build/bin/main ./cmd/webhook (GOCACHE=/layers/google.go.build/gocache)"

@hashicorp-cla
Copy link

hashicorp-cla commented Oct 17, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great thank you!

@mitchellh mitchellh merged commit 6b90395 into hashicorp:main Oct 17, 2020
@aranw aranw deleted the feature/pack-env-vars branch October 17, 2020 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants