Compare commits
18 Commits
v0.0.1-alp
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2499eeb27b | ||
|
|
5135d9c759 | ||
|
|
f5e57ab70c | ||
|
|
2987a65183 | ||
|
|
fbc4ddec66 | ||
|
|
40a3223b23 | ||
|
|
72bd40b97c | ||
|
|
a6247a78b1 | ||
|
|
7597ca32ca | ||
|
|
0f23201468 | ||
|
|
d72c895b59 | ||
|
|
da63cd4cf4 | ||
|
|
561b185221 | ||
|
|
50b9b5ce3e | ||
|
|
bcf1c48554 | ||
|
|
2545dd3089 | ||
|
|
40f5fdf15e | ||
|
|
c6ebf2c6ca |
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@@ -8,8 +8,6 @@ updates:
|
||||
pulumi:
|
||||
patterns:
|
||||
- "github.com/pulumi/*"
|
||||
exclude-patterns:
|
||||
- "k8s.io/utils"
|
||||
labels:
|
||||
- dependencies
|
||||
- impact/no-changelog-required
|
||||
|
||||
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -75,6 +75,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -172,6 +173,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -267,6 +269,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -379,6 +382,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Clear GitHub Actions Ubuntu runner disk space
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with:
|
||||
@@ -439,6 +443,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -517,6 +522,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -562,6 +568,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: golangci-lint provider pkg
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
with:
|
||||
|
||||
6
.github/workflows/prerelease.yml
vendored
6
.github/workflows/prerelease.yml
vendored
@@ -67,6 +67,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -164,6 +165,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -258,6 +260,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -370,6 +373,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Clear GitHub Actions Ubuntu runner disk space
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with:
|
||||
@@ -430,6 +434,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -508,6 +513,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -67,6 +67,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -164,6 +165,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -258,6 +260,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -370,6 +373,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Clear GitHub Actions Ubuntu runner disk space
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with:
|
||||
@@ -430,6 +434,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -508,6 +513,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
|
||||
4
.github/workflows/run-acceptance-tests.yml
vendored
4
.github/workflows/run-acceptance-tests.yml
vendored
@@ -92,6 +92,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -192,6 +193,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -290,6 +292,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
@@ -412,6 +415,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: golangci-lint provider pkg
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
with:
|
||||
|
||||
1
.github/workflows/weekly-pulumi-update.yml
vendored
1
.github/workflows/weekly-pulumi-update.yml
vendored
@@ -60,6 +60,7 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GOVERSION }}
|
||||
cache-dependency-path: "**/*.sum"
|
||||
- name: Install pulumictl
|
||||
uses: jaxxstorm/action-install-gh-release@v1.11.0
|
||||
with:
|
||||
|
||||
@@ -18,6 +18,7 @@ builds:
|
||||
ldflags:
|
||||
- -X
|
||||
github.com/pulumi/pulumi-docker-build/provider/pkg/version.Version={{.Tag}}
|
||||
- -X github.com/pulumi/pulumi-docker-build/provider.Version={{.Tag}}
|
||||
binary: pulumi-resource-docker-build
|
||||
archives:
|
||||
- name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
|
||||
@@ -18,6 +18,7 @@ builds:
|
||||
ldflags:
|
||||
- -X
|
||||
github.com/pulumi/pulumi-docker-build/provider/pkg/version.Version={{.Tag}}
|
||||
- -X github.com/pulumi/pulumi-docker-build/provider.Version={{.Tag}}
|
||||
binary: pulumi-resource-docker-build
|
||||
archives:
|
||||
- name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
||||
|
||||
6
Makefile
6
Makefile
@@ -25,7 +25,8 @@ GOGLANGCILINT := bin/golangci-lint
|
||||
ensure:: tidy lint test_provider examples
|
||||
|
||||
.PHONY: tidy
|
||||
tidy: go.sum
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
.PHONY: provider
|
||||
provider: bin/${PROVIDER} bin/pulumi-gen-${PACK} # Required by CI
|
||||
@@ -179,7 +180,6 @@ bin/pulumi-gen-${PACK}: # Required by CI
|
||||
|
||||
go.mod: $(shell find . -name '*.go')
|
||||
go.sum: go.mod
|
||||
go mod tidy
|
||||
|
||||
sdk: $(shell mkdir -p sdk)
|
||||
sdk: sdk/python sdk/nodejs sdk/java sdk/python sdk/go sdk/dotnet
|
||||
@@ -243,6 +243,6 @@ sdk/java: $(PULUMI) bin/${PROVIDER}
|
||||
cd ${TMPDIR}/java/ && gradle --console=plain build
|
||||
mv -f ${TMPDIR}/java ${WORKING_DIR}/sdk/.
|
||||
|
||||
docs: $(shell find docs/yaml -type f) $(shell find ./provider/internal/embed -name '*.md')
|
||||
docs: $(shell find docs/yaml -type f) $(shell find ./provider/internal/embed -name '*.md') ${SCHEMA_PATH}
|
||||
go generate docs/generate.go
|
||||
@touch docs
|
||||
|
||||
117
README.md
117
README.md
@@ -1,106 +1,23 @@
|
||||
# Pulumi Native Provider Boilerplate
|
||||
[](https://slack.pulumi.com)
|
||||
[](https://www.npmjs.com/package/@pulumi/docker-build)
|
||||
[](https://pypi.org/project/pulumi-docker-build)
|
||||
[](https://badge.fury.io/nu/pulumi.dockerbuild)
|
||||
[](https://pkg.go.dev/github.com/pulumi/pulumi-docker-build/sdk/go)
|
||||
[](https://github.com/pulumi/pulumi-docker-build/blob/main/LICENSE)
|
||||
|
||||
This repository is a boilerplate showing how to create and locally test a native Pulumi provider.
|
||||
# Docker-Build Resource Provider
|
||||
|
||||
## Authoring a Pulumi Native Provider
|
||||
A [Pulumi](http://pulumi.com) provider for building modern Docker images with [buildx](https://docs.docker.com/build/architecture/) and [BuildKit](https://docs.docker.com/build/buildkit/).
|
||||
|
||||
This boilerplate creates a working Pulumi-owned provider named `xyz`.
|
||||
It implements a random number generator that you can [build and test out for yourself](#test-against-the-example) and then replace the Random code with code specific to your provider.
|
||||
Not to be confused with the earlier
|
||||
[Docker](http://github.com/pulumi/pulumi-docker) provider, which is still
|
||||
appropriate for managing resources unrelated to building images.
|
||||
|
||||
| Provider | Use cases |
|
||||
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `@pulumi/docker-build` | Anything related to building images with `docker build`. |
|
||||
| `@pulumi/docker` | Everything else -- including running containers and creating networks. |
|
||||
|
||||
### Prerequisites
|
||||
## Reference
|
||||
|
||||
Prerequisites for this repository are already satisfied by the [Pulumi Devcontainer](https://github.com/pulumi/devcontainer) if you are using Github Codespaces, or VSCode.
|
||||
|
||||
If you are not using VSCode, you will need to ensure the following tools are installed and present in your `$PATH`:
|
||||
|
||||
* [`pulumictl`](https://github.com/pulumi/pulumictl#installation)
|
||||
* [Go 1.21](https://golang.org/dl/) or 1.latest
|
||||
* [NodeJS](https://nodejs.org/en/) 14.x. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS installations.
|
||||
* [Yarn](https://yarnpkg.com/)
|
||||
* [TypeScript](https://www.typescriptlang.org/)
|
||||
* [Python](https://www.python.org/downloads/) (called as `python3`). For recent versions of MacOS, the system-installed version is fine.
|
||||
* [.NET](https://dotnet.microsoft.com/download)
|
||||
|
||||
|
||||
### Build & test the boilerplate XYZ provider
|
||||
|
||||
1. Create a new Github CodeSpaces environment using this repository.
|
||||
1. Open a terminal in the CodeSpaces environment.
|
||||
1. Run `make build install` to build and install the provider.
|
||||
1. Run `make gen_examples` to generate the example programs in `examples/` off of the source `examples/yaml` example program.
|
||||
1. Run `make up` to run the example program in `examples/yaml`.
|
||||
1. Run `make down` to tear down the example program.
|
||||
|
||||
### Creating a new provider repository
|
||||
|
||||
Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository:
|
||||
|
||||
1. Click "Use this template".
|
||||
1. Set the following options:
|
||||
* Owner: pulumi
|
||||
* Repository name: pulumi-xyz-native (replace "xyz" with the name of your provider)
|
||||
* Description: Pulumi provider for xyz
|
||||
* Repository type: Public
|
||||
1. Clone the generated repository.
|
||||
|
||||
From the templated repository:
|
||||
|
||||
1. Search-replace `xyz` with the name of your desired provider.
|
||||
|
||||
#### Build the provider and install the plugin
|
||||
|
||||
```bash
|
||||
$ make build install
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Create the SDK codegen binary and place it in a `./bin` folder (gitignored)
|
||||
2. Create the provider binary and place it in the `./bin` folder (gitignored)
|
||||
3. Generate the dotnet, Go, Node, and Python SDKs and place them in the `./sdk` folder
|
||||
4. Install the provider on your machine.
|
||||
|
||||
#### Test against the example
|
||||
|
||||
```bash
|
||||
$ cd examples/simple
|
||||
$ yarn link @pulumi/xyz
|
||||
$ yarn install
|
||||
$ pulumi stack init test
|
||||
$ pulumi up
|
||||
```
|
||||
|
||||
Now that you have completed all of the above steps, you have a working provider that generates a random string for you.
|
||||
|
||||
#### A brief repository overview
|
||||
|
||||
You now have:
|
||||
|
||||
1. A `provider/` folder containing the building and implementation logic
|
||||
1. `cmd/pulumi-resource-xyz/main.go` - holds the provider's sample implementation logic.
|
||||
2. `deployment-templates` - a set of files to help you around deployment and publication
|
||||
3. `sdk` - holds the generated code libraries created by `pulumi-gen-xyz/main.go`
|
||||
4. `examples` a folder of Pulumi programs to try locally and/or use in CI.
|
||||
5. A `Makefile` and this `README`.
|
||||
|
||||
#### Additional Details
|
||||
|
||||
This repository depends on the pulumi-go-provider library. For more details on building providers, please check
|
||||
the [Pulumi Go Provider docs](https://github.com/pulumi/pulumi-go-provider).
|
||||
|
||||
### Build Examples
|
||||
|
||||
Create an example program using the resources defined in your provider, and place it in the `examples/` folder.
|
||||
|
||||
You can now repeat the steps for [build, install, and test](#test-against-the-example).
|
||||
|
||||
## Configuring CI and releases
|
||||
|
||||
1. Follow the instructions laid out in the [deployment templates](./deployment-templates/README-DEPLOYMENT.md).
|
||||
|
||||
## References
|
||||
|
||||
Other resources/examples for implementing providers:
|
||||
* [Pulumi Command provider](https://github.com/pulumi/pulumi-command/blob/master/provider/pkg/provider/provider.go)
|
||||
* [Pulumi Go Provider repository](https://github.com/pulumi/pulumi-go-provider)
|
||||
For more information, including examples and migration guidance, please see the Docker-Build provider's detailed [API documentation](https://www.pulumi.com/registry/packages/docker-build/).
|
||||
|
||||
@@ -6,7 +6,7 @@ resources:
|
||||
ecr-repository:
|
||||
type: aws:ecr:Repository
|
||||
my-image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
tags:
|
||||
- ${ecr-repository.repositoryUrl}:latest
|
||||
@@ -36,7 +36,7 @@ runtime: yaml
|
||||
description: Multi-platform image
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
@@ -49,7 +49,7 @@ runtime: yaml
|
||||
description: Registry export
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
tags:
|
||||
- "docker.io/pulumi/pulumi:3.107.0"
|
||||
@@ -68,7 +68,7 @@ runtime: yaml
|
||||
description: Caching
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
@@ -85,7 +85,7 @@ runtime: yaml
|
||||
description: Docker Build Cloud
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
@@ -98,7 +98,7 @@ runtime: yaml
|
||||
description: Build arguments
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
@@ -110,7 +110,7 @@ runtime: yaml
|
||||
description: Build target
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
@@ -121,7 +121,7 @@ runtime: yaml
|
||||
description: Named contexts
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: app
|
||||
@@ -134,7 +134,7 @@ runtime: yaml
|
||||
description: Remote context
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile"
|
||||
@@ -145,7 +145,7 @@ runtime: yaml
|
||||
description: Inline Dockerfile
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
dockerfile:
|
||||
inline: |
|
||||
@@ -159,7 +159,7 @@ runtime: yaml
|
||||
description: Remote context
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
dockerfile:
|
||||
location: app/Dockerfile
|
||||
@@ -171,7 +171,7 @@ runtime: yaml
|
||||
description: Local export
|
||||
resources:
|
||||
image:
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
context:
|
||||
location: "app"
|
||||
|
||||
1
examples/tests/unauthenticated/.dockerignore
Normal file
1
examples/tests/unauthenticated/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
*
|
||||
18
examples/tests/unauthenticated/Pulumi.yaml
Normal file
18
examples/tests/unauthenticated/Pulumi.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
name: dockerhub-unauthenticated
|
||||
description: Pull an image from Dockerhub without credentials
|
||||
runtime: yaml
|
||||
plugins:
|
||||
providers:
|
||||
- name: docker-build
|
||||
path: ../../../bin
|
||||
resources:
|
||||
my-image:
|
||||
type: docker-build:Image
|
||||
properties:
|
||||
tags:
|
||||
- alpine-local
|
||||
load: true
|
||||
context:
|
||||
location: .
|
||||
dockerfile:
|
||||
inline: FROM alpine
|
||||
@@ -58,3 +58,14 @@ func TestDockerHub(t *testing.T) {
|
||||
|
||||
integration.ProgramTest(t, &test)
|
||||
}
|
||||
|
||||
func TestDockerHubUnauthenticated(t *testing.T) {
|
||||
cwd, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
test := integration.ProgramTestOptions{
|
||||
Dir: path.Join(cwd, "tests/unauthenticated"),
|
||||
}
|
||||
|
||||
integration.ProgramTest(t, &test)
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -14,7 +14,7 @@ require (
|
||||
github.com/moby/patternmatcher v0.6.0
|
||||
github.com/muesli/reflow v0.3.0
|
||||
github.com/otiai10/copy v1.14.0
|
||||
github.com/pulumi/pulumi-go-provider v0.15.0
|
||||
github.com/pulumi/pulumi-go-provider v0.16.0
|
||||
github.com/pulumi/pulumi-go-provider/integration v0.10.1-0.20240314105842-9fbffb634faf
|
||||
github.com/pulumi/pulumi-java/pkg v0.10.0
|
||||
github.com/pulumi/pulumi/pkg/v3 v3.113.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -2306,8 +2306,8 @@ github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 h1:vkHw5I/plNdTr435
|
||||
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231/go.mod h1:murToZ2N9hNJzewjHBgfFdXhZKjY3z5cYC1VXk+lbFE=
|
||||
github.com/pulumi/esc v0.6.2 h1:+z+l8cuwIauLSwXQS0uoI3rqB+YG4SzsZYtHfNoXBvw=
|
||||
github.com/pulumi/esc v0.6.2/go.mod h1:jNnYNjzsOgVTjCp0LL24NsCk8ZJxq4IoLQdCT0X7l8k=
|
||||
github.com/pulumi/pulumi-go-provider v0.15.0 h1:KEFQhAVHMCbu9NPNe584mtlgZXaqnuDpcWarUcGbQ5w=
|
||||
github.com/pulumi/pulumi-go-provider v0.15.0/go.mod h1:q3gz5HmArwNALbFihAt1vpg/1xpZlAKjB6A6uMsTgfw=
|
||||
github.com/pulumi/pulumi-go-provider v0.16.0 h1:vLAiECprIoLdTPd0UFs9Vv/HgSw7l/SBAurRBm3vpSU=
|
||||
github.com/pulumi/pulumi-go-provider v0.16.0/go.mod h1:2yjjeyMSmsb/o/BRJeWk+kcXrJWF5U2EulJKnN7qVLs=
|
||||
github.com/pulumi/pulumi-go-provider/integration v0.10.1-0.20240314105842-9fbffb634faf h1:7fDWArOUFH+qQ9EywoC4K2ElXP76Ks/CtVJkEBmv2pk=
|
||||
github.com/pulumi/pulumi-go-provider/integration v0.10.1-0.20240314105842-9fbffb634faf/go.mod h1:sf87soow+4JkV361vHI0W04hpJmWiWajzJytFMNonCE=
|
||||
github.com/pulumi/pulumi-java/pkg v0.10.0 h1:D1i5MiiNrxYr2uJ1szcj1aQwF9DYv7TTsPmajB9dKSw=
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -81,6 +81,9 @@ func wrap(host *host, registries ...Registry) (*cli, error) {
|
||||
|
||||
auths := map[string]cfgtypes.AuthConfig{}
|
||||
for k, v := range host.auths {
|
||||
if k != config.DockerRegistryAuth {
|
||||
k = credentials.ConvertToHostname(k)
|
||||
}
|
||||
auths[k] = cfgtypes.AuthConfig{
|
||||
ServerAddress: v.ServerAddress,
|
||||
Username: v.Username,
|
||||
@@ -95,10 +98,6 @@ func wrap(host *host, registries ...Registry) (*cli, error) {
|
||||
if key == "" {
|
||||
key = h.Hostname
|
||||
}
|
||||
// Add a scheme if it's missing.
|
||||
if !strings.Contains(key, "://") {
|
||||
key = "https://" + key
|
||||
}
|
||||
|
||||
auths[key] = cfgtypes.AuthConfig{
|
||||
ServerAddress: h.Hostname,
|
||||
@@ -179,8 +178,12 @@ func (c *cli) tail(ctx provider.Context) {
|
||||
|
||||
if c.dumplogs {
|
||||
// Persist the full Docker output on error for easier debugging.
|
||||
ctx.Log(diag.Info, b.String())
|
||||
ctx.Log(diag.Error, c.err.String())
|
||||
if b.Len() > 0 {
|
||||
ctx.Log(diag.Info, b.String())
|
||||
}
|
||||
if c.err.Len() > 0 {
|
||||
ctx.Log(diag.Error, c.err.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ func TestExec(t *testing.T) {
|
||||
func TestWrappedAuth(t *testing.T) {
|
||||
t.Parallel()
|
||||
ecr := "https://1234.dkr.ecr.us-west-2.amazonaws.com"
|
||||
|
||||
realhost, err := newHost(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
h := &host{
|
||||
auths: map[string]types.AuthConfig{
|
||||
ecr: {
|
||||
@@ -50,7 +54,7 @@ func TestWrappedAuth(t *testing.T) {
|
||||
Password: "host-aws-password",
|
||||
ServerAddress: ecr,
|
||||
},
|
||||
"misc": {
|
||||
"https://misc": { // Legacy config includes http/https scheme.
|
||||
Username: "host-misc-user",
|
||||
Password: "host-misc-password",
|
||||
ServerAddress: "misc",
|
||||
@@ -71,25 +75,34 @@ func TestWrappedAuth(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
_, err = wrap(h, registries...)
|
||||
require.NoError(t, err)
|
||||
|
||||
cli, err := wrap(h, registries...)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Contains(t, cli.auths, ecr)
|
||||
aws := cli.auths[ecr]
|
||||
assert.Equal(t, "resource-aws-user", aws.Username)
|
||||
assert.Equal(t, "resource-aws-password", aws.Password)
|
||||
assert.Equal(t, "1234.dkr.ecr.us-west-2.amazonaws.com", aws.ServerAddress)
|
||||
expected := map[string]types.AuthConfig{
|
||||
"1234.dkr.ecr.us-west-2.amazonaws.com": {
|
||||
Username: "resource-aws-user",
|
||||
Password: "resource-aws-password",
|
||||
ServerAddress: "1234.dkr.ecr.us-west-2.amazonaws.com",
|
||||
},
|
||||
config.DockerRegistryAuth: {
|
||||
Username: "resource-dockerhub-user",
|
||||
Password: "resource-dockerhub-password",
|
||||
ServerAddress: config.DockerRegistryDNS,
|
||||
},
|
||||
"misc": {
|
||||
Username: "host-misc-user",
|
||||
Password: "host-misc-password",
|
||||
ServerAddress: "misc",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, cli.auths)
|
||||
assert.Len(t, h.auths, 2) // In-memory host auth is unchanged.
|
||||
|
||||
require.Contains(t, cli.auths, config.DockerRegistryAuth)
|
||||
dockerhub := cli.auths[config.DockerRegistryAuth]
|
||||
assert.Equal(t, "resource-dockerhub-user", dockerhub.Username)
|
||||
assert.Equal(t, "resource-dockerhub-password", dockerhub.Password)
|
||||
assert.Equal(t, config.DockerRegistryDNS, dockerhub.ServerAddress)
|
||||
|
||||
// Auths derived from the host should be untouched, e.g. no scheme added, etc.
|
||||
require.Contains(t, cli.auths, "misc")
|
||||
misc := cli.auths["misc"]
|
||||
assert.Equal(t, "host-misc-user", misc.Username)
|
||||
assert.Equal(t, "host-misc-password", misc.Password)
|
||||
assert.Equal(t, "misc", misc.ServerAddress)
|
||||
// Assert that our on-disk host's auth is untouched.
|
||||
realhostRefreshed, err := newHost(nil)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, realhost.auths, realhostRefreshed.auths)
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ func TestInspect(t *testing.T) {
|
||||
t.Parallel()
|
||||
cli := testcli(t, false)
|
||||
descriptors, err := cli.Inspect(context.Background(), "pulumibot/myapp:buildx")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(
|
||||
t,
|
||||
"application/vnd.docker.distribution.manifest.v2+json",
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as aws from "@pulumi/aws";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const ecrRepository = new aws.ecr.Repository("ecr-repository", {});
|
||||
const authToken = aws.ecr.getAuthorizationTokenOutput({
|
||||
registryId: ecrRepository.registryId,
|
||||
});
|
||||
const myImage = new dockerbuild.Image("my-image", {
|
||||
const myImage = new docker_build.Image("my-image", {
|
||||
cacheFrom: [{
|
||||
registry: {
|
||||
ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
|
||||
@@ -41,28 +41,28 @@ export const ref = myImage.ref;
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_aws as aws
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = dockerbuild.Image("my-image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
registry=dockerbuild.CacheFromRegistryArgs(
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
registry=dockerbuild.CacheToRegistryArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
@@ -75,7 +75,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Aws = Pulumi.Aws;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
@@ -86,13 +86,13 @@ return await Deployment.RunAsync(() =>
|
||||
RegistryId = ecrRepository.RegistryId,
|
||||
});
|
||||
|
||||
var myImage = new Dockerbuild.Image("my-image", new()
|
||||
var myImage = new DockerBuild.Image("my-image", new()
|
||||
{
|
||||
CacheFrom = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.CacheFromArgs
|
||||
new DockerBuild.Inputs.CacheFromArgs
|
||||
{
|
||||
Registry = new Dockerbuild.Inputs.CacheFromRegistryArgs
|
||||
Registry = new DockerBuild.Inputs.CacheFromRegistryArgs
|
||||
{
|
||||
Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:cache"),
|
||||
},
|
||||
@@ -100,9 +100,9 @@ return await Deployment.RunAsync(() =>
|
||||
},
|
||||
CacheTo = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.CacheToArgs
|
||||
new DockerBuild.Inputs.CacheToArgs
|
||||
{
|
||||
Registry = new Dockerbuild.Inputs.CacheToRegistryArgs
|
||||
Registry = new DockerBuild.Inputs.CacheToRegistryArgs
|
||||
{
|
||||
ImageManifest = true,
|
||||
OciMediaTypes = true,
|
||||
@@ -110,14 +110,14 @@ return await Deployment.RunAsync(() =>
|
||||
},
|
||||
},
|
||||
},
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "./app",
|
||||
},
|
||||
Push = true,
|
||||
Registries = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.RegistryArgs
|
||||
new DockerBuild.Inputs.RegistryArgs
|
||||
{
|
||||
Address = ecrRepository.RepositoryUrl,
|
||||
Password = authToken.Apply(getAuthorizationTokenResult => getAuthorizationTokenResult.Password),
|
||||
@@ -144,7 +144,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -234,7 +234,7 @@ resources:
|
||||
username: ${auth-token.userName}
|
||||
tags:
|
||||
- ${ecr-repository.repositoryUrl}:latest
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
variables:
|
||||
auth-token:
|
||||
@@ -312,49 +312,49 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "app",
|
||||
},
|
||||
platforms: [
|
||||
dockerbuild.Platform.Plan9_amd64,
|
||||
dockerbuild.Platform.Plan9_386,
|
||||
docker_build.Platform.Plan9_amd64,
|
||||
docker_build.Platform.Plan9_386,
|
||||
],
|
||||
});
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
platforms=[
|
||||
dockerbuild.Platform.PLAN9_AMD64,
|
||||
dockerbuild.Platform.PLAN9_386,
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
])
|
||||
```
|
||||
```csharp
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
Platforms = new[]
|
||||
{
|
||||
Dockerbuild.Platform.Plan9_amd64,
|
||||
Dockerbuild.Platform.Plan9_386,
|
||||
DockerBuild.Platform.Plan9_amd64,
|
||||
DockerBuild.Platform.Plan9_386,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -365,7 +365,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -375,7 +375,7 @@ func main() {
|
||||
Context: &dockerbuild.BuildContextArgs{
|
||||
Location: pulumi.String("app"),
|
||||
},
|
||||
Platforms: dockerbuild.PlatformArray{
|
||||
Platforms: docker - build.PlatformArray{
|
||||
dockerbuild.Platform_Plan9_amd64,
|
||||
dockerbuild.Platform_Plan9_386,
|
||||
},
|
||||
@@ -398,7 +398,7 @@ resources:
|
||||
platforms:
|
||||
- plan9/amd64
|
||||
- plan9/386
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -441,9 +441,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "app",
|
||||
},
|
||||
@@ -459,14 +459,14 @@ export const ref = myImage.ref;
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
@@ -478,20 +478,20 @@ pulumi.export("ref", my_image["ref"])
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
Push = true,
|
||||
Registries = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.RegistryArgs
|
||||
new DockerBuild.Inputs.RegistryArgs
|
||||
{
|
||||
Address = "docker.io",
|
||||
Password = dockerHubPassword,
|
||||
@@ -515,7 +515,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -562,7 +562,7 @@ resources:
|
||||
username: pulumibot
|
||||
tags:
|
||||
- docker.io/pulumi/pulumi:3.107.0
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -611,9 +611,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
cacheFrom: [{
|
||||
local: {
|
||||
src: "tmp/cache",
|
||||
@@ -622,7 +622,7 @@ const image = new dockerbuild.Image("image", {
|
||||
cacheTo: [{
|
||||
local: {
|
||||
dest: "tmp/cache",
|
||||
mode: dockerbuild.CacheMode.Max,
|
||||
mode: docker_build.CacheMode.Max,
|
||||
},
|
||||
}],
|
||||
context: {
|
||||
@@ -632,21 +632,21 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
local=dockerbuild.CacheFromLocalArgs(
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
local=dockerbuild.CacheToLocalArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=dockerbuild.CacheMode.MAX,
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
@@ -654,17 +654,17 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
CacheFrom = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.CacheFromArgs
|
||||
new DockerBuild.Inputs.CacheFromArgs
|
||||
{
|
||||
Local = new Dockerbuild.Inputs.CacheFromLocalArgs
|
||||
Local = new DockerBuild.Inputs.CacheFromLocalArgs
|
||||
{
|
||||
Src = "tmp/cache",
|
||||
},
|
||||
@@ -672,16 +672,16 @@ return await Deployment.RunAsync(() =>
|
||||
},
|
||||
CacheTo = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.CacheToArgs
|
||||
new DockerBuild.Inputs.CacheToArgs
|
||||
{
|
||||
Local = new Dockerbuild.Inputs.CacheToLocalArgs
|
||||
Local = new DockerBuild.Inputs.CacheToLocalArgs
|
||||
{
|
||||
Dest = "tmp/cache",
|
||||
Mode = Dockerbuild.CacheMode.Max,
|
||||
Mode = DockerBuild.CacheMode.Max,
|
||||
},
|
||||
},
|
||||
},
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
@@ -694,7 +694,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -742,7 +742,7 @@ resources:
|
||||
mode: max
|
||||
context:
|
||||
location: app
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -797,9 +797,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
builder: {
|
||||
name: "cloud-builder-name",
|
||||
},
|
||||
@@ -811,13 +811,13 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
builder=dockerbuild.BuilderConfigArgs(
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exec_=True)
|
||||
@@ -826,17 +826,17 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Builder = new Dockerbuild.Inputs.BuilderConfigArgs
|
||||
Builder = new DockerBuild.Inputs.BuilderConfigArgs
|
||||
{
|
||||
Name = "cloud-builder-name",
|
||||
},
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
@@ -850,7 +850,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -883,7 +883,7 @@ resources:
|
||||
context:
|
||||
location: app
|
||||
exec: true
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -928,9 +928,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
buildArgs: {
|
||||
SET_ME_TO_TRUE: "true",
|
||||
},
|
||||
@@ -941,13 +941,13 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
image = docker_build.Image("image",
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
@@ -955,17 +955,17 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
BuildArgs =
|
||||
{
|
||||
{ "SET_ME_TO_TRUE", "true" },
|
||||
},
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
@@ -978,7 +978,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1009,7 +1009,7 @@ resources:
|
||||
SET_ME_TO_TRUE: "true"
|
||||
context:
|
||||
location: app
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1050,9 +1050,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "app",
|
||||
},
|
||||
@@ -1061,10 +1061,10 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
target="build-me")
|
||||
@@ -1073,13 +1073,13 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
@@ -1093,7 +1093,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1121,7 +1121,7 @@ resources:
|
||||
context:
|
||||
location: app
|
||||
target: build-me
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1162,9 +1162,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {context: {
|
||||
const image = new docker_build.Image("image", {context: {
|
||||
location: "app",
|
||||
named: {
|
||||
"golang:latest": {
|
||||
@@ -1175,12 +1175,12 @@ const image = new dockerbuild.Image("image", {context: {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": dockerbuild.ContextArgs(
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
},
|
||||
@@ -1190,18 +1190,18 @@ image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
Named =
|
||||
{
|
||||
{ "golang:latest", new Dockerbuild.Inputs.ContextArgs
|
||||
{ "golang:latest", new DockerBuild.Inputs.ContextArgs
|
||||
{
|
||||
Location = "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
} },
|
||||
@@ -1216,7 +1216,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1250,7 +1250,7 @@ resources:
|
||||
named:
|
||||
golang:latest:
|
||||
location: docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1291,17 +1291,17 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {context: {
|
||||
const image = new docker_build.Image("image", {context: {
|
||||
location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
}});
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
))
|
||||
```
|
||||
@@ -1309,13 +1309,13 @@ image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
},
|
||||
@@ -1328,7 +1328,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1354,7 +1354,7 @@ resources:
|
||||
properties:
|
||||
context:
|
||||
location: https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1394,9 +1394,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "app",
|
||||
},
|
||||
@@ -1409,13 +1409,13 @@ COPY hello.c ./
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline="""FROM busybox
|
||||
COPY hello.c ./
|
||||
""",
|
||||
@@ -1425,17 +1425,17 @@ COPY hello.c ./
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
Dockerfile = new Dockerbuild.Inputs.DockerfileArgs
|
||||
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
|
||||
{
|
||||
Inline = @"FROM busybox
|
||||
COPY hello.c ./
|
||||
@@ -1450,7 +1450,7 @@ COPY hello.c ./
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1483,7 +1483,7 @@ resources:
|
||||
inline: |
|
||||
FROM busybox
|
||||
COPY hello.c ./
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1530,9 +1530,9 @@ COPY hello.c ./
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "https://github.com/docker-library/hello-world.git",
|
||||
},
|
||||
@@ -1543,13 +1543,13 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
))
|
||||
```
|
||||
@@ -1557,17 +1557,17 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "https://github.com/docker-library/hello-world.git",
|
||||
},
|
||||
Dockerfile = new Dockerbuild.Inputs.DockerfileArgs
|
||||
Dockerfile = new DockerBuild.Inputs.DockerfileArgs
|
||||
{
|
||||
Location = "app/Dockerfile",
|
||||
},
|
||||
@@ -1580,7 +1580,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1611,7 +1611,7 @@ resources:
|
||||
location: https://github.com/docker-library/hello-world.git
|
||||
dockerfile:
|
||||
location: app/Dockerfile
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
@@ -1655,9 +1655,9 @@ public class App {
|
||||
|
||||
```typescript
|
||||
import * as pulumi from "@pulumi/pulumi";
|
||||
import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
import * as docker_build from "@pulumi/docker-build";
|
||||
|
||||
const image = new dockerbuild.Image("image", {
|
||||
const image = new docker_build.Image("image", {
|
||||
context: {
|
||||
location: "app",
|
||||
},
|
||||
@@ -1670,14 +1670,14 @@ const image = new dockerbuild.Image("image", {
|
||||
```
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[dockerbuild.ExportArgs(
|
||||
docker=dockerbuild.ExportDockerArgs(
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)])
|
||||
@@ -1686,21 +1686,21 @@ image = dockerbuild.Image("image",
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Pulumi;
|
||||
using Dockerbuild = Pulumi.Dockerbuild;
|
||||
using DockerBuild = Pulumi.DockerBuild;
|
||||
|
||||
return await Deployment.RunAsync(() =>
|
||||
{
|
||||
var image = new Dockerbuild.Image("image", new()
|
||||
var image = new DockerBuild.Image("image", new()
|
||||
{
|
||||
Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
{
|
||||
Location = "app",
|
||||
},
|
||||
Exports = new[]
|
||||
{
|
||||
new Dockerbuild.Inputs.ExportArgs
|
||||
new DockerBuild.Inputs.ExportArgs
|
||||
{
|
||||
Docker = new Dockerbuild.Inputs.ExportDockerArgs
|
||||
Docker = new DockerBuild.Inputs.ExportDockerArgs
|
||||
{
|
||||
Tar = true,
|
||||
},
|
||||
@@ -1715,7 +1715,7 @@ return await Deployment.RunAsync(() =>
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
@@ -1751,7 +1751,7 @@ resources:
|
||||
exports:
|
||||
- docker:
|
||||
tar: true
|
||||
type: dockerbuild:Image
|
||||
type: docker-build:Image
|
||||
runtime: yaml
|
||||
```
|
||||
```java
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Migrating v3 and v4 Image resources
|
||||
## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
|
||||
The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
|
||||
### Behavioral differences
|
||||
@@ -14,19 +14,17 @@ This is helpful as a safeguard to prevent "broken" images from merging, but user
|
||||
|
||||
Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
|
||||
The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
Previews run in non-CI environments will not build images.
|
||||
This behavior is still configurable with `buildOnPreview`.
|
||||
The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
This behavior can be changed by specifying `buildOnPreview`.
|
||||
|
||||
#### Push behavior
|
||||
|
||||
Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
They expose a `skipPush: true` option to disable pushing.
|
||||
|
||||
The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
|
||||
To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -146,7 +144,7 @@ const v3Migrated = new dockerbuild.Image("v3-to-buildx", {
|
||||
context: {
|
||||
location: "../app",
|
||||
},
|
||||
targets: ["mytarget"],
|
||||
target: "mytarget",
|
||||
buildArgs: {
|
||||
MY_BUILD_ARG: "foo",
|
||||
},
|
||||
@@ -205,7 +203,7 @@ const v4Migrated = new dockerbuild.Image("v4-to-buildx", {
|
||||
context: {
|
||||
location: "../app",
|
||||
},
|
||||
targets: ["mytarget"],
|
||||
target: "mytarget",
|
||||
buildArgs: {
|
||||
MY_BUILD_ARG: "foo",
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ import (
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/ciutil"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -72,16 +72,10 @@ func (i *Image) Annotate(a infer.Annotator) {
|
||||
|
||||
## Stability
|
||||
|
||||
**This resource is experimental and subject to change.**
|
||||
**This resource is pre-1.0 and in public preview.**
|
||||
|
||||
API types are unstable. Subsequent releases _may_ require manual edits
|
||||
to your state file(s) in order to adopt API changes.
|
||||
|
||||
"retainOnDelete: true" is recommended with this resource until it is
|
||||
stable. This enables future API changes to be adopted more easily by renaming
|
||||
resources.
|
||||
|
||||
Only use this resource if you understand and accept the risks.
|
||||
We will strive to keep APIs and behavior as stable as possible, but we
|
||||
cannot guarantee stability until version 1.0.
|
||||
`)+
|
||||
"\n\n"+_migration+
|
||||
"\n\n"+_imageExamples,
|
||||
@@ -133,21 +127,19 @@ func (ia *ImageArgs) Annotate(a infer.Annotator) {
|
||||
Equivalent to Docker's "--build-arg" flag.
|
||||
`))
|
||||
a.Describe(&ia.BuildOnPreview, dedent(`
|
||||
By default, preview behavior depends on the execution environment. If
|
||||
Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
not build images.
|
||||
|
||||
Setting this to "false" forces previews to never perform builds, and
|
||||
setting it to "true" will always build the image during previews.
|
||||
Setting this to "false" will always skip image builds during previews,
|
||||
and setting it to "true" will always build images during previews.
|
||||
|
||||
Images built during previews are never exported to registries, however
|
||||
cache manifests are still exported.
|
||||
|
||||
On-disk Dockerfiles are always validated for syntactic correctness
|
||||
regardless of this setting.
|
||||
|
||||
Defaults to "true" as a safeguard against broken images merging as part
|
||||
of CI pipelines.
|
||||
`))
|
||||
a.SetDefault(&ia.BuildOnPreview, pulumi.Bool(true))
|
||||
a.Describe(&ia.Builder, dedent(`
|
||||
Builder configuration.
|
||||
`))
|
||||
@@ -463,13 +455,12 @@ func (ia *ImageArgs) isExported() bool {
|
||||
}
|
||||
|
||||
// shouldBuildOnPreview returns true if we should build this image during
|
||||
// previews. In CI environments we default to building during previews, but we
|
||||
// always respect buildOnPreview if it was specified.
|
||||
// previews.
|
||||
func (ia *ImageArgs) shouldBuildOnPreview() bool {
|
||||
if ia.BuildOnPreview != nil {
|
||||
return *ia.BuildOnPreview
|
||||
}
|
||||
return ciutil.IsCI()
|
||||
return true
|
||||
}
|
||||
|
||||
type build struct {
|
||||
@@ -898,7 +889,7 @@ func (*Image) Diff(
|
||||
if !reflect.DeepEqual(olds.BuildArgs, news.BuildArgs) {
|
||||
diff["buildArgs"] = update
|
||||
}
|
||||
if olds.BuildOnPreview != news.BuildOnPreview {
|
||||
if !reflect.DeepEqual(olds.BuildOnPreview, news.BuildOnPreview) {
|
||||
diff["buildOnPreview"] = update
|
||||
}
|
||||
if !reflect.DeepEqual(olds.Builder, news.Builder) {
|
||||
|
||||
@@ -518,7 +518,7 @@ func TestImageDiff(t *testing.T) {
|
||||
wantChanges: true,
|
||||
},
|
||||
{
|
||||
name: "diff if buildOnPreview changes",
|
||||
name: "diff if buildOnPreview doesn't change",
|
||||
olds: func(*testing.T, ImageState) ImageState { return baseState },
|
||||
news: func(t *testing.T, ia ImageArgs) ImageArgs {
|
||||
val := true
|
||||
@@ -527,6 +527,16 @@ func TestImageDiff(t *testing.T) {
|
||||
},
|
||||
wantChanges: true,
|
||||
},
|
||||
{
|
||||
name: "diff if buildOnPreview changes",
|
||||
olds: func(*testing.T, ImageState) ImageState { return baseState },
|
||||
news: func(t *testing.T, ia ImageArgs) ImageArgs {
|
||||
val := false
|
||||
ia.BuildOnPreview = &val
|
||||
return ia
|
||||
},
|
||||
wantChanges: true,
|
||||
},
|
||||
{
|
||||
name: "diff if ssh changes",
|
||||
olds: func(*testing.T, ImageState) ImageState { return baseState },
|
||||
|
||||
@@ -64,13 +64,25 @@ type IndexState struct {
|
||||
// Annotate sets docstrings and defaults on Index.
|
||||
func (i *Index) Annotate(a infer.Annotator) {
|
||||
a.Describe(&i, dedent(`
|
||||
An index (or manifest list) referencing one or more existing images.
|
||||
A wrapper around "docker buildx imagetools create" to create an index
|
||||
(or manifest list) referencing one or more existing images.
|
||||
|
||||
Useful for crafting a multi-platform image from several
|
||||
platform-specific images.
|
||||
In most cases you do not need an "Index" to build a multi-platform
|
||||
image -- specifying multiple platforms on the "Image" will handle this
|
||||
for you automatically.
|
||||
|
||||
This creates an OCI image index or a Docker manifest list depending on
|
||||
the media types of the source images.
|
||||
However, as of April 2024, building multi-platform images _with
|
||||
caching_ will only export a cache for one platform at a time (see [this
|
||||
discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
details).
|
||||
|
||||
Therefore this resource can be helpful if you are building
|
||||
multi-platform images with caching: each platform can be built and
|
||||
cached separately, and an "Index" can join them all together. An
|
||||
example of this is shown below.
|
||||
|
||||
This resource creates an OCI image index or a Docker manifest list
|
||||
depending on the media types of the source images.
|
||||
`)+
|
||||
"\n\n"+_indexExamples,
|
||||
)
|
||||
|
||||
@@ -69,14 +69,13 @@ func NewBuildxProvider() provider.Provider {
|
||||
return infer.Provider(
|
||||
infer.Options{
|
||||
Metadata: pschema.Metadata{
|
||||
DisplayName: "docker-build",
|
||||
Keywords: []string{"docker", "buildkit", "buildx"},
|
||||
Description: "A Pulumi provider for Docker buildx",
|
||||
Homepage: "https://pulumi.io",
|
||||
Publisher: "pulumi",
|
||||
License: "Apache-2.0",
|
||||
Repository: "https://github.com/pulumi/pulumi-docker-build",
|
||||
PluginDownloadURL: "github.com/pulumi/pulumi-docker-build",
|
||||
DisplayName: "docker-build",
|
||||
Keywords: []string{"docker", "buildkit", "buildx", "kind/native"},
|
||||
Description: "A Pulumi provider for building modern Docker images with buildx and BuildKit.",
|
||||
Homepage: "https://pulumi.com",
|
||||
Publisher: "pulumi",
|
||||
License: "Apache-2.0",
|
||||
Repository: "https://github.com/pulumi/pulumi-docker-build",
|
||||
LanguageMap: map[string]any{
|
||||
"go": gogen.GoPackageInfo{
|
||||
// GenerateResourceContainerTypes: true,
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
// Version is initialized by the Go linker to contain the semver of this build.
|
||||
var Version string
|
||||
var Version = "0.0.1"
|
||||
|
||||
// Name needs to match $PACK in Makefile.
|
||||
const Name string = "docker-build"
|
||||
@@ -62,7 +62,7 @@ func (p configurableProvider) Configure(
|
||||
ctx context.Context,
|
||||
request *rpc.ConfigureRequest,
|
||||
) (*rpc.ConfigureResponse, error) {
|
||||
schema := internal.Schema(ctx, "")
|
||||
schema := internal.Schema(ctx, Version)
|
||||
ce := deprecated.New(schema.Config)
|
||||
buildxReq := request
|
||||
if props, err := ce.UnmarshalProperties(request.Args); err == nil {
|
||||
|
||||
@@ -18,8 +18,10 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
|
||||
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
|
||||
@@ -48,3 +50,19 @@ func TestConfigure(t *testing.T) {
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
_, err := semver.Parse(Version)
|
||||
assert.NoError(t, err)
|
||||
|
||||
p, err := New(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := p.GetPluginInfo(context.Background(), &emptypb.Empty{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
require.NotEqual(t, "", Version)
|
||||
assert.Equal(t, Version, info.Version)
|
||||
}
|
||||
|
||||
2
sdk/dotnet/Config/README.md
generated
2
sdk/dotnet/Config/README.md
generated
@@ -1 +1 @@
|
||||
A Pulumi provider for Docker buildx
|
||||
A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
|
||||
164
sdk/dotnet/Image.cs
generated
164
sdk/dotnet/Image.cs
generated
@@ -15,20 +15,14 @@ namespace Pulumi.DockerBuild
|
||||
///
|
||||
/// ## Stability
|
||||
///
|
||||
/// **This resource is experimental and subject to change.**
|
||||
/// **This resource is pre-1.0 and in public preview.**
|
||||
///
|
||||
/// API types are unstable. Subsequent releases _may_ require manual edits
|
||||
/// to your state file(s) in order to adopt API changes.
|
||||
/// We will strive to keep APIs and behavior as stable as possible, but we
|
||||
/// cannot guarantee stability until version 1.0.
|
||||
///
|
||||
/// `retainOnDelete: true` is recommended with this resource until it is
|
||||
/// stable. This enables future API changes to be adopted more easily by renaming
|
||||
/// resources.
|
||||
/// ## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
///
|
||||
/// Only use this resource if you understand and accept the risks.
|
||||
///
|
||||
/// ## Migrating v3 and v4 Image resources
|
||||
///
|
||||
/// The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
/// This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
/// Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
///
|
||||
/// ### Behavioral differences
|
||||
@@ -42,19 +36,17 @@ namespace Pulumi.DockerBuild
|
||||
///
|
||||
/// Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
/// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
/// Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
/// Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
///
|
||||
/// The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
/// By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
/// Previews run in non-CI environments will not build images.
|
||||
/// This behavior is still configurable with `buildOnPreview`.
|
||||
/// The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
/// This behavior can be changed by specifying `buildOnPreview`.
|
||||
///
|
||||
/// #### Push behavior
|
||||
///
|
||||
/// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
/// They expose a `skipPush: true` option to disable pushing.
|
||||
///
|
||||
/// The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
/// This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
///
|
||||
/// To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
/// Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -127,7 +119,7 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Aws = Pulumi.Aws;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
@@ -138,13 +130,13 @@ namespace Pulumi.DockerBuild
|
||||
/// RegistryId = ecrRepository.RegistryId,
|
||||
/// });
|
||||
///
|
||||
/// var myImage = new Dockerbuild.Image("my-image", new()
|
||||
/// var myImage = new DockerBuild.Image("my-image", new()
|
||||
/// {
|
||||
/// CacheFrom = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.CacheFromArgs
|
||||
/// new DockerBuild.Inputs.CacheFromArgs
|
||||
/// {
|
||||
/// Registry = new Dockerbuild.Inputs.CacheFromRegistryArgs
|
||||
/// Registry = new DockerBuild.Inputs.CacheFromRegistryArgs
|
||||
/// {
|
||||
/// Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:cache"),
|
||||
/// },
|
||||
@@ -152,9 +144,9 @@ namespace Pulumi.DockerBuild
|
||||
/// },
|
||||
/// CacheTo = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.CacheToArgs
|
||||
/// new DockerBuild.Inputs.CacheToArgs
|
||||
/// {
|
||||
/// Registry = new Dockerbuild.Inputs.CacheToRegistryArgs
|
||||
/// Registry = new DockerBuild.Inputs.CacheToRegistryArgs
|
||||
/// {
|
||||
/// ImageManifest = true,
|
||||
/// OciMediaTypes = true,
|
||||
@@ -162,14 +154,14 @@ namespace Pulumi.DockerBuild
|
||||
/// },
|
||||
/// },
|
||||
/// },
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "./app",
|
||||
/// },
|
||||
/// Push = true,
|
||||
/// Registries = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.RegistryArgs
|
||||
/// new DockerBuild.Inputs.RegistryArgs
|
||||
/// {
|
||||
/// Address = ecrRepository.RepositoryUrl,
|
||||
/// Password = authToken.Apply(getAuthorizationTokenResult => getAuthorizationTokenResult.Password),
|
||||
@@ -194,20 +186,20 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
/// Platforms = new[]
|
||||
/// {
|
||||
/// Dockerbuild.Platform.Plan9_amd64,
|
||||
/// Dockerbuild.Platform.Plan9_386,
|
||||
/// DockerBuild.Platform.Plan9_amd64,
|
||||
/// DockerBuild.Platform.Plan9_386,
|
||||
/// },
|
||||
/// });
|
||||
///
|
||||
@@ -219,20 +211,20 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
/// Push = true,
|
||||
/// Registries = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.RegistryArgs
|
||||
/// new DockerBuild.Inputs.RegistryArgs
|
||||
/// {
|
||||
/// Address = "docker.io",
|
||||
/// Password = dockerHubPassword,
|
||||
@@ -257,17 +249,17 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// CacheFrom = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.CacheFromArgs
|
||||
/// new DockerBuild.Inputs.CacheFromArgs
|
||||
/// {
|
||||
/// Local = new Dockerbuild.Inputs.CacheFromLocalArgs
|
||||
/// Local = new DockerBuild.Inputs.CacheFromLocalArgs
|
||||
/// {
|
||||
/// Src = "tmp/cache",
|
||||
/// },
|
||||
@@ -275,16 +267,16 @@ namespace Pulumi.DockerBuild
|
||||
/// },
|
||||
/// CacheTo = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.CacheToArgs
|
||||
/// new DockerBuild.Inputs.CacheToArgs
|
||||
/// {
|
||||
/// Local = new Dockerbuild.Inputs.CacheToLocalArgs
|
||||
/// Local = new DockerBuild.Inputs.CacheToLocalArgs
|
||||
/// {
|
||||
/// Dest = "tmp/cache",
|
||||
/// Mode = Dockerbuild.CacheMode.Max,
|
||||
/// Mode = DockerBuild.CacheMode.Max,
|
||||
/// },
|
||||
/// },
|
||||
/// },
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
@@ -298,17 +290,17 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Builder = new Dockerbuild.Inputs.BuilderConfigArgs
|
||||
/// Builder = new DockerBuild.Inputs.BuilderConfigArgs
|
||||
/// {
|
||||
/// Name = "cloud-builder-name",
|
||||
/// },
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
@@ -323,17 +315,17 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// BuildArgs =
|
||||
/// {
|
||||
/// { "SET_ME_TO_TRUE", "true" },
|
||||
/// },
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
@@ -347,13 +339,13 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
@@ -368,18 +360,18 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// Named =
|
||||
/// {
|
||||
/// { "golang:latest", new Dockerbuild.Inputs.ContextArgs
|
||||
/// { "golang:latest", new DockerBuild.Inputs.ContextArgs
|
||||
/// {
|
||||
/// Location = "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
/// } },
|
||||
@@ -395,13 +387,13 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
/// },
|
||||
@@ -415,17 +407,17 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
/// Dockerfile = new Dockerbuild.Inputs.DockerfileArgs
|
||||
/// Dockerfile = new DockerBuild.Inputs.DockerfileArgs
|
||||
/// {
|
||||
/// Inline = @"FROM busybox
|
||||
/// COPY hello.c ./
|
||||
@@ -441,17 +433,17 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "https://github.com/docker-library/hello-world.git",
|
||||
/// },
|
||||
/// Dockerfile = new Dockerbuild.Inputs.DockerfileArgs
|
||||
/// Dockerfile = new DockerBuild.Inputs.DockerfileArgs
|
||||
/// {
|
||||
/// Location = "app/Dockerfile",
|
||||
/// },
|
||||
@@ -465,21 +457,21 @@ namespace Pulumi.DockerBuild
|
||||
/// using System.Collections.Generic;
|
||||
/// using System.Linq;
|
||||
/// using Pulumi;
|
||||
/// using Dockerbuild = Pulumi.Dockerbuild;
|
||||
/// using DockerBuild = Pulumi.DockerBuild;
|
||||
///
|
||||
/// return await Deployment.RunAsync(() =>
|
||||
/// {
|
||||
/// var image = new Dockerbuild.Image("image", new()
|
||||
/// var image = new DockerBuild.Image("image", new()
|
||||
/// {
|
||||
/// Context = new Dockerbuild.Inputs.BuildContextArgs
|
||||
/// Context = new DockerBuild.Inputs.BuildContextArgs
|
||||
/// {
|
||||
/// Location = "app",
|
||||
/// },
|
||||
/// Exports = new[]
|
||||
/// {
|
||||
/// new Dockerbuild.Inputs.ExportArgs
|
||||
/// new DockerBuild.Inputs.ExportArgs
|
||||
/// {
|
||||
/// Docker = new Dockerbuild.Inputs.ExportDockerArgs
|
||||
/// Docker = new DockerBuild.Inputs.ExportDockerArgs
|
||||
/// {
|
||||
/// Tar = true,
|
||||
/// },
|
||||
@@ -517,20 +509,17 @@ namespace Pulumi.DockerBuild
|
||||
public Output<ImmutableDictionary<string, string>?> BuildArgs { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// By default, preview behavior depends on the execution environment. If
|
||||
/// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
/// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
/// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
/// not build images.
|
||||
///
|
||||
/// Setting this to `false` forces previews to never perform builds, and
|
||||
/// setting it to `true` will always build the image during previews.
|
||||
/// Setting this to `false` will always skip image builds during previews,
|
||||
/// and setting it to `true` will always build images during previews.
|
||||
///
|
||||
/// Images built during previews are never exported to registries, however
|
||||
/// cache manifests are still exported.
|
||||
///
|
||||
/// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
/// regardless of this setting.
|
||||
///
|
||||
/// Defaults to `true` as a safeguard against broken images merging as part
|
||||
/// of CI pipelines.
|
||||
/// </summary>
|
||||
[Output("buildOnPreview")]
|
||||
public Output<bool?> BuildOnPreview { get; private set; } = null!;
|
||||
@@ -791,7 +780,6 @@ namespace Pulumi.DockerBuild
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
PluginDownloadURL = "github.com/pulumi/pulumi-docker-build",
|
||||
};
|
||||
var merged = CustomResourceOptions.Merge(defaultOptions, options);
|
||||
// Override the ID if one was specified for consistency with other language SDKs.
|
||||
@@ -849,20 +837,17 @@ namespace Pulumi.DockerBuild
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By default, preview behavior depends on the execution environment. If
|
||||
/// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
/// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
/// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
/// not build images.
|
||||
///
|
||||
/// Setting this to `false` forces previews to never perform builds, and
|
||||
/// setting it to `true` will always build the image during previews.
|
||||
/// Setting this to `false` will always skip image builds during previews,
|
||||
/// and setting it to `true` will always build images during previews.
|
||||
///
|
||||
/// Images built during previews are never exported to registries, however
|
||||
/// cache manifests are still exported.
|
||||
///
|
||||
/// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
/// regardless of this setting.
|
||||
///
|
||||
/// Defaults to `true` as a safeguard against broken images merging as part
|
||||
/// of CI pipelines.
|
||||
/// </summary>
|
||||
[Input("buildOnPreview")]
|
||||
public Input<bool>? BuildOnPreview { get; set; }
|
||||
@@ -1117,6 +1102,7 @@ namespace Pulumi.DockerBuild
|
||||
|
||||
public ImageArgs()
|
||||
{
|
||||
BuildOnPreview = true;
|
||||
Network = Pulumi.DockerBuild.NetworkMode.@Default;
|
||||
}
|
||||
public static new ImageArgs Empty => new ImageArgs();
|
||||
|
||||
23
sdk/dotnet/Index.cs
generated
23
sdk/dotnet/Index.cs
generated
@@ -10,13 +10,25 @@ using Pulumi.Serialization;
|
||||
namespace Pulumi.DockerBuild
|
||||
{
|
||||
/// <summary>
|
||||
/// An index (or manifest list) referencing one or more existing images.
|
||||
/// A wrapper around `docker buildx imagetools create` to create an index
|
||||
/// (or manifest list) referencing one or more existing images.
|
||||
///
|
||||
/// Useful for crafting a multi-platform image from several
|
||||
/// platform-specific images.
|
||||
/// In most cases you do not need an `Index` to build a multi-platform
|
||||
/// image -- specifying multiple platforms on the `Image` will handle this
|
||||
/// for you automatically.
|
||||
///
|
||||
/// This creates an OCI image index or a Docker manifest list depending on
|
||||
/// the media types of the source images.
|
||||
/// However, as of April 2024, building multi-platform images _with
|
||||
/// caching_ will only export a cache for one platform at a time (see [this
|
||||
/// discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
/// details).
|
||||
///
|
||||
/// Therefore this resource can be helpful if you are building
|
||||
/// multi-platform images with caching: each platform can be built and
|
||||
/// cached separately, and an `Index` can join them all together. An
|
||||
/// example of this is shown below.
|
||||
///
|
||||
/// This resource creates an OCI image index or a Docker manifest list
|
||||
/// depending on the media types of the source images.
|
||||
///
|
||||
/// ## Example Usage
|
||||
/// ### Multi-platform registry caching
|
||||
@@ -182,7 +194,6 @@ namespace Pulumi.DockerBuild
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
PluginDownloadURL = "github.com/pulumi/pulumi-docker-build",
|
||||
};
|
||||
var merged = CustomResourceOptions.Merge(defaultOptions, options);
|
||||
// Override the ID if one was specified for consistency with other language SDKs.
|
||||
|
||||
1
sdk/dotnet/Provider.cs
generated
1
sdk/dotnet/Provider.cs
generated
@@ -36,7 +36,6 @@ namespace Pulumi.DockerBuild
|
||||
var defaultOptions = new CustomResourceOptions
|
||||
{
|
||||
Version = Utilities.Version,
|
||||
PluginDownloadURL = "github.com/pulumi/pulumi-docker-build",
|
||||
};
|
||||
var merged = CustomResourceOptions.Merge(defaultOptions, options);
|
||||
// Override the ID if one was specified for consistency with other language SDKs.
|
||||
|
||||
4
sdk/dotnet/Pulumi.DockerBuild.csproj
generated
4
sdk/dotnet/Pulumi.DockerBuild.csproj
generated
@@ -4,9 +4,9 @@
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>pulumi</Authors>
|
||||
<Company>pulumi</Company>
|
||||
<Description>A Pulumi provider for Docker buildx</Description>
|
||||
<Description>A Pulumi provider for building modern Docker images with buildx and BuildKit.</Description>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://pulumi.io</PackageProjectUrl>
|
||||
<PackageProjectUrl>https://pulumi.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/pulumi/pulumi-docker-build</RepositoryUrl>
|
||||
<PackageIcon>logo.png</PackageIcon>
|
||||
|
||||
|
||||
2
sdk/dotnet/README.md
generated
2
sdk/dotnet/README.md
generated
@@ -1 +1 @@
|
||||
A Pulumi provider for Docker buildx
|
||||
A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
|
||||
1
sdk/dotnet/Utilities.cs
generated
1
sdk/dotnet/Utilities.cs
generated
@@ -53,7 +53,6 @@ namespace Pulumi.DockerBuild
|
||||
{
|
||||
var dst = src ?? new global::Pulumi.InvokeOptions{};
|
||||
dst.Version = src?.Version ?? Version;
|
||||
dst.PluginDownloadURL = src?.PluginDownloadURL ?? "github.com/pulumi/pulumi-docker-build";
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
3
sdk/dotnet/pulumi-plugin.json
generated
3
sdk/dotnet/pulumi-plugin.json
generated
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"resource": true,
|
||||
"name": "docker-build",
|
||||
"server": "github.com/pulumi/pulumi-docker-build"
|
||||
"name": "docker-build"
|
||||
}
|
||||
|
||||
2
sdk/go/dockerbuild/doc.go
generated
2
sdk/go/dockerbuild/doc.go
generated
@@ -1,2 +1,2 @@
|
||||
// A Pulumi provider for Docker buildx
|
||||
// A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
package dockerbuild
|
||||
|
||||
107
sdk/go/dockerbuild/image.go
generated
107
sdk/go/dockerbuild/image.go
generated
@@ -17,20 +17,14 @@ import (
|
||||
//
|
||||
// ## Stability
|
||||
//
|
||||
// **This resource is experimental and subject to change.**
|
||||
// **This resource is pre-1.0 and in public preview.**
|
||||
//
|
||||
// API types are unstable. Subsequent releases _may_ require manual edits
|
||||
// to your state file(s) in order to adopt API changes.
|
||||
// We will strive to keep APIs and behavior as stable as possible, but we
|
||||
// cannot guarantee stability until version 1.0.
|
||||
//
|
||||
// `retainOnDelete: true` is recommended with this resource until it is
|
||||
// stable. This enables future API changes to be adopted more easily by renaming
|
||||
// resources.
|
||||
// ## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
//
|
||||
// Only use this resource if you understand and accept the risks.
|
||||
//
|
||||
// ## Migrating v3 and v4 Image resources
|
||||
//
|
||||
// The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
// This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
// Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
//
|
||||
// ### Behavioral differences
|
||||
@@ -44,19 +38,17 @@ import (
|
||||
//
|
||||
// Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
// Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
// Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
//
|
||||
// The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
// By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
// Previews run in non-CI environments will not build images.
|
||||
// This behavior is still configurable with `buildOnPreview`.
|
||||
// The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
// This behavior can be changed by specifying `buildOnPreview`.
|
||||
//
|
||||
// #### Push behavior
|
||||
//
|
||||
// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
// They expose a `skipPush: true` option to disable pushing.
|
||||
//
|
||||
// The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
// This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
//
|
||||
// To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
// Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -132,7 +124,7 @@ import (
|
||||
// "fmt"
|
||||
//
|
||||
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -203,7 +195,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -214,7 +206,7 @@ import (
|
||||
// Context: &dockerbuild.BuildContextArgs{
|
||||
// Location: pulumi.String("app"),
|
||||
// },
|
||||
// Platforms: dockerbuild.PlatformArray{
|
||||
// Platforms: docker - build.PlatformArray{
|
||||
// dockerbuild.Platform_Plan9_amd64,
|
||||
// dockerbuild.Platform_Plan9_386,
|
||||
// },
|
||||
@@ -233,7 +225,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -271,7 +263,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -312,7 +304,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -342,7 +334,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -371,7 +363,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -398,7 +390,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -429,7 +421,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -455,7 +447,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -484,7 +476,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -513,7 +505,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -557,20 +549,17 @@ type Image struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs pulumi.StringMapOutput `pulumi:"buildArgs"`
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview pulumi.BoolPtrOutput `pulumi:"buildOnPreview"`
|
||||
// Builder configuration.
|
||||
Builder BuilderConfigPtrOutput `pulumi:"builder"`
|
||||
@@ -726,6 +715,9 @@ func NewImage(ctx *pulumi.Context,
|
||||
args = &ImageArgs{}
|
||||
}
|
||||
|
||||
if args.BuildOnPreview == nil {
|
||||
args.BuildOnPreview = pulumi.BoolPtr(true)
|
||||
}
|
||||
if args.Network == nil {
|
||||
args.Network = NetworkMode("default")
|
||||
}
|
||||
@@ -776,20 +768,17 @@ type imageArgs struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs map[string]string `pulumi:"buildArgs"`
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview *bool `pulumi:"buildOnPreview"`
|
||||
// Builder configuration.
|
||||
Builder *BuilderConfig `pulumi:"builder"`
|
||||
@@ -927,20 +916,17 @@ type ImageArgs struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs pulumi.StringMapInput
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview pulumi.BoolPtrInput
|
||||
// Builder configuration.
|
||||
Builder BuilderConfigPtrInput
|
||||
@@ -1131,20 +1117,17 @@ func (o ImageOutput) BuildArgs() pulumi.StringMapOutput {
|
||||
return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.BuildArgs }).(pulumi.StringMapOutput)
|
||||
}
|
||||
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
func (o ImageOutput) BuildOnPreview() pulumi.BoolPtrOutput {
|
||||
return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.BuildOnPreview }).(pulumi.BoolPtrOutput)
|
||||
}
|
||||
|
||||
22
sdk/go/dockerbuild/index.go
generated
22
sdk/go/dockerbuild/index.go
generated
@@ -13,13 +13,25 @@ import (
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
|
||||
)
|
||||
|
||||
// An index (or manifest list) referencing one or more existing images.
|
||||
// A wrapper around `docker buildx imagetools create` to create an index
|
||||
// (or manifest list) referencing one or more existing images.
|
||||
//
|
||||
// Useful for crafting a multi-platform image from several
|
||||
// platform-specific images.
|
||||
// In most cases you do not need an `Index` to build a multi-platform
|
||||
// image -- specifying multiple platforms on the `Image` will handle this
|
||||
// for you automatically.
|
||||
//
|
||||
// This creates an OCI image index or a Docker manifest list depending on
|
||||
// the media types of the source images.
|
||||
// However, as of April 2024, building multi-platform images _with
|
||||
// caching_ will only export a cache for one platform at a time (see [this
|
||||
// discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
// details).
|
||||
//
|
||||
// Therefore this resource can be helpful if you are building
|
||||
// multi-platform images with caching: each platform can be built and
|
||||
// cached separately, and an `Index` can join them all together. An
|
||||
// example of this is shown below.
|
||||
//
|
||||
// This resource creates an OCI image index or a Docker manifest list
|
||||
// depending on the media types of the source images.
|
||||
//
|
||||
// ## Example Usage
|
||||
// ### Multi-platform registry caching
|
||||
|
||||
4
sdk/go/dockerbuild/internal/pulumiUtilities.go
generated
4
sdk/go/dockerbuild/internal/pulumiUtilities.go
generated
@@ -164,7 +164,7 @@ func callPlainInner(
|
||||
// PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource.
|
||||
func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption {
|
||||
defaults := []pulumi.ResourceOption{}
|
||||
defaults = append(defaults, pulumi.PluginDownloadURL("github.com/pulumi/pulumi-docker-build"))
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
@@ -175,7 +175,7 @@ func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOptio
|
||||
// PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke.
|
||||
func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption {
|
||||
defaults := []pulumi.InvokeOption{}
|
||||
defaults = append(defaults, pulumi.PluginDownloadURL("github.com/pulumi/pulumi-docker-build"))
|
||||
|
||||
version := SdkVersion
|
||||
if !version.Equals(semver.Version{}) {
|
||||
defaults = append(defaults, pulumi.Version(version.String()))
|
||||
|
||||
3
sdk/go/dockerbuild/pulumi-plugin.json
generated
3
sdk/go/dockerbuild/pulumi-plugin.json
generated
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"resource": true,
|
||||
"name": "docker-build",
|
||||
"server": "github.com/pulumi/pulumi-docker-build"
|
||||
"name": "docker-build"
|
||||
}
|
||||
|
||||
2
sdk/go/dockerbuild/x/doc.go
generated
2
sdk/go/dockerbuild/x/doc.go
generated
@@ -1,2 +1,2 @@
|
||||
// A Pulumi provider for Docker buildx
|
||||
// A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
package dockerbuild
|
||||
|
||||
107
sdk/go/dockerbuild/x/image.go
generated
107
sdk/go/dockerbuild/x/image.go
generated
@@ -17,20 +17,14 @@ import (
|
||||
//
|
||||
// ## Stability
|
||||
//
|
||||
// **This resource is experimental and subject to change.**
|
||||
// **This resource is pre-1.0 and in public preview.**
|
||||
//
|
||||
// API types are unstable. Subsequent releases _may_ require manual edits
|
||||
// to your state file(s) in order to adopt API changes.
|
||||
// We will strive to keep APIs and behavior as stable as possible, but we
|
||||
// cannot guarantee stability until version 1.0.
|
||||
//
|
||||
// `retainOnDelete: true` is recommended with this resource until it is
|
||||
// stable. This enables future API changes to be adopted more easily by renaming
|
||||
// resources.
|
||||
// ## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
//
|
||||
// Only use this resource if you understand and accept the risks.
|
||||
//
|
||||
// ## Migrating v3 and v4 Image resources
|
||||
//
|
||||
// The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
// This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
// Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
//
|
||||
// ### Behavioral differences
|
||||
@@ -44,19 +38,17 @@ import (
|
||||
//
|
||||
// Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
// Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
// Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
//
|
||||
// The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
// By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
// Previews run in non-CI environments will not build images.
|
||||
// This behavior is still configurable with `buildOnPreview`.
|
||||
// The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
// This behavior can be changed by specifying `buildOnPreview`.
|
||||
//
|
||||
// #### Push behavior
|
||||
//
|
||||
// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
// They expose a `skipPush: true` option to disable pushing.
|
||||
//
|
||||
// The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
// This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
//
|
||||
// To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
// Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -132,7 +124,7 @@ import (
|
||||
// "fmt"
|
||||
//
|
||||
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -203,7 +195,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -214,7 +206,7 @@ import (
|
||||
// Context: &dockerbuild.BuildContextArgs{
|
||||
// Location: pulumi.String("app"),
|
||||
// },
|
||||
// Platforms: dockerbuild.PlatformArray{
|
||||
// Platforms: docker - build.PlatformArray{
|
||||
// dockerbuild.Platform_Plan9_amd64,
|
||||
// dockerbuild.Platform_Plan9_386,
|
||||
// },
|
||||
@@ -233,7 +225,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -271,7 +263,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -312,7 +304,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -342,7 +334,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -371,7 +363,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -398,7 +390,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -429,7 +421,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -455,7 +447,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -484,7 +476,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -513,7 +505,7 @@ import (
|
||||
//
|
||||
// import (
|
||||
//
|
||||
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild"
|
||||
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||
//
|
||||
// )
|
||||
@@ -557,20 +549,17 @@ type Image struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs pulumix.MapOutput[string] `pulumi:"buildArgs"`
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview pulumix.Output[*bool] `pulumi:"buildOnPreview"`
|
||||
// Builder configuration.
|
||||
Builder pulumix.GPtrOutput[BuilderConfig, BuilderConfigOutput] `pulumi:"builder"`
|
||||
@@ -726,6 +715,9 @@ func NewImage(ctx *pulumi.Context,
|
||||
args = &ImageArgs{}
|
||||
}
|
||||
|
||||
if args.BuildOnPreview == nil {
|
||||
args.BuildOnPreview = pulumix.Ptr(true)
|
||||
}
|
||||
if args.Network == nil {
|
||||
args.Network = pulumix.Ptr(NetworkMode("default"))
|
||||
}
|
||||
@@ -776,20 +768,17 @@ type imageArgs struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs map[string]string `pulumi:"buildArgs"`
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview *bool `pulumi:"buildOnPreview"`
|
||||
// Builder configuration.
|
||||
Builder *BuilderConfig `pulumi:"builder"`
|
||||
@@ -927,20 +916,17 @@ type ImageArgs struct {
|
||||
//
|
||||
// Equivalent to Docker's `--build-arg` flag.
|
||||
BuildArgs pulumix.Input[map[string]string]
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
BuildOnPreview pulumix.Input[*bool]
|
||||
// Builder configuration.
|
||||
Builder pulumix.Input[*BuilderConfigArgs]
|
||||
@@ -1110,20 +1096,17 @@ func (o ImageOutput) BuildArgs() pulumix.MapOutput[string] {
|
||||
return pulumix.MapOutput[string]{OutputState: unwrapped.OutputState}
|
||||
}
|
||||
|
||||
// By default, preview behavior depends on the execution environment. If
|
||||
// Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
// Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
// previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
// not build images.
|
||||
//
|
||||
// Setting this to `false` forces previews to never perform builds, and
|
||||
// setting it to `true` will always build the image during previews.
|
||||
// Setting this to `false` will always skip image builds during previews,
|
||||
// and setting it to `true` will always build images during previews.
|
||||
//
|
||||
// Images built during previews are never exported to registries, however
|
||||
// cache manifests are still exported.
|
||||
//
|
||||
// On-disk Dockerfiles are always validated for syntactic correctness
|
||||
// regardless of this setting.
|
||||
//
|
||||
// Defaults to `true` as a safeguard against broken images merging as part
|
||||
// of CI pipelines.
|
||||
func (o ImageOutput) BuildOnPreview() pulumix.Output[*bool] {
|
||||
value := pulumix.Apply[Image](o, func(v Image) pulumix.Output[*bool] { return v.BuildOnPreview })
|
||||
return pulumix.Flatten[*bool, pulumix.Output[*bool]](value)
|
||||
|
||||
22
sdk/go/dockerbuild/x/index.go
generated
22
sdk/go/dockerbuild/x/index.go
generated
@@ -13,13 +13,25 @@ import (
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
|
||||
)
|
||||
|
||||
// An index (or manifest list) referencing one or more existing images.
|
||||
// A wrapper around `docker buildx imagetools create` to create an index
|
||||
// (or manifest list) referencing one or more existing images.
|
||||
//
|
||||
// Useful for crafting a multi-platform image from several
|
||||
// platform-specific images.
|
||||
// In most cases you do not need an `Index` to build a multi-platform
|
||||
// image -- specifying multiple platforms on the `Image` will handle this
|
||||
// for you automatically.
|
||||
//
|
||||
// This creates an OCI image index or a Docker manifest list depending on
|
||||
// the media types of the source images.
|
||||
// However, as of April 2024, building multi-platform images _with
|
||||
// caching_ will only export a cache for one platform at a time (see [this
|
||||
// discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
// details).
|
||||
//
|
||||
// Therefore this resource can be helpful if you are building
|
||||
// multi-platform images with caching: each platform can be built and
|
||||
// cached separately, and an `Index` can join them all together. An
|
||||
// example of this is shown below.
|
||||
//
|
||||
// This resource creates an OCI image index or a Docker manifest list
|
||||
// depending on the media types of the source images.
|
||||
//
|
||||
// ## Example Usage
|
||||
// ### Multi-platform registry caching
|
||||
|
||||
2
sdk/java/README.md
generated
2
sdk/java/README.md
generated
@@ -1 +1 @@
|
||||
A Pulumi provider for Docker buildx
|
||||
A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
|
||||
@@ -31,20 +31,14 @@ import javax.annotation.Nullable;
|
||||
*
|
||||
* ## Stability
|
||||
*
|
||||
* **This resource is experimental and subject to change.**
|
||||
* **This resource is pre-1.0 and in public preview.**
|
||||
*
|
||||
* API types are unstable. Subsequent releases _may_ require manual edits
|
||||
* to your state file(s) in order to adopt API changes.
|
||||
* We will strive to keep APIs and behavior as stable as possible, but we
|
||||
* cannot guarantee stability until version 1.0.
|
||||
*
|
||||
* `retainOnDelete: true` is recommended with this resource until it is
|
||||
* stable. This enables future API changes to be adopted more easily by renaming
|
||||
* resources.
|
||||
* ## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
*
|
||||
* Only use this resource if you understand and accept the risks.
|
||||
*
|
||||
* ## Migrating v3 and v4 Image resources
|
||||
*
|
||||
* The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
* This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
* Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
*
|
||||
* ### Behavioral differences
|
||||
@@ -58,19 +52,17 @@ import javax.annotation.Nullable;
|
||||
*
|
||||
* Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
* By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
* Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
* Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
*
|
||||
* The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
* By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
* Previews run in non-CI environments will not build images.
|
||||
* This behavior is still configurable with `buildOnPreview`.
|
||||
* The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
* This behavior can be changed by specifying `buildOnPreview`.
|
||||
*
|
||||
* #### Push behavior
|
||||
*
|
||||
* Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
* They expose a `skipPush: true` option to disable pushing.
|
||||
*
|
||||
* The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
* This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
*
|
||||
* To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
* Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -661,14 +653,8 @@ public class Image extends com.pulumi.resources.CustomResource {
|
||||
return Codegen.optional(this.buildArgs);
|
||||
}
|
||||
/**
|
||||
* By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -676,19 +662,16 @@ public class Image extends com.pulumi.resources.CustomResource {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
*/
|
||||
@Export(name="buildOnPreview", refs={Boolean.class}, tree="[0]")
|
||||
private Output</* @Nullable */ Boolean> buildOnPreview;
|
||||
|
||||
/**
|
||||
* @return By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* @return Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -696,6 +679,9 @@ public class Image extends com.pulumi.resources.CustomResource {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
*/
|
||||
public Output<Optional<Boolean>> buildOnPreview() {
|
||||
return Codegen.optional(this.buildOnPreview);
|
||||
|
||||
@@ -80,14 +80,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -95,19 +89,16 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
*/
|
||||
@Import(name="buildOnPreview")
|
||||
private @Nullable Output<Boolean> buildOnPreview;
|
||||
|
||||
/**
|
||||
* @return By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* @return Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -115,6 +106,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
*/
|
||||
public Optional<Output<Boolean>> buildOnPreview() {
|
||||
return Optional.ofNullable(this.buildOnPreview);
|
||||
@@ -685,14 +679,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param buildOnPreview By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* @param buildOnPreview Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -700,6 +688,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
* @return builder
|
||||
*
|
||||
*/
|
||||
@@ -709,14 +700,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param buildOnPreview By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* @param buildOnPreview Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
@@ -724,6 +709,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*
|
||||
* @return builder
|
||||
*
|
||||
*/
|
||||
@@ -1388,6 +1376,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
public ImageArgs build() {
|
||||
$.buildOnPreview = Codegen.booleanProp("buildOnPreview").output().arg($.buildOnPreview).def(true).getNullable();
|
||||
$.network = Codegen.objectProp("network", NetworkMode.class).output().arg($.network).def(NetworkMode.Default_).getNullable();
|
||||
return $;
|
||||
}
|
||||
|
||||
@@ -17,13 +17,25 @@ import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An index (or manifest list) referencing one or more existing images.
|
||||
* A wrapper around `docker buildx imagetools create` to create an index
|
||||
* (or manifest list) referencing one or more existing images.
|
||||
*
|
||||
* Useful for crafting a multi-platform image from several
|
||||
* platform-specific images.
|
||||
* In most cases you do not need an `Index` to build a multi-platform
|
||||
* image -- specifying multiple platforms on the `Image` will handle this
|
||||
* for you automatically.
|
||||
*
|
||||
* This creates an OCI image index or a Docker manifest list depending on
|
||||
* the media types of the source images.
|
||||
* However, as of April 2024, building multi-platform images _with
|
||||
* caching_ will only export a cache for one platform at a time (see [this
|
||||
* discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
* details).
|
||||
*
|
||||
* Therefore this resource can be helpful if you are building
|
||||
* multi-platform images with caching: each platform can be built and
|
||||
* cached separately, and an `Index` can join them all together. An
|
||||
* example of this is shown below.
|
||||
*
|
||||
* This resource creates an OCI image index or a Docker manifest list
|
||||
* depending on the media types of the source images.
|
||||
*
|
||||
* ## Example Usage
|
||||
* ### Multi-platform registry caching
|
||||
|
||||
117
sdk/nodejs/README.md
generated
117
sdk/nodejs/README.md
generated
@@ -1,106 +1,23 @@
|
||||
# Pulumi Native Provider Boilerplate
|
||||
[](https://slack.pulumi.com)
|
||||
[](https://www.npmjs.com/package/@pulumi/docker-build)
|
||||
[](https://pypi.org/project/pulumi-docker-build)
|
||||
[](https://badge.fury.io/nu/pulumi.dockerbuild)
|
||||
[](https://pkg.go.dev/github.com/pulumi/pulumi-docker-build/sdk/go)
|
||||
[](https://github.com/pulumi/pulumi-docker-build/blob/main/LICENSE)
|
||||
|
||||
This repository is a boilerplate showing how to create and locally test a native Pulumi provider.
|
||||
# Docker-Build Resource Provider
|
||||
|
||||
## Authoring a Pulumi Native Provider
|
||||
A [Pulumi](http://pulumi.com) provider for building modern Docker images with [buildx](https://docs.docker.com/build/architecture/) and [BuildKit](https://docs.docker.com/build/buildkit/).
|
||||
|
||||
This boilerplate creates a working Pulumi-owned provider named `xyz`.
|
||||
It implements a random number generator that you can [build and test out for yourself](#test-against-the-example) and then replace the Random code with code specific to your provider.
|
||||
Not to be confused with the earlier
|
||||
[Docker](http://github.com/pulumi/pulumi-docker) provider, which is still
|
||||
appropriate for managing resources unrelated to building images.
|
||||
|
||||
| Provider | Use cases |
|
||||
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `@pulumi/docker-build` | Anything related to building images with `docker build`. |
|
||||
| `@pulumi/docker` | Everything else -- including running containers and creating networks. |
|
||||
|
||||
### Prerequisites
|
||||
## Reference
|
||||
|
||||
Prerequisites for this repository are already satisfied by the [Pulumi Devcontainer](https://github.com/pulumi/devcontainer) if you are using Github Codespaces, or VSCode.
|
||||
|
||||
If you are not using VSCode, you will need to ensure the following tools are installed and present in your `$PATH`:
|
||||
|
||||
* [`pulumictl`](https://github.com/pulumi/pulumictl#installation)
|
||||
* [Go 1.21](https://golang.org/dl/) or 1.latest
|
||||
* [NodeJS](https://nodejs.org/en/) 14.x. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS installations.
|
||||
* [Yarn](https://yarnpkg.com/)
|
||||
* [TypeScript](https://www.typescriptlang.org/)
|
||||
* [Python](https://www.python.org/downloads/) (called as `python3`). For recent versions of MacOS, the system-installed version is fine.
|
||||
* [.NET](https://dotnet.microsoft.com/download)
|
||||
|
||||
|
||||
### Build & test the boilerplate XYZ provider
|
||||
|
||||
1. Create a new Github CodeSpaces environment using this repository.
|
||||
1. Open a terminal in the CodeSpaces environment.
|
||||
1. Run `make build install` to build and install the provider.
|
||||
1. Run `make gen_examples` to generate the example programs in `examples/` off of the source `examples/yaml` example program.
|
||||
1. Run `make up` to run the example program in `examples/yaml`.
|
||||
1. Run `make down` to tear down the example program.
|
||||
|
||||
### Creating a new provider repository
|
||||
|
||||
Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository:
|
||||
|
||||
1. Click "Use this template".
|
||||
1. Set the following options:
|
||||
* Owner: pulumi
|
||||
* Repository name: pulumi-xyz-native (replace "xyz" with the name of your provider)
|
||||
* Description: Pulumi provider for xyz
|
||||
* Repository type: Public
|
||||
1. Clone the generated repository.
|
||||
|
||||
From the templated repository:
|
||||
|
||||
1. Search-replace `xyz` with the name of your desired provider.
|
||||
|
||||
#### Build the provider and install the plugin
|
||||
|
||||
```bash
|
||||
$ make build install
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Create the SDK codegen binary and place it in a `./bin` folder (gitignored)
|
||||
2. Create the provider binary and place it in the `./bin` folder (gitignored)
|
||||
3. Generate the dotnet, Go, Node, and Python SDKs and place them in the `./sdk` folder
|
||||
4. Install the provider on your machine.
|
||||
|
||||
#### Test against the example
|
||||
|
||||
```bash
|
||||
$ cd examples/simple
|
||||
$ yarn link @pulumi/xyz
|
||||
$ yarn install
|
||||
$ pulumi stack init test
|
||||
$ pulumi up
|
||||
```
|
||||
|
||||
Now that you have completed all of the above steps, you have a working provider that generates a random string for you.
|
||||
|
||||
#### A brief repository overview
|
||||
|
||||
You now have:
|
||||
|
||||
1. A `provider/` folder containing the building and implementation logic
|
||||
1. `cmd/pulumi-resource-xyz/main.go` - holds the provider's sample implementation logic.
|
||||
2. `deployment-templates` - a set of files to help you around deployment and publication
|
||||
3. `sdk` - holds the generated code libraries created by `pulumi-gen-xyz/main.go`
|
||||
4. `examples` a folder of Pulumi programs to try locally and/or use in CI.
|
||||
5. A `Makefile` and this `README`.
|
||||
|
||||
#### Additional Details
|
||||
|
||||
This repository depends on the pulumi-go-provider library. For more details on building providers, please check
|
||||
the [Pulumi Go Provider docs](https://github.com/pulumi/pulumi-go-provider).
|
||||
|
||||
### Build Examples
|
||||
|
||||
Create an example program using the resources defined in your provider, and place it in the `examples/` folder.
|
||||
|
||||
You can now repeat the steps for [build, install, and test](#test-against-the-example).
|
||||
|
||||
## Configuring CI and releases
|
||||
|
||||
1. Follow the instructions laid out in the [deployment templates](./deployment-templates/README-DEPLOYMENT.md).
|
||||
|
||||
## References
|
||||
|
||||
Other resources/examples for implementing providers:
|
||||
* [Pulumi Command provider](https://github.com/pulumi/pulumi-command/blob/master/provider/pkg/provider/provider.go)
|
||||
* [Pulumi Go Provider repository](https://github.com/pulumi/pulumi-go-provider)
|
||||
For more information, including examples and migration guidance, please see the Docker-Build provider's detailed [API documentation](https://www.pulumi.com/registry/packages/docker-build/).
|
||||
|
||||
112
sdk/nodejs/image.ts
generated
112
sdk/nodejs/image.ts
generated
@@ -13,20 +13,14 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ## Stability
|
||||
*
|
||||
* **This resource is experimental and subject to change.**
|
||||
* **This resource is pre-1.0 and in public preview.**
|
||||
*
|
||||
* API types are unstable. Subsequent releases _may_ require manual edits
|
||||
* to your state file(s) in order to adopt API changes.
|
||||
* We will strive to keep APIs and behavior as stable as possible, but we
|
||||
* cannot guarantee stability until version 1.0.
|
||||
*
|
||||
* `retainOnDelete: true` is recommended with this resource until it is
|
||||
* stable. This enables future API changes to be adopted more easily by renaming
|
||||
* resources.
|
||||
* ## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
*
|
||||
* Only use this resource if you understand and accept the risks.
|
||||
*
|
||||
* ## Migrating v3 and v4 Image resources
|
||||
*
|
||||
* The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
* This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
* Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
*
|
||||
* ### Behavioral differences
|
||||
@@ -40,19 +34,17 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
* By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
* Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
* Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
*
|
||||
* The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
* By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
* Previews run in non-CI environments will not build images.
|
||||
* This behavior is still configurable with `buildOnPreview`.
|
||||
* The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
* This behavior can be changed by specifying `buildOnPreview`.
|
||||
*
|
||||
* #### Push behavior
|
||||
*
|
||||
* Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
* They expose a `skipPush: true` option to disable pushing.
|
||||
*
|
||||
* The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
* This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
*
|
||||
* To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
* Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -170,7 +162,7 @@ import * as utilities from "./utilities";
|
||||
* context: {
|
||||
* location: "../app",
|
||||
* },
|
||||
* targets: ["mytarget"],
|
||||
* target: "mytarget",
|
||||
* buildArgs: {
|
||||
* MY_BUILD_ARG: "foo",
|
||||
* },
|
||||
@@ -229,7 +221,7 @@ import * as utilities from "./utilities";
|
||||
* context: {
|
||||
* location: "../app",
|
||||
* },
|
||||
* targets: ["mytarget"],
|
||||
* target: "mytarget",
|
||||
* buildArgs: {
|
||||
* MY_BUILD_ARG: "foo",
|
||||
* },
|
||||
@@ -253,13 +245,13 @@ import * as utilities from "./utilities";
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as aws from "@pulumi/aws";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const ecrRepository = new aws.ecr.Repository("ecr-repository", {});
|
||||
* const authToken = aws.ecr.getAuthorizationTokenOutput({
|
||||
* registryId: ecrRepository.registryId,
|
||||
* });
|
||||
* const myImage = new dockerbuild.Image("my-image", {
|
||||
* const myImage = new docker_build.Image("my-image", {
|
||||
* cacheFrom: [{
|
||||
* registry: {
|
||||
* ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
|
||||
@@ -289,15 +281,15 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "app",
|
||||
* },
|
||||
* platforms: [
|
||||
* dockerbuild.Platform.Plan9_amd64,
|
||||
* dockerbuild.Platform.Plan9_386,
|
||||
* docker_build.Platform.Plan9_amd64,
|
||||
* docker_build.Platform.Plan9_386,
|
||||
* ],
|
||||
* });
|
||||
* ```
|
||||
@@ -305,9 +297,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "app",
|
||||
* },
|
||||
@@ -325,9 +317,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* cacheFrom: [{
|
||||
* local: {
|
||||
* src: "tmp/cache",
|
||||
@@ -336,7 +328,7 @@ import * as utilities from "./utilities";
|
||||
* cacheTo: [{
|
||||
* local: {
|
||||
* dest: "tmp/cache",
|
||||
* mode: dockerbuild.CacheMode.Max,
|
||||
* mode: docker_build.CacheMode.Max,
|
||||
* },
|
||||
* }],
|
||||
* context: {
|
||||
@@ -348,9 +340,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* builder: {
|
||||
* name: "cloud-builder-name",
|
||||
* },
|
||||
@@ -364,9 +356,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* buildArgs: {
|
||||
* SET_ME_TO_TRUE: "true",
|
||||
* },
|
||||
@@ -379,9 +371,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "app",
|
||||
* },
|
||||
@@ -392,9 +384,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {context: {
|
||||
* const image = new docker_build.Image("image", {context: {
|
||||
* location: "app",
|
||||
* named: {
|
||||
* "golang:latest": {
|
||||
@@ -407,9 +399,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {context: {
|
||||
* const image = new docker_build.Image("image", {context: {
|
||||
* location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
* }});
|
||||
* ```
|
||||
@@ -417,9 +409,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "app",
|
||||
* },
|
||||
@@ -434,9 +426,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "https://github.com/docker-library/hello-world.git",
|
||||
* },
|
||||
@@ -449,9 +441,9 @@ import * as utilities from "./utilities";
|
||||
*
|
||||
* ```typescript
|
||||
* import * as pulumi from "@pulumi/pulumi";
|
||||
* import * as dockerbuild from "@pulumi/dockerbuild";
|
||||
* import * as docker_build from "@pulumi/docker-build";
|
||||
*
|
||||
* const image = new dockerbuild.Image("image", {
|
||||
* const image = new docker_build.Image("image", {
|
||||
* context: {
|
||||
* location: "app",
|
||||
* },
|
||||
@@ -509,20 +501,17 @@ export class Image extends pulumi.CustomResource {
|
||||
*/
|
||||
public readonly buildArgs!: pulumi.Output<{[key: string]: string} | undefined>;
|
||||
/**
|
||||
* By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
*
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*/
|
||||
public readonly buildOnPreview!: pulumi.Output<boolean | undefined>;
|
||||
/**
|
||||
@@ -728,7 +717,7 @@ export class Image extends pulumi.CustomResource {
|
||||
if (!opts.id) {
|
||||
resourceInputs["addHosts"] = args ? args.addHosts : undefined;
|
||||
resourceInputs["buildArgs"] = args ? args.buildArgs : undefined;
|
||||
resourceInputs["buildOnPreview"] = args ? args.buildOnPreview : undefined;
|
||||
resourceInputs["buildOnPreview"] = (args ? args.buildOnPreview : undefined) ?? true;
|
||||
resourceInputs["builder"] = args ? args.builder : undefined;
|
||||
resourceInputs["cacheFrom"] = args ? args.cacheFrom : undefined;
|
||||
resourceInputs["cacheTo"] = args ? args.cacheTo : undefined;
|
||||
@@ -806,20 +795,17 @@ export interface ImageArgs {
|
||||
*/
|
||||
buildArgs?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
|
||||
/**
|
||||
* By default, preview behavior depends on the execution environment. If
|
||||
* Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
* Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
* previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
* not build images.
|
||||
*
|
||||
* Setting this to `false` forces previews to never perform builds, and
|
||||
* setting it to `true` will always build the image during previews.
|
||||
* Setting this to `false` will always skip image builds during previews,
|
||||
* and setting it to `true` will always build images during previews.
|
||||
*
|
||||
* Images built during previews are never exported to registries, however
|
||||
* cache manifests are still exported.
|
||||
*
|
||||
* On-disk Dockerfiles are always validated for syntactic correctness
|
||||
* regardless of this setting.
|
||||
*
|
||||
* Defaults to `true` as a safeguard against broken images merging as part
|
||||
* of CI pipelines.
|
||||
*/
|
||||
buildOnPreview?: pulumi.Input<boolean>;
|
||||
/**
|
||||
|
||||
22
sdk/nodejs/index_.ts
generated
22
sdk/nodejs/index_.ts
generated
@@ -8,13 +8,25 @@ import * as enums from "./types/enums";
|
||||
import * as utilities from "./utilities";
|
||||
|
||||
/**
|
||||
* An index (or manifest list) referencing one or more existing images.
|
||||
* A wrapper around `docker buildx imagetools create` to create an index
|
||||
* (or manifest list) referencing one or more existing images.
|
||||
*
|
||||
* Useful for crafting a multi-platform image from several
|
||||
* platform-specific images.
|
||||
* In most cases you do not need an `Index` to build a multi-platform
|
||||
* image -- specifying multiple platforms on the `Image` will handle this
|
||||
* for you automatically.
|
||||
*
|
||||
* This creates an OCI image index or a Docker manifest list depending on
|
||||
* the media types of the source images.
|
||||
* However, as of April 2024, building multi-platform images _with
|
||||
* caching_ will only export a cache for one platform at a time (see [this
|
||||
* discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
* details).
|
||||
*
|
||||
* Therefore this resource can be helpful if you are building
|
||||
* multi-platform images with caching: each platform can be built and
|
||||
* cached separately, and an `Index` can join them all together. An
|
||||
* example of this is shown below.
|
||||
*
|
||||
* This resource creates an OCI image index or a Docker manifest list
|
||||
* depending on the media types of the source images.
|
||||
*
|
||||
* ## Example Usage
|
||||
* ### Multi-platform registry caching
|
||||
|
||||
8
sdk/nodejs/package.json
generated
8
sdk/nodejs/package.json
generated
@@ -4,9 +4,10 @@
|
||||
"keywords": [
|
||||
"docker",
|
||||
"buildkit",
|
||||
"buildx"
|
||||
"buildx",
|
||||
"kind/native"
|
||||
],
|
||||
"homepage": "https://pulumi.io",
|
||||
"homepage": "https://pulumi.com",
|
||||
"repository": "https://github.com/pulumi/pulumi-docker-build",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
@@ -21,7 +22,6 @@
|
||||
},
|
||||
"pulumi": {
|
||||
"resource": true,
|
||||
"name": "docker-build",
|
||||
"server": "github.com/pulumi/pulumi-docker-build"
|
||||
"name": "docker-build"
|
||||
}
|
||||
}
|
||||
|
||||
2
sdk/nodejs/utilities.ts
generated
2
sdk/nodejs/utilities.ts
generated
@@ -53,7 +53,7 @@ export function getVersion(): string {
|
||||
|
||||
/** @internal */
|
||||
export function resourceOptsDefaults(): any {
|
||||
return { version: getVersion(), pluginDownloadURL: "github.com/pulumi/pulumi-docker-build" };
|
||||
return { version: getVersion() };
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
||||
117
sdk/python/README.md
generated
117
sdk/python/README.md
generated
@@ -1,106 +1,23 @@
|
||||
# Pulumi Native Provider Boilerplate
|
||||
[](https://slack.pulumi.com)
|
||||
[](https://www.npmjs.com/package/@pulumi/docker-build)
|
||||
[](https://pypi.org/project/pulumi-docker-build)
|
||||
[](https://badge.fury.io/nu/pulumi.dockerbuild)
|
||||
[](https://pkg.go.dev/github.com/pulumi/pulumi-docker-build/sdk/go)
|
||||
[](https://github.com/pulumi/pulumi-docker-build/blob/main/LICENSE)
|
||||
|
||||
This repository is a boilerplate showing how to create and locally test a native Pulumi provider.
|
||||
# Docker-Build Resource Provider
|
||||
|
||||
## Authoring a Pulumi Native Provider
|
||||
A [Pulumi](http://pulumi.com) provider for building modern Docker images with [buildx](https://docs.docker.com/build/architecture/) and [BuildKit](https://docs.docker.com/build/buildkit/).
|
||||
|
||||
This boilerplate creates a working Pulumi-owned provider named `xyz`.
|
||||
It implements a random number generator that you can [build and test out for yourself](#test-against-the-example) and then replace the Random code with code specific to your provider.
|
||||
Not to be confused with the earlier
|
||||
[Docker](http://github.com/pulumi/pulumi-docker) provider, which is still
|
||||
appropriate for managing resources unrelated to building images.
|
||||
|
||||
| Provider | Use cases |
|
||||
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `@pulumi/docker-build` | Anything related to building images with `docker build`. |
|
||||
| `@pulumi/docker` | Everything else -- including running containers and creating networks. |
|
||||
|
||||
### Prerequisites
|
||||
## Reference
|
||||
|
||||
Prerequisites for this repository are already satisfied by the [Pulumi Devcontainer](https://github.com/pulumi/devcontainer) if you are using Github Codespaces, or VSCode.
|
||||
|
||||
If you are not using VSCode, you will need to ensure the following tools are installed and present in your `$PATH`:
|
||||
|
||||
* [`pulumictl`](https://github.com/pulumi/pulumictl#installation)
|
||||
* [Go 1.21](https://golang.org/dl/) or 1.latest
|
||||
* [NodeJS](https://nodejs.org/en/) 14.x. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS installations.
|
||||
* [Yarn](https://yarnpkg.com/)
|
||||
* [TypeScript](https://www.typescriptlang.org/)
|
||||
* [Python](https://www.python.org/downloads/) (called as `python3`). For recent versions of MacOS, the system-installed version is fine.
|
||||
* [.NET](https://dotnet.microsoft.com/download)
|
||||
|
||||
|
||||
### Build & test the boilerplate XYZ provider
|
||||
|
||||
1. Create a new Github CodeSpaces environment using this repository.
|
||||
1. Open a terminal in the CodeSpaces environment.
|
||||
1. Run `make build install` to build and install the provider.
|
||||
1. Run `make gen_examples` to generate the example programs in `examples/` off of the source `examples/yaml` example program.
|
||||
1. Run `make up` to run the example program in `examples/yaml`.
|
||||
1. Run `make down` to tear down the example program.
|
||||
|
||||
### Creating a new provider repository
|
||||
|
||||
Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository:
|
||||
|
||||
1. Click "Use this template".
|
||||
1. Set the following options:
|
||||
* Owner: pulumi
|
||||
* Repository name: pulumi-xyz-native (replace "xyz" with the name of your provider)
|
||||
* Description: Pulumi provider for xyz
|
||||
* Repository type: Public
|
||||
1. Clone the generated repository.
|
||||
|
||||
From the templated repository:
|
||||
|
||||
1. Search-replace `xyz` with the name of your desired provider.
|
||||
|
||||
#### Build the provider and install the plugin
|
||||
|
||||
```bash
|
||||
$ make build install
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Create the SDK codegen binary and place it in a `./bin` folder (gitignored)
|
||||
2. Create the provider binary and place it in the `./bin` folder (gitignored)
|
||||
3. Generate the dotnet, Go, Node, and Python SDKs and place them in the `./sdk` folder
|
||||
4. Install the provider on your machine.
|
||||
|
||||
#### Test against the example
|
||||
|
||||
```bash
|
||||
$ cd examples/simple
|
||||
$ yarn link @pulumi/xyz
|
||||
$ yarn install
|
||||
$ pulumi stack init test
|
||||
$ pulumi up
|
||||
```
|
||||
|
||||
Now that you have completed all of the above steps, you have a working provider that generates a random string for you.
|
||||
|
||||
#### A brief repository overview
|
||||
|
||||
You now have:
|
||||
|
||||
1. A `provider/` folder containing the building and implementation logic
|
||||
1. `cmd/pulumi-resource-xyz/main.go` - holds the provider's sample implementation logic.
|
||||
2. `deployment-templates` - a set of files to help you around deployment and publication
|
||||
3. `sdk` - holds the generated code libraries created by `pulumi-gen-xyz/main.go`
|
||||
4. `examples` a folder of Pulumi programs to try locally and/or use in CI.
|
||||
5. A `Makefile` and this `README`.
|
||||
|
||||
#### Additional Details
|
||||
|
||||
This repository depends on the pulumi-go-provider library. For more details on building providers, please check
|
||||
the [Pulumi Go Provider docs](https://github.com/pulumi/pulumi-go-provider).
|
||||
|
||||
### Build Examples
|
||||
|
||||
Create an example program using the resources defined in your provider, and place it in the `examples/` folder.
|
||||
|
||||
You can now repeat the steps for [build, install, and test](#test-against-the-example).
|
||||
|
||||
## Configuring CI and releases
|
||||
|
||||
1. Follow the instructions laid out in the [deployment templates](./deployment-templates/README-DEPLOYMENT.md).
|
||||
|
||||
## References
|
||||
|
||||
Other resources/examples for implementing providers:
|
||||
* [Pulumi Command provider](https://github.com/pulumi/pulumi-command/blob/master/provider/pkg/provider/provider.go)
|
||||
* [Pulumi Go Provider repository](https://github.com/pulumi/pulumi-go-provider)
|
||||
For more information, including examples and migration guidance, please see the Docker-Build provider's detailed [API documentation](https://www.pulumi.com/registry/packages/docker-build/).
|
||||
|
||||
2
sdk/python/pulumi_docker_build/README.md
generated
2
sdk/python/pulumi_docker_build/README.md
generated
@@ -1 +1 @@
|
||||
A Pulumi provider for Docker buildx
|
||||
A Pulumi provider for building modern Docker images with buildx and BuildKit.
|
||||
|
||||
2
sdk/python/pulumi_docker_build/_utilities.py
generated
2
sdk/python/pulumi_docker_build/_utilities.py
generated
@@ -288,4 +288,4 @@ async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bo
|
||||
)
|
||||
|
||||
def get_plugin_download_url():
|
||||
return "github.com/pulumi/pulumi-docker-build"
|
||||
return None
|
||||
|
||||
320
sdk/python/pulumi_docker_build/image.py
generated
320
sdk/python/pulumi_docker_build/image.py
generated
@@ -53,20 +53,17 @@ class ImageArgs:
|
||||
if these arguments are sensitive.
|
||||
|
||||
Equivalent to Docker's `--build-arg` flag.
|
||||
:param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If
|
||||
Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
not build images.
|
||||
|
||||
Setting this to `false` forces previews to never perform builds, and
|
||||
setting it to `true` will always build the image during previews.
|
||||
:param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
|
||||
and setting it to `true` will always build images during previews.
|
||||
|
||||
Images built during previews are never exported to registries, however
|
||||
cache manifests are still exported.
|
||||
|
||||
On-disk Dockerfiles are always validated for syntactic correctness
|
||||
regardless of this setting.
|
||||
|
||||
Defaults to `true` as a safeguard against broken images merging as part
|
||||
of CI pipelines.
|
||||
:param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration.
|
||||
:param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration.
|
||||
|
||||
@@ -171,6 +168,8 @@ class ImageArgs:
|
||||
pulumi.set(__self__, "add_hosts", add_hosts)
|
||||
if build_args is not None:
|
||||
pulumi.set(__self__, "build_args", build_args)
|
||||
if build_on_preview is None:
|
||||
build_on_preview = True
|
||||
if build_on_preview is not None:
|
||||
pulumi.set(__self__, "build_on_preview", build_on_preview)
|
||||
if builder is not None:
|
||||
@@ -252,20 +251,17 @@ class ImageArgs:
|
||||
@pulumi.getter(name="buildOnPreview")
|
||||
def build_on_preview(self) -> Optional[pulumi.Input[bool]]:
|
||||
"""
|
||||
By default, preview behavior depends on the execution environment. If
|
||||
Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
not build images.
|
||||
|
||||
Setting this to `false` forces previews to never perform builds, and
|
||||
setting it to `true` will always build the image during previews.
|
||||
Setting this to `false` will always skip image builds during previews,
|
||||
and setting it to `true` will always build images during previews.
|
||||
|
||||
Images built during previews are never exported to registries, however
|
||||
cache manifests are still exported.
|
||||
|
||||
On-disk Dockerfiles are always validated for syntactic correctness
|
||||
regardless of this setting.
|
||||
|
||||
Defaults to `true` as a safeguard against broken images merging as part
|
||||
of CI pipelines.
|
||||
"""
|
||||
return pulumi.get(self, "build_on_preview")
|
||||
|
||||
@@ -616,20 +612,14 @@ class Image(pulumi.CustomResource):
|
||||
|
||||
## Stability
|
||||
|
||||
**This resource is experimental and subject to change.**
|
||||
**This resource is pre-1.0 and in public preview.**
|
||||
|
||||
API types are unstable. Subsequent releases _may_ require manual edits
|
||||
to your state file(s) in order to adopt API changes.
|
||||
We will strive to keep APIs and behavior as stable as possible, but we
|
||||
cannot guarantee stability until version 1.0.
|
||||
|
||||
`retainOnDelete: true` is recommended with this resource until it is
|
||||
stable. This enables future API changes to be adopted more easily by renaming
|
||||
resources.
|
||||
## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
|
||||
Only use this resource if you understand and accept the risks.
|
||||
|
||||
## Migrating v3 and v4 Image resources
|
||||
|
||||
The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
|
||||
### Behavioral differences
|
||||
@@ -643,19 +633,17 @@ class Image(pulumi.CustomResource):
|
||||
|
||||
Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
|
||||
The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
Previews run in non-CI environments will not build images.
|
||||
This behavior is still configurable with `buildOnPreview`.
|
||||
The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
This behavior can be changed by specifying `buildOnPreview`.
|
||||
|
||||
#### Push behavior
|
||||
|
||||
Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
They expose a `skipPush: true` option to disable pushing.
|
||||
|
||||
The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
|
||||
To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -726,28 +714,28 @@ class Image(pulumi.CustomResource):
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_aws as aws
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = dockerbuild.Image("my-image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
registry=dockerbuild.CacheFromRegistryArgs(
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
registry=dockerbuild.CacheToRegistryArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
@@ -758,28 +746,28 @@ class Image(pulumi.CustomResource):
|
||||
### Multi-platform image
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
platforms=[
|
||||
dockerbuild.Platform.PLAN9_AMD64,
|
||||
dockerbuild.Platform.PLAN9_386,
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
])
|
||||
```
|
||||
### Registry export
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
@@ -790,34 +778,34 @@ class Image(pulumi.CustomResource):
|
||||
### Caching
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
local=dockerbuild.CacheFromLocalArgs(
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
local=dockerbuild.CacheToLocalArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=dockerbuild.CacheMode.MAX,
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
### Docker Build Cloud
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
builder=dockerbuild.BuilderConfigArgs(
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exec_=True)
|
||||
@@ -825,23 +813,23 @@ class Image(pulumi.CustomResource):
|
||||
### Build arguments
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
image = docker_build.Image("image",
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
### Build target
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
target="build-me")
|
||||
@@ -849,12 +837,12 @@ class Image(pulumi.CustomResource):
|
||||
### Named contexts
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": dockerbuild.ContextArgs(
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
},
|
||||
@@ -863,22 +851,22 @@ class Image(pulumi.CustomResource):
|
||||
### Remote context
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
))
|
||||
```
|
||||
### Inline Dockerfile
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline=\"\"\"FROM busybox
|
||||
COPY hello.c ./
|
||||
\"\"\",
|
||||
@@ -887,27 +875,27 @@ class Image(pulumi.CustomResource):
|
||||
### Remote context
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
))
|
||||
```
|
||||
### Local export
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[dockerbuild.ExportArgs(
|
||||
docker=dockerbuild.ExportDockerArgs(
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)])
|
||||
@@ -927,20 +915,17 @@ class Image(pulumi.CustomResource):
|
||||
if these arguments are sensitive.
|
||||
|
||||
Equivalent to Docker's `--build-arg` flag.
|
||||
:param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If
|
||||
Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
not build images.
|
||||
|
||||
Setting this to `false` forces previews to never perform builds, and
|
||||
setting it to `true` will always build the image during previews.
|
||||
:param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
|
||||
and setting it to `true` will always build images during previews.
|
||||
|
||||
Images built during previews are never exported to registries, however
|
||||
cache manifests are still exported.
|
||||
|
||||
On-disk Dockerfiles are always validated for syntactic correctness
|
||||
regardless of this setting.
|
||||
|
||||
Defaults to `true` as a safeguard against broken images merging as part
|
||||
of CI pipelines.
|
||||
:param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration.
|
||||
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration.
|
||||
|
||||
@@ -1053,20 +1038,14 @@ class Image(pulumi.CustomResource):
|
||||
|
||||
## Stability
|
||||
|
||||
**This resource is experimental and subject to change.**
|
||||
**This resource is pre-1.0 and in public preview.**
|
||||
|
||||
API types are unstable. Subsequent releases _may_ require manual edits
|
||||
to your state file(s) in order to adopt API changes.
|
||||
We will strive to keep APIs and behavior as stable as possible, but we
|
||||
cannot guarantee stability until version 1.0.
|
||||
|
||||
`retainOnDelete: true` is recommended with this resource until it is
|
||||
stable. This enables future API changes to be adopted more easily by renaming
|
||||
resources.
|
||||
## Migrating Pulumi Docker v3 and v4 Image resources
|
||||
|
||||
Only use this resource if you understand and accept the risks.
|
||||
|
||||
## Migrating v3 and v4 Image resources
|
||||
|
||||
The `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
This provider's `Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
|
||||
Existing `Image` resources can be converted to the docker-build `Image` resources with minor modifications.
|
||||
|
||||
### Behavioral differences
|
||||
@@ -1080,19 +1059,17 @@ class Image(pulumi.CustomResource):
|
||||
|
||||
Version `4.x` changed build-on-preview behavior to be opt-in.
|
||||
By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
|
||||
Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
|
||||
Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
|
||||
|
||||
The default behavior of the `Image` resource has been changed to strike a better balance between CI use cases and manual updates.
|
||||
By default, Pulumi will now only build `Image` resources during previews when it detects a CI environment like GitHub Actions.
|
||||
Previews run in non-CI environments will not build images.
|
||||
This behavior is still configurable with `buildOnPreview`.
|
||||
The default behavior of this provider's `Image` resource is similar to `3.x` and will build images during previews.
|
||||
This behavior can be changed by specifying `buildOnPreview`.
|
||||
|
||||
#### Push behavior
|
||||
|
||||
Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
|
||||
They expose a `skipPush: true` option to disable pushing.
|
||||
|
||||
The `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
This provider's `Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
|
||||
|
||||
To push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).
|
||||
Like Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.
|
||||
@@ -1163,28 +1140,28 @@ class Image(pulumi.CustomResource):
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_aws as aws
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = dockerbuild.Image("my-image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
registry=dockerbuild.CacheFromRegistryArgs(
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
registry=dockerbuild.CacheToRegistryArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
@@ -1195,28 +1172,28 @@ class Image(pulumi.CustomResource):
|
||||
### Multi-platform image
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
platforms=[
|
||||
dockerbuild.Platform.PLAN9_AMD64,
|
||||
dockerbuild.Platform.PLAN9_386,
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
])
|
||||
```
|
||||
### Registry export
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
push=True,
|
||||
registries=[dockerbuild.RegistryArgs(
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
@@ -1227,34 +1204,34 @@ class Image(pulumi.CustomResource):
|
||||
### Caching
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
cache_from=[dockerbuild.CacheFromArgs(
|
||||
local=dockerbuild.CacheFromLocalArgs(
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[dockerbuild.CacheToArgs(
|
||||
local=dockerbuild.CacheToLocalArgs(
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=dockerbuild.CacheMode.MAX,
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
### Docker Build Cloud
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
builder=dockerbuild.BuilderConfigArgs(
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exec_=True)
|
||||
@@ -1262,23 +1239,23 @@ class Image(pulumi.CustomResource):
|
||||
### Build arguments
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
image = docker_build.Image("image",
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
))
|
||||
```
|
||||
### Build target
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
target="build-me")
|
||||
@@ -1286,12 +1263,12 @@ class Image(pulumi.CustomResource):
|
||||
### Named contexts
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": dockerbuild.ContextArgs(
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
},
|
||||
@@ -1300,22 +1277,22 @@ class Image(pulumi.CustomResource):
|
||||
### Remote context
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image", context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image", context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
))
|
||||
```
|
||||
### Inline Dockerfile
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline=\"\"\"FROM busybox
|
||||
COPY hello.c ./
|
||||
\"\"\",
|
||||
@@ -1324,27 +1301,27 @@ class Image(pulumi.CustomResource):
|
||||
### Remote context
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=dockerbuild.DockerfileArgs(
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
))
|
||||
```
|
||||
### Local export
|
||||
```python
|
||||
import pulumi
|
||||
import pulumi_dockerbuild as dockerbuild
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = dockerbuild.Image("image",
|
||||
context=dockerbuild.BuildContextArgs(
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[dockerbuild.ExportArgs(
|
||||
docker=dockerbuild.ExportDockerArgs(
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)])
|
||||
@@ -1398,6 +1375,8 @@ class Image(pulumi.CustomResource):
|
||||
|
||||
__props__.__dict__["add_hosts"] = add_hosts
|
||||
__props__.__dict__["build_args"] = build_args
|
||||
if build_on_preview is None:
|
||||
build_on_preview = True
|
||||
__props__.__dict__["build_on_preview"] = build_on_preview
|
||||
__props__.__dict__["builder"] = builder
|
||||
__props__.__dict__["cache_from"] = cache_from
|
||||
@@ -1502,20 +1481,17 @@ class Image(pulumi.CustomResource):
|
||||
@pulumi.getter(name="buildOnPreview")
|
||||
def build_on_preview(self) -> pulumi.Output[Optional[bool]]:
|
||||
"""
|
||||
By default, preview behavior depends on the execution environment. If
|
||||
Pulumi detects the operation is running on a CI system (GitHub Actions,
|
||||
Travis CI, Azure Pipelines, etc.) then it will build images during
|
||||
previews as a safeguard. Otherwise, if not running on CI, previews will
|
||||
not build images.
|
||||
|
||||
Setting this to `false` forces previews to never perform builds, and
|
||||
setting it to `true` will always build the image during previews.
|
||||
Setting this to `false` will always skip image builds during previews,
|
||||
and setting it to `true` will always build images during previews.
|
||||
|
||||
Images built during previews are never exported to registries, however
|
||||
cache manifests are still exported.
|
||||
|
||||
On-disk Dockerfiles are always validated for syntactic correctness
|
||||
regardless of this setting.
|
||||
|
||||
Defaults to `true` as a safeguard against broken images merging as part
|
||||
of CI pipelines.
|
||||
"""
|
||||
return pulumi.get(self, "build_on_preview")
|
||||
|
||||
|
||||
44
sdk/python/pulumi_docker_build/index.py
generated
44
sdk/python/pulumi_docker_build/index.py
generated
@@ -104,13 +104,25 @@ class Index(pulumi.CustomResource):
|
||||
tag: Optional[pulumi.Input[str]] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
An index (or manifest list) referencing one or more existing images.
|
||||
A wrapper around `docker buildx imagetools create` to create an index
|
||||
(or manifest list) referencing one or more existing images.
|
||||
|
||||
Useful for crafting a multi-platform image from several
|
||||
platform-specific images.
|
||||
In most cases you do not need an `Index` to build a multi-platform
|
||||
image -- specifying multiple platforms on the `Image` will handle this
|
||||
for you automatically.
|
||||
|
||||
This creates an OCI image index or a Docker manifest list depending on
|
||||
the media types of the source images.
|
||||
However, as of April 2024, building multi-platform images _with
|
||||
caching_ will only export a cache for one platform at a time (see [this
|
||||
discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
details).
|
||||
|
||||
Therefore this resource can be helpful if you are building
|
||||
multi-platform images with caching: each platform can be built and
|
||||
cached separately, and an `Index` can join them all together. An
|
||||
example of this is shown below.
|
||||
|
||||
This resource creates an OCI image index or a Docker manifest list
|
||||
depending on the media types of the source images.
|
||||
|
||||
## Example Usage
|
||||
### Multi-platform registry caching
|
||||
@@ -179,13 +191,25 @@ class Index(pulumi.CustomResource):
|
||||
args: IndexArgs,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
An index (or manifest list) referencing one or more existing images.
|
||||
A wrapper around `docker buildx imagetools create` to create an index
|
||||
(or manifest list) referencing one or more existing images.
|
||||
|
||||
Useful for crafting a multi-platform image from several
|
||||
platform-specific images.
|
||||
In most cases you do not need an `Index` to build a multi-platform
|
||||
image -- specifying multiple platforms on the `Image` will handle this
|
||||
for you automatically.
|
||||
|
||||
This creates an OCI image index or a Docker manifest list depending on
|
||||
the media types of the source images.
|
||||
However, as of April 2024, building multi-platform images _with
|
||||
caching_ will only export a cache for one platform at a time (see [this
|
||||
discussion](https://github.com/docker/buildx/discussions/1382) for more
|
||||
details).
|
||||
|
||||
Therefore this resource can be helpful if you are building
|
||||
multi-platform images with caching: each platform can be built and
|
||||
cached separately, and an `Index` can join them all together. An
|
||||
example of this is shown below.
|
||||
|
||||
This resource creates an OCI image index or a Docker manifest list
|
||||
depending on the media types of the source images.
|
||||
|
||||
## Example Usage
|
||||
### Multi-platform registry caching
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"resource": true,
|
||||
"name": "docker-build",
|
||||
"server": "github.com/pulumi/pulumi-docker-build"
|
||||
"name": "docker-build"
|
||||
}
|
||||
|
||||
6
sdk/python/pyproject.toml
generated
6
sdk/python/pyproject.toml
generated
@@ -1,15 +1,15 @@
|
||||
[project]
|
||||
name = "pulumi_docker_build"
|
||||
description = "A Pulumi provider for Docker buildx"
|
||||
description = "A Pulumi provider for building modern Docker images with buildx and BuildKit."
|
||||
dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"]
|
||||
keywords = ["docker", "buildkit", "buildx"]
|
||||
keywords = ["docker", "buildkit", "buildx", "kind/native"]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
version = "0.0.0"
|
||||
[project.license]
|
||||
text = "Apache-2.0"
|
||||
[project.urls]
|
||||
Homepage = "https://pulumi.io"
|
||||
Homepage = "https://pulumi.com"
|
||||
Repository = "https://github.com/pulumi/pulumi-docker-build"
|
||||
|
||||
[build-system]
|
||||
|
||||
Reference in New Issue
Block a user