Initial provider implementation (#18)

This brings over the initial buildx prototype from pulumi/pulumi-docker
and fixes various build and release issues.
This commit is contained in:
Bryce Lampe
2024-04-25 11:03:59 -07:00
committed by GitHub
parent 2545dd3089
commit 26c144c916
398 changed files with 65361 additions and 1702 deletions

117
sdk/nodejs/README.md generated
View File

@@ -1,106 +1,23 @@
# Pulumi Native Provider Boilerplate
[![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com)
[![NPM version](https://badge.fury.io/js/%40pulumi%2fdocker-build.svg)](https://www.npmjs.com/package/@pulumi/docker-build)
[![Python version](https://badge.fury.io/py/pulumi-docker-build.svg)](https://pypi.org/project/pulumi-docker-build)
[![NuGet version](https://badge.fury.io/nu/pulumi.dockerbuild.svg)](https://badge.fury.io/nu/pulumi.dockerbuild)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pulumi/pulumi-docker-build/sdk/go)](https://pkg.go.dev/github.com/pulumi/pulumi-docker-build/sdk/go)
[![License](https://img.shields.io/npm/l/%40pulumi%2Fpulumi.svg)](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/).

5
sdk/nodejs/config/index.ts generated Normal file
View File

@@ -0,0 +1,5 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
// Export members:
export * from "./vars";

31
sdk/nodejs/config/vars.ts generated Normal file
View File

@@ -0,0 +1,31 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as enums from "../types/enums";
import * as utilities from "../utilities";
declare var exports: any;
const __config = new pulumi.Config("docker-build");
/**
* The build daemon's address.
*/
export declare const host: string;
Object.defineProperty(exports, "host", {
get() {
return __config.get("host") ?? (utilities.getEnv("DOCKER_HOST") || "");
},
enumerable: true,
});
export declare const registries: outputs.Registry[] | undefined;
Object.defineProperty(exports, "registries", {
get() {
return __config.getObject<outputs.Registry[]>("registries");
},
enumerable: true,
});

984
sdk/nodejs/image.ts generated Normal file
View File

@@ -0,0 +1,984 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as enums from "./types/enums";
import * as utilities from "./utilities";
/**
* A Docker image built using buildx -- Docker's interface to the improved
* BuildKit backend.
*
* ## Stability
*
* **This resource is pre-1.0 and in public preview.**
*
* We will strive to keep APIs and behavior as stable as possible, but we
* cannot guarantee stability until version 1.0.
*
* ## Migrating Pulumi Docker v3 and v4 Image resources
*
* 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
*
* There are several key behavioral differences to keep in mind when transitioning images to the new `Image` resource.
*
* #### Previews
*
* Version `3.x` of the Pulumi Docker provider always builds images during preview operations.
* This is helpful as a safeguard to prevent "broken" images from merging, but users found the behavior unnecessarily redundant when running previews and updates locally.
*
* 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.
* Several users reported outages due to the default behavior allowing bad images to accidentally sneak through CI.
*
* 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.
*
* 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.
*
* #### Secrets
*
* Version `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.
*
* Version `4.x` of the Pulumi Docker provider does not support secrets.
*
* The `Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
* Instead, they should be passed directly as values.
* (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
* Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
*
* #### Caching
*
* Version `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.
* It builds targets individually and pushes them to separate images for caching.
*
* Version `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.
*
* Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
* This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
*
* The `Image` resource delegates all caching behavior to Docker.
* `cacheFrom` and `cacheTo` options (equivalent to Docker's `--cache-to` and `--cache-from`) are exposed and provide additional cache targets, such as local disk, S3 storage, etc.
*
* #### Outputs
*
* Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
* In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
*
* Unlike earlier providers the `Image` resource can push multiple tags.
* As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
* If multiple tags were pushed this uses one at random.
*
* If you need more control over tag references you can use the `digest` output, which is always a single sha256 hash as long as the image was exported somewhere.
*
* #### Tag deletion and refreshes
*
* Versions 3 and 4 of Pulumi Docker provider do not delete tags when the `Image` resource is deleted, nor do they confirm expected tags exist during `refresh` operations.
*
* The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
* If any are missing a subsequent `update` will push them.
*
* When a `Image` is deleted, it will _attempt_ to also delete any pushed tags.
* Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
* Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
*
* Use the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.
*
* ### Example migration
*
* Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `Image` resource showing how they would look after migration.
*
* The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
* After migration, the environment variable is no longer needed and CLI flags are now properties on the `Image`.
* In almost all cases, properties of `Image` are named after the Docker CLI flag they correspond to.
*
* The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
* It it is shown with parameters similar to the `v3` example for completeness.
*
* ## Example Usage
* ### v3/v4 migration
*
* ```typescript
*
* // v3 Image
* const v3 = new docker.Image("v3-image", {
* imageName: "myregistry.com/user/repo:latest",
* localImageName: "local-tag",
* skipPush: false,
* build: {
* dockerfile: "./Dockerfile",
* context: "../app",
* target: "mytarget",
* args: {
* MY_BUILD_ARG: "foo",
* },
* env: {
* DOCKER_BUILDKIT: "1",
* },
* extraOptions: [
* "--cache-from",
* "type=registry,myregistry.com/user/repo:cache",
* "--cache-to",
* "type=registry,myregistry.com/user/repo:cache",
* "--add-host",
* "metadata.google.internal:169.254.169.254",
* "--secret",
* "id=mysecret,src=/local/secret",
* "--ssh",
* "default=/home/runner/.ssh/id_ed25519",
* "--network",
* "host",
* "--platform",
* "linux/amd64",
* ],
* },
* registry: {
* server: "myregistry.com",
* username: "username",
* password: pulumi.secret("password"),
* },
* });
*
* // v3 Image after migrating to docker-build.Image
* const v3Migrated = new dockerbuild.Image("v3-to-buildx", {
* tags: ["myregistry.com/user/repo:latest", "local-tag"],
* push: true,
* dockerfile: {
* location: "./Dockerfile",
* },
* context: {
* location: "../app",
* },
* target: "mytarget",
* buildArgs: {
* MY_BUILD_ARG: "foo",
* },
* cacheFrom: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
* cacheTo: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
* secrets: {
* mysecret: "value",
* },
* addHosts: ["metadata.google.internal:169.254.169.254"],
* ssh: {
* default: ["/home/runner/.ssh/id_ed25519"],
* },
* network: "host",
* platforms: ["linux/amd64"],
* registries: [{
* address: "myregistry.com",
* username: "username",
* password: pulumi.secret("password"),
* }],
* });
*
*
* // v4 Image
* const v4 = new docker.Image("v4-image", {
* imageName: "myregistry.com/user/repo:latest",
* skipPush: false,
* build: {
* dockerfile: "./Dockerfile",
* context: "../app",
* target: "mytarget",
* args: {
* MY_BUILD_ARG: "foo",
* },
* cacheFrom: {
* images: ["myregistry.com/user/repo:cache"],
* },
* addHosts: ["metadata.google.internal:169.254.169.254"],
* network: "host",
* platform: "linux/amd64",
* },
* buildOnPreview: true,
* registry: {
* server: "myregistry.com",
* username: "username",
* password: pulumi.secret("password"),
* },
* });
*
* // v4 Image after migrating to docker-build.Image
* const v4Migrated = new dockerbuild.Image("v4-to-buildx", {
* tags: ["myregistry.com/user/repo:latest"],
* push: true,
* dockerfile: {
* location: "./Dockerfile",
* },
* context: {
* location: "../app",
* },
* target: "mytarget",
* buildArgs: {
* MY_BUILD_ARG: "foo",
* },
* cacheFrom: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
* cacheTo: [{ registry: { ref: "myregistry.com/user/repo:cache" } }],
* addHosts: ["metadata.google.internal:169.254.169.254"],
* network: "host",
* platforms: ["linux/amd64"],
* registries: [{
* address: "myregistry.com",
* username: "username",
* password: pulumi.secret("password"),
* }],
* });
*
* ```
*
* ## Example Usage
* ### Push to AWS ECR with caching
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* 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 docker_build.Image("my-image", {
* cacheFrom: [{
* registry: {
* ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
* },
* }],
* cacheTo: [{
* registry: {
* imageManifest: true,
* ociMediaTypes: true,
* ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,
* },
* }],
* context: {
* location: "./app",
* },
* push: true,
* registries: [{
* address: ecrRepository.repositoryUrl,
* password: authToken.apply(authToken => authToken.password),
* username: authToken.apply(authToken => authToken.userName),
* }],
* tags: [pulumi.interpolate`${ecrRepository.repositoryUrl}:latest`],
* });
* export const ref = myImage.ref;
* ```
* ### Multi-platform image
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* },
* platforms: [
* docker_build.Platform.Plan9_amd64,
* docker_build.Platform.Plan9_386,
* ],
* push: false,
* });
* ```
* ### Registry export
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* },
* push: true,
* registries: [{
* address: "docker.io",
* password: dockerHubPassword,
* username: "pulumibot",
* }],
* tags: ["docker.io/pulumi/pulumi:3.107.0"],
* });
* export const ref = myImage.ref;
* ```
* ### Caching
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* cacheFrom: [{
* local: {
* src: "tmp/cache",
* },
* }],
* cacheTo: [{
* local: {
* dest: "tmp/cache",
* mode: docker_build.CacheMode.Max,
* },
* }],
* context: {
* location: "app",
* },
* push: false,
* });
* ```
* ### Docker Build Cloud
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* builder: {
* name: "cloud-builder-name",
* },
* context: {
* location: "app",
* },
* exec: true,
* push: false,
* });
* ```
* ### Build arguments
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* buildArgs: {
* SET_ME_TO_TRUE: "true",
* },
* context: {
* location: "app",
* },
* push: false,
* });
* ```
* ### Build target
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* },
* push: false,
* target: "build-me",
* });
* ```
* ### Named contexts
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* named: {
* "golang:latest": {
* location: "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
* },
* },
* },
* push: false,
* });
* ```
* ### Remote context
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
* },
* push: false,
* });
* ```
* ### Inline Dockerfile
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* },
* dockerfile: {
* inline: `FROM busybox
* COPY hello.c ./
* `,
* },
* push: false,
* });
* ```
* ### Remote context
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "https://github.com/docker-library/hello-world.git",
* },
* dockerfile: {
* location: "app/Dockerfile",
* },
* push: false,
* });
* ```
* ### Local export
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const image = new docker_build.Image("image", {
* context: {
* location: "app",
* },
* exports: [{
* docker: {
* tar: true,
* },
* }],
* push: false,
* });
* ```
*/
export class Image extends pulumi.CustomResource {
/**
* Get an existing Image resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Image {
return new Image(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'docker-build:index:Image';
/**
* Returns true if the given object is an instance of Image. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Image {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Image.__pulumiType;
}
/**
* Custom `host:ip` mappings to use during the build.
*
* Equivalent to Docker's `--add-host` flag.
*/
public readonly addHosts!: pulumi.Output<string[] | undefined>;
/**
* `ARG` names and values to set during the build.
*
* These variables are accessed like environment variables inside `RUN`
* instructions.
*
* Build arguments are persisted in the image, so you should use `secrets`
* if these arguments are sensitive.
*
* Equivalent to Docker's `--build-arg` flag.
*/
public readonly buildArgs!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* 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>;
/**
* Builder configuration.
*/
public readonly builder!: pulumi.Output<outputs.BuilderConfig | undefined>;
/**
* Cache export configuration.
*
* Equivalent to Docker's `--cache-from` flag.
*/
public readonly cacheFrom!: pulumi.Output<outputs.CacheFrom[] | undefined>;
/**
* Cache import configuration.
*
* Equivalent to Docker's `--cache-to` flag.
*/
public readonly cacheTo!: pulumi.Output<outputs.CacheTo[] | undefined>;
/**
* Build context settings.
*
* Equivalent to Docker's `PATH | URL | -` positional argument.
*/
public readonly context!: pulumi.Output<outputs.BuildContext | undefined>;
/**
* A preliminary hash of the image's build context.
*
* Pulumi uses this to determine if an image _may_ need to be re-built.
*/
public /*out*/ readonly contextHash!: pulumi.Output<string>;
/**
* A SHA256 digest of the image if it was exported to a registry or
* elsewhere.
*
* Empty if the image was not exported.
*
* Registry images can be referenced precisely as `<tag>@<digest>`. The
* `ref` output provides one such reference as a convenience.
*/
public /*out*/ readonly digest!: pulumi.Output<string>;
/**
* Dockerfile settings.
*
* Equivalent to Docker's `--file` flag.
*/
public readonly dockerfile!: pulumi.Output<outputs.Dockerfile | undefined>;
/**
* Use `exec` mode to build this image.
*
* By default the provider embeds a v25 Docker client with v0.12 buildx
* support. This helps ensure consistent behavior across environments and
* is compatible with alternative build backends (e.g. `buildkitd`), but
* it may not be desirable if you require a specific version of buildx.
* For example you may want to run a custom `docker-buildx` binary with
* support for [Docker Build
* Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
*
* When this is set to `true` the provider will instead execute the
* `docker-buildx` binary directly to perform its operations. The user is
* responsible for ensuring this binary exists, with correct permissions
* and pre-configured builders, at a path Docker expects (e.g.
* `~/.docker/cli-plugins`).
*
* Debugging `exec` mode may be more difficult as Pulumi will not be able
* to surface fine-grained errors and warnings. Additionally credentials
* are temporarily written to disk in order to provide them to the
* `docker-buildx` binary.
*/
public readonly exec!: pulumi.Output<boolean | undefined>;
/**
* Controls where images are persisted after building.
*
* Images are only stored in the local cache unless `exports` are
* explicitly configured.
*
* Exporting to multiple destinations requires a daemon running BuildKit
* 0.13 or later.
*
* Equivalent to Docker's `--output` flag.
*/
public readonly exports!: pulumi.Output<outputs.Export[] | undefined>;
/**
* Attach arbitrary key/value metadata to the image.
*
* Equivalent to Docker's `--label` flag.
*/
public readonly labels!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* When `true` the build will automatically include a `docker` export.
*
* Defaults to `false`.
*
* Equivalent to Docker's `--load` flag.
*/
public readonly load!: pulumi.Output<boolean | undefined>;
/**
* Set the network mode for `RUN` instructions. Defaults to `default`.
*
* For custom networks, configure your builder with `--driver-opt network=...`.
*
* Equivalent to Docker's `--network` flag.
*/
public readonly network!: pulumi.Output<enums.NetworkMode | undefined>;
/**
* Do not import cache manifests when building the image.
*
* Equivalent to Docker's `--no-cache` flag.
*/
public readonly noCache!: pulumi.Output<boolean | undefined>;
/**
* Set target platform(s) for the build. Defaults to the host's platform.
*
* Equivalent to Docker's `--platform` flag.
*/
public readonly platforms!: pulumi.Output<enums.Platform[] | undefined>;
/**
* Always pull referenced images.
*
* Equivalent to Docker's `--pull` flag.
*/
public readonly pull!: pulumi.Output<boolean | undefined>;
/**
* When `true` the build will automatically include a `registry` export.
*
* Defaults to `false`.
*
* Equivalent to Docker's `--push` flag.
*/
public readonly push!: pulumi.Output<boolean>;
/**
* If the image was pushed to any registries then this will contain a
* single fully-qualified tag including the build's digest.
*
* If the image had tags but was not exported, this will take on a value
* of one of those tags.
*
* This will be empty if the image had no exports and no tags.
*
* This is only for convenience and may not be appropriate for situations
* where multiple tags or registries are involved. In those cases this
* output is not guaranteed to be stable.
*
* For more control over tags consumed by downstream resources you should
* use the `digest` output.
*/
public /*out*/ readonly ref!: pulumi.Output<string>;
/**
* Registry credentials. Required if reading or exporting to private
* repositories.
*
* Credentials are kept in-memory and do not pollute pre-existing
* credentials on the host.
*
* Similar to `docker login`.
*/
public readonly registries!: pulumi.Output<outputs.Registry[] | undefined>;
/**
* A mapping of secret names to their corresponding values.
*
* Unlike the Docker CLI, these can be passed by value and do not need to
* exist on-disk or in environment variables.
*
* Build arguments and environment variables are persistent in the final
* image, so you should use this for sensitive values.
*
* Similar to Docker's `--secret` flag.
*/
public readonly secrets!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* SSH agent socket or keys to expose to the build.
*
* Equivalent to Docker's `--ssh` flag.
*/
public readonly ssh!: pulumi.Output<outputs.SSH[] | undefined>;
/**
* Name and optionally a tag (format: `name:tag`).
*
* If exporting to a registry, the name should include the fully qualified
* registry address (e.g. `docker.io/pulumi/pulumi:latest`).
*
* Equivalent to Docker's `--tag` flag.
*/
public readonly tags!: pulumi.Output<string[] | undefined>;
/**
* Set the target build stage(s) to build.
*
* If not specified all targets will be built by default.
*
* Equivalent to Docker's `--target` flag.
*/
public readonly target!: pulumi.Output<string | undefined>;
/**
* Create a Image resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ImageArgs, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.push === undefined) && !opts.urn) {
throw new Error("Missing required property 'push'");
}
resourceInputs["addHosts"] = args ? args.addHosts : undefined;
resourceInputs["buildArgs"] = args ? args.buildArgs : 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;
resourceInputs["context"] = args ? args.context : undefined;
resourceInputs["dockerfile"] = args ? args.dockerfile : undefined;
resourceInputs["exec"] = args ? args.exec : undefined;
resourceInputs["exports"] = args ? args.exports : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["load"] = args ? args.load : undefined;
resourceInputs["network"] = (args ? args.network : undefined) ?? "default";
resourceInputs["noCache"] = args ? args.noCache : undefined;
resourceInputs["platforms"] = args ? args.platforms : undefined;
resourceInputs["pull"] = args ? args.pull : undefined;
resourceInputs["push"] = args ? args.push : undefined;
resourceInputs["registries"] = args ? args.registries : undefined;
resourceInputs["secrets"] = args ? args.secrets : undefined;
resourceInputs["ssh"] = args ? args.ssh : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["contextHash"] = undefined /*out*/;
resourceInputs["digest"] = undefined /*out*/;
resourceInputs["ref"] = undefined /*out*/;
} else {
resourceInputs["addHosts"] = undefined /*out*/;
resourceInputs["buildArgs"] = undefined /*out*/;
resourceInputs["buildOnPreview"] = undefined /*out*/;
resourceInputs["builder"] = undefined /*out*/;
resourceInputs["cacheFrom"] = undefined /*out*/;
resourceInputs["cacheTo"] = undefined /*out*/;
resourceInputs["context"] = undefined /*out*/;
resourceInputs["contextHash"] = undefined /*out*/;
resourceInputs["digest"] = undefined /*out*/;
resourceInputs["dockerfile"] = undefined /*out*/;
resourceInputs["exec"] = undefined /*out*/;
resourceInputs["exports"] = undefined /*out*/;
resourceInputs["labels"] = undefined /*out*/;
resourceInputs["load"] = undefined /*out*/;
resourceInputs["network"] = undefined /*out*/;
resourceInputs["noCache"] = undefined /*out*/;
resourceInputs["platforms"] = undefined /*out*/;
resourceInputs["pull"] = undefined /*out*/;
resourceInputs["push"] = undefined /*out*/;
resourceInputs["ref"] = undefined /*out*/;
resourceInputs["registries"] = undefined /*out*/;
resourceInputs["secrets"] = undefined /*out*/;
resourceInputs["ssh"] = undefined /*out*/;
resourceInputs["tags"] = undefined /*out*/;
resourceInputs["target"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Image.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Image resource.
*/
export interface ImageArgs {
/**
* Custom `host:ip` mappings to use during the build.
*
* Equivalent to Docker's `--add-host` flag.
*/
addHosts?: pulumi.Input<pulumi.Input<string>[]>;
/**
* `ARG` names and values to set during the build.
*
* These variables are accessed like environment variables inside `RUN`
* instructions.
*
* Build arguments are persisted in the image, so you should use `secrets`
* if these arguments are sensitive.
*
* Equivalent to Docker's `--build-arg` flag.
*/
buildArgs?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* 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>;
/**
* Builder configuration.
*/
builder?: pulumi.Input<inputs.BuilderConfigArgs>;
/**
* Cache export configuration.
*
* Equivalent to Docker's `--cache-from` flag.
*/
cacheFrom?: pulumi.Input<pulumi.Input<inputs.CacheFromArgs>[]>;
/**
* Cache import configuration.
*
* Equivalent to Docker's `--cache-to` flag.
*/
cacheTo?: pulumi.Input<pulumi.Input<inputs.CacheToArgs>[]>;
/**
* Build context settings.
*
* Equivalent to Docker's `PATH | URL | -` positional argument.
*/
context?: pulumi.Input<inputs.BuildContextArgs>;
/**
* Dockerfile settings.
*
* Equivalent to Docker's `--file` flag.
*/
dockerfile?: pulumi.Input<inputs.DockerfileArgs>;
/**
* Use `exec` mode to build this image.
*
* By default the provider embeds a v25 Docker client with v0.12 buildx
* support. This helps ensure consistent behavior across environments and
* is compatible with alternative build backends (e.g. `buildkitd`), but
* it may not be desirable if you require a specific version of buildx.
* For example you may want to run a custom `docker-buildx` binary with
* support for [Docker Build
* Cloud](https://docs.docker.com/build/cloud/setup/) (DBC).
*
* When this is set to `true` the provider will instead execute the
* `docker-buildx` binary directly to perform its operations. The user is
* responsible for ensuring this binary exists, with correct permissions
* and pre-configured builders, at a path Docker expects (e.g.
* `~/.docker/cli-plugins`).
*
* Debugging `exec` mode may be more difficult as Pulumi will not be able
* to surface fine-grained errors and warnings. Additionally credentials
* are temporarily written to disk in order to provide them to the
* `docker-buildx` binary.
*/
exec?: pulumi.Input<boolean>;
/**
* Controls where images are persisted after building.
*
* Images are only stored in the local cache unless `exports` are
* explicitly configured.
*
* Exporting to multiple destinations requires a daemon running BuildKit
* 0.13 or later.
*
* Equivalent to Docker's `--output` flag.
*/
exports?: pulumi.Input<pulumi.Input<inputs.ExportArgs>[]>;
/**
* Attach arbitrary key/value metadata to the image.
*
* Equivalent to Docker's `--label` flag.
*/
labels?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* When `true` the build will automatically include a `docker` export.
*
* Defaults to `false`.
*
* Equivalent to Docker's `--load` flag.
*/
load?: pulumi.Input<boolean>;
/**
* Set the network mode for `RUN` instructions. Defaults to `default`.
*
* For custom networks, configure your builder with `--driver-opt network=...`.
*
* Equivalent to Docker's `--network` flag.
*/
network?: pulumi.Input<enums.NetworkMode>;
/**
* Do not import cache manifests when building the image.
*
* Equivalent to Docker's `--no-cache` flag.
*/
noCache?: pulumi.Input<boolean>;
/**
* Set target platform(s) for the build. Defaults to the host's platform.
*
* Equivalent to Docker's `--platform` flag.
*/
platforms?: pulumi.Input<pulumi.Input<enums.Platform>[]>;
/**
* Always pull referenced images.
*
* Equivalent to Docker's `--pull` flag.
*/
pull?: pulumi.Input<boolean>;
/**
* When `true` the build will automatically include a `registry` export.
*
* Defaults to `false`.
*
* Equivalent to Docker's `--push` flag.
*/
push: pulumi.Input<boolean>;
/**
* Registry credentials. Required if reading or exporting to private
* repositories.
*
* Credentials are kept in-memory and do not pollute pre-existing
* credentials on the host.
*
* Similar to `docker login`.
*/
registries?: pulumi.Input<pulumi.Input<inputs.RegistryArgs>[]>;
/**
* A mapping of secret names to their corresponding values.
*
* Unlike the Docker CLI, these can be passed by value and do not need to
* exist on-disk or in environment variables.
*
* Build arguments and environment variables are persistent in the final
* image, so you should use this for sensitive values.
*
* Similar to Docker's `--secret` flag.
*/
secrets?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* SSH agent socket or keys to expose to the build.
*
* Equivalent to Docker's `--ssh` flag.
*/
ssh?: pulumi.Input<pulumi.Input<inputs.SSHArgs>[]>;
/**
* Name and optionally a tag (format: `name:tag`).
*
* If exporting to a registry, the name should include the fully qualified
* registry address (e.g. `docker.io/pulumi/pulumi:latest`).
*
* Equivalent to Docker's `--tag` flag.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set the target build stage(s) to build.
*
* If not specified all targets will be built by default.
*
* Equivalent to Docker's `--target` flag.
*/
target?: pulumi.Input<string>;
}

37
sdk/nodejs/index.ts generated
View File

@@ -5,33 +5,52 @@ import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
// Export members:
export { ImageArgs } from "./image";
export type Image = import("./image").Image;
export const Image: typeof import("./image").Image = null as any;
utilities.lazyLoad(exports, ["Image"], () => require("./image"));
export { IndexArgs } from "./index_";
export type Index = import("./index_").Index;
export const Index: typeof import("./index_").Index = null as any;
utilities.lazyLoad(exports, ["Index"], () => require("./index_"));
export { ProviderArgs } from "./provider";
export type Provider = import("./provider").Provider;
export const Provider: typeof import("./provider").Provider = null as any;
utilities.lazyLoad(exports, ["Provider"], () => require("./provider"));
export { RandomArgs } from "./random";
export type Random = import("./random").Random;
export const Random: typeof import("./random").Random = null as any;
utilities.lazyLoad(exports, ["Random"], () => require("./random"));
// Export enums:
export * from "./types/enums";
// Export sub-modules:
import * as config from "./config";
import * as types from "./types";
export {
config,
types,
};
const _module = {
version: utilities.getVersion(),
construct: (name: string, type: string, urn: string): pulumi.Resource => {
switch (type) {
case "dockerbuild:index:Random":
return new Random(name, <any>undefined, { urn })
case "docker-build:index:Image":
return new Image(name, <any>undefined, { urn })
case "docker-build:index:Index":
return new Index(name, <any>undefined, { urn })
default:
throw new Error(`unknown resource type ${type}`);
}
},
};
pulumi.runtime.registerResourceModule("dockerbuild", "index", _module)
pulumi.runtime.registerResourcePackage("dockerbuild", {
pulumi.runtime.registerResourceModule("docker-build", "index", _module)
pulumi.runtime.registerResourcePackage("docker-build", {
version: utilities.getVersion(),
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
if (type !== "pulumi:providers:dockerbuild") {
if (type !== "pulumi:providers:docker-build") {
throw new Error(`unknown provider type ${type}`);
}
return new Provider(name, <any>undefined, { urn });

196
sdk/nodejs/index_.ts generated Normal file
View File

@@ -0,0 +1,196 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as enums from "./types/enums";
import * as utilities from "./utilities";
/**
* A wrapper around `docker buildx imagetools create` to create an index
* (or manifest list) referencing one or more existing 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.
*
* 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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as docker_build from "@pulumi/docker-build";
*
* const amd64 = new docker_build.Image("amd64", {
* cacheFrom: [{
* registry: {
* ref: "docker.io/pulumi/pulumi:cache-amd64",
* },
* }],
* cacheTo: [{
* registry: {
* mode: docker_build.CacheMode.Max,
* ref: "docker.io/pulumi/pulumi:cache-amd64",
* },
* }],
* context: {
* location: "app",
* },
* platforms: [docker_build.Platform.Linux_amd64],
* tags: ["docker.io/pulumi/pulumi:3.107.0-amd64"],
* });
* const arm64 = new docker_build.Image("arm64", {
* cacheFrom: [{
* registry: {
* ref: "docker.io/pulumi/pulumi:cache-arm64",
* },
* }],
* cacheTo: [{
* registry: {
* mode: docker_build.CacheMode.Max,
* ref: "docker.io/pulumi/pulumi:cache-arm64",
* },
* }],
* context: {
* location: "app",
* },
* platforms: [docker_build.Platform.Linux_arm64],
* tags: ["docker.io/pulumi/pulumi:3.107.0-arm64"],
* });
* const index = new docker_build.Index("index", {
* sources: [
* amd64.ref,
* arm64.ref,
* ],
* tag: "docker.io/pulumi/pulumi:3.107.0",
* });
* export const ref = index.ref;
* ```
*/
export class Index extends pulumi.CustomResource {
/**
* Get an existing Index resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Index {
return new Index(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'docker-build:index:Index';
/**
* Returns true if the given object is an instance of Index. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Index {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Index.__pulumiType;
}
/**
* If true, push the index to the target registry.
*
* Defaults to `true`.
*/
public readonly push!: pulumi.Output<boolean | undefined>;
/**
* The pushed tag with digest.
*
* Identical to the tag if the index was not pushed.
*/
public /*out*/ readonly ref!: pulumi.Output<string>;
/**
* Authentication for the registry where the tagged index will be pushed.
*
* Credentials can also be included with the provider's configuration.
*/
public readonly registry!: pulumi.Output<outputs.Registry | undefined>;
/**
* Existing images to include in the index.
*/
public readonly sources!: pulumi.Output<string[]>;
/**
* The tag to apply to the index.
*/
public readonly tag!: pulumi.Output<string>;
/**
* Create a Index resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: IndexArgs, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.sources === undefined) && !opts.urn) {
throw new Error("Missing required property 'sources'");
}
if ((!args || args.tag === undefined) && !opts.urn) {
throw new Error("Missing required property 'tag'");
}
resourceInputs["push"] = (args ? args.push : undefined) ?? true;
resourceInputs["registry"] = args ? args.registry : undefined;
resourceInputs["sources"] = args ? args.sources : undefined;
resourceInputs["tag"] = args ? args.tag : undefined;
resourceInputs["ref"] = undefined /*out*/;
} else {
resourceInputs["push"] = undefined /*out*/;
resourceInputs["ref"] = undefined /*out*/;
resourceInputs["registry"] = undefined /*out*/;
resourceInputs["sources"] = undefined /*out*/;
resourceInputs["tag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Index.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Index resource.
*/
export interface IndexArgs {
/**
* If true, push the index to the target registry.
*
* Defaults to `true`.
*/
push?: pulumi.Input<boolean>;
/**
* Authentication for the registry where the tagged index will be pushed.
*
* Credentials can also be included with the provider's configuration.
*/
registry?: pulumi.Input<inputs.RegistryArgs>;
/**
* Existing images to include in the index.
*/
sources: pulumi.Input<pulumi.Input<string>[]>;
/**
* The tag to apply to the index.
*/
tag: pulumi.Input<string>;
}

View File

@@ -1,11 +1,15 @@
{
"name": "@pulumi/dockerbuild",
"name": "@pulumi/docker-build",
"version": "${VERSION}",
"keywords": [
"keywords"
"docker",
"buildkit",
"buildx",
"kind/native"
],
"homepage": "pulumi.com",
"repository": "https://github.com/pulumi/pulumi-dockerbuild",
"homepage": "https://pulumi.com",
"repository": "https://github.com/pulumi/pulumi-docker-build",
"license": "Apache-2.0",
"scripts": {
"build": "tsc"
},
@@ -18,7 +22,6 @@
},
"pulumi": {
"resource": true,
"name": "dockerbuild",
"server": "github.com/pulumi/pulumi-dockerbuild"
"name": "docker-build"
}
}

16
sdk/nodejs/provider.ts generated
View File

@@ -2,11 +2,14 @@
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as enums from "./types/enums";
import * as utilities from "./utilities";
export class Provider extends pulumi.ProviderResource {
/** @internal */
public static readonly __pulumiType = 'dockerbuild';
public static readonly __pulumiType = 'docker-build';
/**
* Returns true if the given object is an instance of Provider. This is designed to work even
@@ -19,6 +22,10 @@ export class Provider extends pulumi.ProviderResource {
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
}
/**
* The build daemon's address.
*/
public readonly host!: pulumi.Output<string | undefined>;
/**
* Create a Provider resource with the given unique name, arguments, and options.
@@ -31,6 +38,8 @@ export class Provider extends pulumi.ProviderResource {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
{
resourceInputs["host"] = (args ? args.host : undefined) ?? (utilities.getEnv("DOCKER_HOST") || "");
resourceInputs["registries"] = pulumi.output(args ? args.registries : undefined).apply(JSON.stringify);
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Provider.__pulumiType, name, resourceInputs, opts);
@@ -41,4 +50,9 @@ export class Provider extends pulumi.ProviderResource {
* The set of arguments for constructing a Provider resource.
*/
export interface ProviderArgs {
/**
* The build daemon's address.
*/
host?: pulumi.Input<string>;
registries?: pulumi.Input<pulumi.Input<inputs.RegistryArgs>[]>;
}

67
sdk/nodejs/random.ts generated
View File

@@ -1,67 +0,0 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
export class Random extends pulumi.CustomResource {
/**
* Get an existing Random resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Random {
return new Random(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'dockerbuild:index:Random';
/**
* Returns true if the given object is an instance of Random. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Random {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Random.__pulumiType;
}
public readonly length!: pulumi.Output<number>;
public /*out*/ readonly result!: pulumi.Output<string>;
/**
* Create a Random resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: RandomArgs, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.length === undefined) && !opts.urn) {
throw new Error("Missing required property 'length'");
}
resourceInputs["length"] = args ? args.length : undefined;
resourceInputs["result"] = undefined /*out*/;
} else {
resourceInputs["length"] = undefined /*out*/;
resourceInputs["result"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Random.__pulumiType, name, resourceInputs, opts);
}
}
/**
* The set of arguments for constructing a Random resource.
*/
export interface RandomArgs {
length: pulumi.Input<number>;
}

View File

@@ -13,9 +13,16 @@
"strict": true
},
"files": [
"config/index.ts",
"config/vars.ts",
"image.ts",
"index.ts",
"index_.ts",
"provider.ts",
"random.ts",
"types/enums/index.ts",
"types/index.ts",
"types/input.ts",
"types/output.ts",
"utilities.ts"
]
}

83
sdk/nodejs/types/enums/index.ts generated Normal file
View File

@@ -0,0 +1,83 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
export const CacheMode = {
/**
* Only layers that are exported into the resulting image are cached.
*/
Min: "min",
/**
* All layers are cached, even those of intermediate steps.
*/
Max: "max",
} as const;
export type CacheMode = (typeof CacheMode)[keyof typeof CacheMode];
export const CompressionType = {
/**
* Use `gzip` for compression.
*/
Gzip: "gzip",
/**
* Use `estargz` for compression.
*/
Estargz: "estargz",
/**
* Use `zstd` for compression.
*/
Zstd: "zstd",
} as const;
export type CompressionType = (typeof CompressionType)[keyof typeof CompressionType];
export const NetworkMode = {
/**
* The default sandbox network mode.
*/
Default: "default",
/**
* Host network mode.
*/
Host: "host",
/**
* Disable network access.
*/
None: "none",
} as const;
export type NetworkMode = (typeof NetworkMode)[keyof typeof NetworkMode];
export const Platform = {
Darwin_386: "darwin/386",
Darwin_amd64: "darwin/amd64",
Darwin_arm: "darwin/arm",
Darwin_arm64: "darwin/arm64",
Dragonfly_amd64: "dragonfly/amd64",
Freebsd_386: "freebsd/386",
Freebsd_amd64: "freebsd/amd64",
Freebsd_arm: "freebsd/arm",
Linux_386: "linux/386",
Linux_amd64: "linux/amd64",
Linux_arm: "linux/arm",
Linux_arm64: "linux/arm64",
Linux_mips64: "linux/mips64",
Linux_mips64le: "linux/mips64le",
Linux_ppc64le: "linux/ppc64le",
Linux_riscv64: "linux/riscv64",
Linux_s390x: "linux/s390x",
Netbsd_386: "netbsd/386",
Netbsd_amd64: "netbsd/amd64",
Netbsd_arm: "netbsd/arm",
Openbsd_386: "openbsd/386",
Openbsd_amd64: "openbsd/amd64",
Openbsd_arm: "openbsd/arm",
Plan9_386: "plan9/386",
Plan9_amd64: "plan9/amd64",
Solaris_amd64: "solaris/amd64",
Windows_386: "windows/386",
Windows_amd64: "windows/amd64",
} as const;
export type Platform = (typeof Platform)[keyof typeof Platform];

15
sdk/nodejs/types/index.ts generated Normal file
View File

@@ -0,0 +1,15 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as utilities from "../utilities";
// Export sub-modules:
import * as enums from "./enums";
import * as input from "./input";
import * as output from "./output";
export {
enums,
input,
output,
};

908
sdk/nodejs/types/input.ts generated Normal file
View File

@@ -0,0 +1,908 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as enums from "../types/enums";
import * as utilities from "../utilities";
export interface BuildContextArgs {
/**
* Resources to use for build context.
*
* The location can be:
* * A relative or absolute path to a local directory (`.`, `./app`,
* `/app`, etc.).
* * A remote URL of a Git repository, tarball, or plain text file
* (`https://github.com/user/myrepo.git`, `http://server/context.tar.gz`,
* etc.).
*/
location: pulumi.Input<string>;
/**
* Additional build contexts to use.
*
* These contexts are accessed with `FROM name` or `--from=name`
* statements when using Dockerfile 1.4+ syntax.
*
* Values can be local paths, HTTP URLs, or `docker-image://` images.
*/
named?: pulumi.Input<{[key: string]: pulumi.Input<inputs.ContextArgs>}>;
}
export interface BuilderConfigArgs {
/**
* Name of an existing buildx builder to use.
*
* Only `docker-container`, `kubernetes`, or `remote` drivers are
* supported. The legacy `docker` driver is not supported.
*
* Equivalent to Docker's `--builder` flag.
*/
name?: pulumi.Input<string>;
}
export interface CacheFromArgs {
/**
* Upload build caches to Azure's blob storage service.
*/
azblob?: pulumi.Input<inputs.CacheFromAzureBlobArgs>;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: pulumi.Input<boolean>;
/**
* Recommended for use with GitHub Actions workflows.
*
* An action like `crazy-max/ghaction-github-runtime` is recommended to
* expose appropriate credentials to your GitHub workflow.
*/
gha?: pulumi.Input<inputs.CacheFromGitHubActionsArgs>;
/**
* A simple backend which caches images on your local filesystem.
*/
local?: pulumi.Input<inputs.CacheFromLocalArgs>;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=inline`).
*/
raw?: pulumi.Input<string>;
/**
* Upload build caches to remote registries.
*/
registry?: pulumi.Input<inputs.CacheFromRegistryArgs>;
/**
* Upload build caches to AWS S3 or an S3-compatible services such as
* MinIO.
*/
s3?: pulumi.Input<inputs.CacheFromS3Args>;
}
/**
* cacheFromArgsProvideDefaults sets the appropriate defaults for CacheFromArgs
*/
export function cacheFromArgsProvideDefaults(val: CacheFromArgs): CacheFromArgs {
return {
...val,
gha: (val.gha ? pulumi.output(val.gha).apply(inputs.cacheFromGitHubActionsArgsProvideDefaults) : undefined),
s3: (val.s3 ? pulumi.output(val.s3).apply(inputs.cacheFromS3ArgsProvideDefaults) : undefined),
};
}
export interface CacheFromAzureBlobArgs {
/**
* Base URL of the storage account.
*/
accountUrl?: pulumi.Input<string>;
/**
* The name of the cache image.
*/
name: pulumi.Input<string>;
/**
* Blob storage account key.
*/
secretAccessKey?: pulumi.Input<string>;
}
export interface CacheFromGitHubActionsArgs {
/**
* The scope to use for cache keys. Defaults to `buildkit`.
*
* This should be set if building and caching multiple images in one
* workflow, otherwise caches will overwrite each other.
*/
scope?: pulumi.Input<string>;
/**
* The GitHub Actions token to use. This is not a personal access tokens
* and is typically generated automatically as part of each job.
*
* Defaults to `$ACTIONS_RUNTIME_TOKEN`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
token?: pulumi.Input<string>;
/**
* The cache server URL to use for artifacts.
*
* Defaults to `$ACTIONS_RUNTIME_URL`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
url?: pulumi.Input<string>;
}
/**
* cacheFromGitHubActionsArgsProvideDefaults sets the appropriate defaults for CacheFromGitHubActionsArgs
*/
export function cacheFromGitHubActionsArgsProvideDefaults(val: CacheFromGitHubActionsArgs): CacheFromGitHubActionsArgs {
return {
...val,
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_RUNTIME_URL") || ""),
};
}
export interface CacheFromLocalArgs {
/**
* Digest of manifest to import.
*/
digest?: pulumi.Input<string>;
/**
* Path of the local directory where cache gets imported from.
*/
src: pulumi.Input<string>;
}
export interface CacheFromRegistryArgs {
/**
* Fully qualified name of the cache image to import.
*/
ref: pulumi.Input<string>;
}
export interface CacheFromS3Args {
/**
* Defaults to `$AWS_ACCESS_KEY_ID`.
*/
accessKeyId?: pulumi.Input<string>;
/**
* Prefix to prepend to blob filenames.
*/
blobsPrefix?: pulumi.Input<string>;
/**
* Name of the S3 bucket.
*/
bucket: pulumi.Input<string>;
/**
* Endpoint of the S3 bucket.
*/
endpointUrl?: pulumi.Input<string>;
/**
* Prefix to prepend on manifest filenames.
*/
manifestsPrefix?: pulumi.Input<string>;
/**
* Name of the cache image.
*/
name?: pulumi.Input<string>;
/**
* The geographic location of the bucket. Defaults to `$AWS_REGION`.
*/
region: pulumi.Input<string>;
/**
* Defaults to `$AWS_SECRET_ACCESS_KEY`.
*/
secretAccessKey?: pulumi.Input<string>;
/**
* Defaults to `$AWS_SESSION_TOKEN`.
*/
sessionToken?: pulumi.Input<string>;
/**
* Uses `bucket` in the URL instead of hostname when `true`.
*/
usePathStyle?: pulumi.Input<boolean>;
}
/**
* cacheFromS3ArgsProvideDefaults sets the appropriate defaults for CacheFromS3Args
*/
export function cacheFromS3ArgsProvideDefaults(val: CacheFromS3Args): CacheFromS3Args {
return {
...val,
accessKeyId: (val.accessKeyId) ?? (utilities.getEnv("AWS_ACCESS_KEY_ID") || ""),
region: (val.region) ?? (utilities.getEnv("AWS_REGION") || ""),
secretAccessKey: (val.secretAccessKey) ?? (utilities.getEnv("AWS_SECRET_ACCESS_KEY") || ""),
sessionToken: (val.sessionToken) ?? (utilities.getEnv("AWS_SESSION_TOKEN") || ""),
};
}
export interface CacheToArgs {
/**
* Push cache to Azure's blob storage service.
*/
azblob?: pulumi.Input<inputs.CacheToAzureBlobArgs>;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: pulumi.Input<boolean>;
/**
* Recommended for use with GitHub Actions workflows.
*
* An action like `crazy-max/ghaction-github-runtime` is recommended to
* expose appropriate credentials to your GitHub workflow.
*/
gha?: pulumi.Input<inputs.CacheToGitHubActionsArgs>;
/**
* The inline cache storage backend is the simplest implementation to get
* started with, but it does not handle multi-stage builds. Consider the
* `registry` cache backend instead.
*/
inline?: pulumi.Input<inputs.CacheToInlineArgs>;
/**
* A simple backend which caches imagines on your local filesystem.
*/
local?: pulumi.Input<inputs.CacheToLocalArgs>;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=inline`)
*/
raw?: pulumi.Input<string>;
/**
* Push caches to remote registries. Incompatible with the `docker` build
* driver.
*/
registry?: pulumi.Input<inputs.CacheToRegistryArgs>;
/**
* Push cache to AWS S3 or S3-compatible services such as MinIO.
*/
s3?: pulumi.Input<inputs.CacheToS3Args>;
}
/**
* cacheToArgsProvideDefaults sets the appropriate defaults for CacheToArgs
*/
export function cacheToArgsProvideDefaults(val: CacheToArgs): CacheToArgs {
return {
...val,
azblob: (val.azblob ? pulumi.output(val.azblob).apply(inputs.cacheToAzureBlobArgsProvideDefaults) : undefined),
gha: (val.gha ? pulumi.output(val.gha).apply(inputs.cacheToGitHubActionsArgsProvideDefaults) : undefined),
local: (val.local ? pulumi.output(val.local).apply(inputs.cacheToLocalArgsProvideDefaults) : undefined),
registry: (val.registry ? pulumi.output(val.registry).apply(inputs.cacheToRegistryArgsProvideDefaults) : undefined),
s3: (val.s3 ? pulumi.output(val.s3).apply(inputs.cacheToS3ArgsProvideDefaults) : undefined),
};
}
export interface CacheToAzureBlobArgs {
/**
* Base URL of the storage account.
*/
accountUrl?: pulumi.Input<string>;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: pulumi.Input<boolean>;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: pulumi.Input<enums.CacheMode>;
/**
* The name of the cache image.
*/
name: pulumi.Input<string>;
/**
* Blob storage account key.
*/
secretAccessKey?: pulumi.Input<string>;
}
/**
* cacheToAzureBlobArgsProvideDefaults sets the appropriate defaults for CacheToAzureBlobArgs
*/
export function cacheToAzureBlobArgsProvideDefaults(val: CacheToAzureBlobArgs): CacheToAzureBlobArgs {
return {
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
};
}
export interface CacheToGitHubActionsArgs {
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: pulumi.Input<boolean>;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: pulumi.Input<enums.CacheMode>;
/**
* The scope to use for cache keys. Defaults to `buildkit`.
*
* This should be set if building and caching multiple images in one
* workflow, otherwise caches will overwrite each other.
*/
scope?: pulumi.Input<string>;
/**
* The GitHub Actions token to use. This is not a personal access tokens
* and is typically generated automatically as part of each job.
*
* Defaults to `$ACTIONS_RUNTIME_TOKEN`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
token?: pulumi.Input<string>;
/**
* The cache server URL to use for artifacts.
*
* Defaults to `$ACTIONS_RUNTIME_URL`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
url?: pulumi.Input<string>;
}
/**
* cacheToGitHubActionsArgsProvideDefaults sets the appropriate defaults for CacheToGitHubActionsArgs
*/
export function cacheToGitHubActionsArgsProvideDefaults(val: CacheToGitHubActionsArgs): CacheToGitHubActionsArgs {
return {
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_RUNTIME_URL") || ""),
};
}
/**
* Include an inline cache with the exported image.
*/
export interface CacheToInlineArgs {
}
export interface CacheToLocalArgs {
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* Path of the local directory to export the cache.
*/
dest: pulumi.Input<string>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: pulumi.Input<boolean>;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: pulumi.Input<enums.CacheMode>;
}
/**
* cacheToLocalArgsProvideDefaults sets the appropriate defaults for CacheToLocalArgs
*/
export function cacheToLocalArgsProvideDefaults(val: CacheToLocalArgs): CacheToLocalArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
};
}
export interface CacheToRegistryArgs {
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: pulumi.Input<boolean>;
/**
* Export cache manifest as an OCI-compatible image manifest instead of a
* manifest list. Requires `ociMediaTypes` to also be `true`.
*
* Some registries like AWS ECR will not work with caching if this is
* `false`.
*
* Defaults to `false` to match Docker's default behavior.
*/
imageManifest?: pulumi.Input<boolean>;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: pulumi.Input<enums.CacheMode>;
/**
* Whether to use OCI media types in exported manifests. Defaults to
* `true`.
*/
ociMediaTypes?: pulumi.Input<boolean>;
/**
* Fully qualified name of the cache image to import.
*/
ref: pulumi.Input<string>;
}
/**
* cacheToRegistryArgsProvideDefaults sets the appropriate defaults for CacheToRegistryArgs
*/
export function cacheToRegistryArgsProvideDefaults(val: CacheToRegistryArgs): CacheToRegistryArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ignoreError: (val.ignoreError) ?? false,
imageManifest: (val.imageManifest) ?? false,
mode: (val.mode) ?? "min",
ociMediaTypes: (val.ociMediaTypes) ?? true,
};
}
export interface CacheToS3Args {
/**
* Defaults to `$AWS_ACCESS_KEY_ID`.
*/
accessKeyId?: pulumi.Input<string>;
/**
* Prefix to prepend to blob filenames.
*/
blobsPrefix?: pulumi.Input<string>;
/**
* Name of the S3 bucket.
*/
bucket: pulumi.Input<string>;
/**
* Endpoint of the S3 bucket.
*/
endpointUrl?: pulumi.Input<string>;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: pulumi.Input<boolean>;
/**
* Prefix to prepend on manifest filenames.
*/
manifestsPrefix?: pulumi.Input<string>;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: pulumi.Input<enums.CacheMode>;
/**
* Name of the cache image.
*/
name?: pulumi.Input<string>;
/**
* The geographic location of the bucket. Defaults to `$AWS_REGION`.
*/
region: pulumi.Input<string>;
/**
* Defaults to `$AWS_SECRET_ACCESS_KEY`.
*/
secretAccessKey?: pulumi.Input<string>;
/**
* Defaults to `$AWS_SESSION_TOKEN`.
*/
sessionToken?: pulumi.Input<string>;
/**
* Uses `bucket` in the URL instead of hostname when `true`.
*/
usePathStyle?: pulumi.Input<boolean>;
}
/**
* cacheToS3ArgsProvideDefaults sets the appropriate defaults for CacheToS3Args
*/
export function cacheToS3ArgsProvideDefaults(val: CacheToS3Args): CacheToS3Args {
return {
...val,
accessKeyId: (val.accessKeyId) ?? (utilities.getEnv("AWS_ACCESS_KEY_ID") || ""),
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
region: (val.region) ?? (utilities.getEnv("AWS_REGION") || ""),
secretAccessKey: (val.secretAccessKey) ?? (utilities.getEnv("AWS_SECRET_ACCESS_KEY") || ""),
sessionToken: (val.sessionToken) ?? (utilities.getEnv("AWS_SESSION_TOKEN") || ""),
};
}
export interface ContextArgs {
/**
* Resources to use for build context.
*
* The location can be:
* * A relative or absolute path to a local directory (`.`, `./app`,
* `/app`, etc.).
* * A remote URL of a Git repository, tarball, or plain text file
* (`https://github.com/user/myrepo.git`, `http://server/context.tar.gz`,
* etc.).
*/
location: pulumi.Input<string>;
}
export interface DockerfileArgs {
/**
* Raw Dockerfile contents.
*
* Conflicts with `location`.
*
* Equivalent to invoking Docker with `-f -`.
*/
inline?: pulumi.Input<string>;
/**
* Location of the Dockerfile to use.
*
* Can be a relative or absolute path to a local file, or a remote URL.
*
* Defaults to `${context.location}/Dockerfile` if context is on-disk.
*
* Conflicts with `inline`.
*/
location?: pulumi.Input<string>;
}
export interface ExportArgs {
/**
* A no-op export. Helpful for silencing the 'no exports' warning if you
* just want to populate caches.
*/
cacheonly?: pulumi.Input<inputs.ExportCacheOnlyArgs>;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: pulumi.Input<boolean>;
/**
* Export as a Docker image layout.
*/
docker?: pulumi.Input<inputs.ExportDockerArgs>;
/**
* Outputs the build result into a container image format.
*/
image?: pulumi.Input<inputs.ExportImageArgs>;
/**
* Export to a local directory as files and directories.
*/
local?: pulumi.Input<inputs.ExportLocalArgs>;
/**
* Identical to the Docker exporter but uses OCI media types by default.
*/
oci?: pulumi.Input<inputs.ExportOCIArgs>;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=docker`)
*/
raw?: pulumi.Input<string>;
/**
* Identical to the Image exporter, but pushes by default.
*/
registry?: pulumi.Input<inputs.ExportRegistryArgs>;
/**
* Export to a local directory as a tarball.
*/
tar?: pulumi.Input<inputs.ExportTarArgs>;
}
/**
* exportArgsProvideDefaults sets the appropriate defaults for ExportArgs
*/
export function exportArgsProvideDefaults(val: ExportArgs): ExportArgs {
return {
...val,
docker: (val.docker ? pulumi.output(val.docker).apply(inputs.exportDockerArgsProvideDefaults) : undefined),
image: (val.image ? pulumi.output(val.image).apply(inputs.exportImageArgsProvideDefaults) : undefined),
oci: (val.oci ? pulumi.output(val.oci).apply(inputs.exportOCIArgsProvideDefaults) : undefined),
registry: (val.registry ? pulumi.output(val.registry).apply(inputs.exportRegistryArgsProvideDefaults) : undefined),
};
}
export interface ExportCacheOnlyArgs {
}
export interface ExportDockerArgs {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* The local export path.
*/
dest?: pulumi.Input<string>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: pulumi.Input<boolean>;
/**
* Bundle the output into a tarball layout.
*/
tar?: pulumi.Input<boolean>;
}
/**
* exportDockerArgsProvideDefaults sets the appropriate defaults for ExportDockerArgs
*/
export function exportDockerArgsProvideDefaults(val: ExportDockerArgs): ExportDockerArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
tar: (val.tar) ?? true,
};
}
export interface ExportImageArgs {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* Name image with `prefix@<digest>`, used for anonymous images.
*/
danglingNamePrefix?: pulumi.Input<string>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Allow pushing to an insecure registry.
*/
insecure?: pulumi.Input<boolean>;
/**
* Add additional canonical name (`name@<digest>`).
*/
nameCanonical?: pulumi.Input<boolean>;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: pulumi.Input<boolean>;
/**
* Push after creating the image. Defaults to `false`.
*/
push?: pulumi.Input<boolean>;
/**
* Push image without name.
*/
pushByDigest?: pulumi.Input<boolean>;
/**
* Store resulting images to the worker's image store and ensure all of
* its blobs are in the content store.
*
* Defaults to `true`.
*
* Ignored if the worker doesn't have image store (when using OCI workers,
* for example).
*/
store?: pulumi.Input<boolean>;
/**
* Unpack image after creation (for use with containerd). Defaults to
* `false`.
*/
unpack?: pulumi.Input<boolean>;
}
/**
* exportImageArgsProvideDefaults sets the appropriate defaults for ExportImageArgs
*/
export function exportImageArgsProvideDefaults(val: ExportImageArgs): ExportImageArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
store: (val.store) ?? true,
};
}
export interface ExportLocalArgs {
/**
* Output path.
*/
dest: pulumi.Input<string>;
}
export interface ExportOCIArgs {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* The local export path.
*/
dest?: pulumi.Input<string>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: pulumi.Input<boolean>;
/**
* Bundle the output into a tarball layout.
*/
tar?: pulumi.Input<boolean>;
}
/**
* exportOCIArgsProvideDefaults sets the appropriate defaults for ExportOCIArgs
*/
export function exportOCIArgsProvideDefaults(val: ExportOCIArgs): ExportOCIArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? true,
tar: (val.tar) ?? true,
};
}
export interface ExportRegistryArgs {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* The compression type to use.
*/
compression?: pulumi.Input<enums.CompressionType>;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: pulumi.Input<number>;
/**
* Name image with `prefix@<digest>`, used for anonymous images.
*/
danglingNamePrefix?: pulumi.Input<string>;
/**
* Forcefully apply compression.
*/
forceCompression?: pulumi.Input<boolean>;
/**
* Allow pushing to an insecure registry.
*/
insecure?: pulumi.Input<boolean>;
/**
* Add additional canonical name (`name@<digest>`).
*/
nameCanonical?: pulumi.Input<boolean>;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: pulumi.Input<boolean>;
/**
* Push after creating the image. Defaults to `true`.
*/
push?: pulumi.Input<boolean>;
/**
* Push image without name.
*/
pushByDigest?: pulumi.Input<boolean>;
/**
* Store resulting images to the worker's image store and ensure all of
* its blobs are in the content store.
*
* Defaults to `true`.
*
* Ignored if the worker doesn't have image store (when using OCI workers,
* for example).
*/
store?: pulumi.Input<boolean>;
/**
* Unpack image after creation (for use with containerd). Defaults to
* `false`.
*/
unpack?: pulumi.Input<boolean>;
}
/**
* exportRegistryArgsProvideDefaults sets the appropriate defaults for ExportRegistryArgs
*/
export function exportRegistryArgsProvideDefaults(val: ExportRegistryArgs): ExportRegistryArgs {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
push: (val.push) ?? true,
store: (val.store) ?? true,
};
}
export interface ExportTarArgs {
/**
* Output path.
*/
dest: pulumi.Input<string>;
}
export interface RegistryArgs {
/**
* The registry's address (e.g. "docker.io").
*/
address: pulumi.Input<string>;
/**
* Password or token for the registry.
*/
password?: pulumi.Input<string>;
/**
* Username for the registry.
*/
username?: pulumi.Input<string>;
}
export interface SSHArgs {
/**
* Useful for distinguishing different servers that are part of the same
* build.
*
* A value of `default` is appropriate if only dealing with a single host.
*/
id: pulumi.Input<string>;
/**
* SSH agent socket or private keys to expose to the build under the given
* identifier.
*
* Defaults to `[$SSH_AUTH_SOCK]`.
*
* Note that your keys are **not** automatically added when using an
* agent. Run `ssh-add -l` locally to confirm which public keys are
* visible to the agent; these will be exposed to your build.
*/
paths?: pulumi.Input<pulumi.Input<string>[]>;
}

909
sdk/nodejs/types/output.ts generated Normal file
View File

@@ -0,0 +1,909 @@
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as enums from "../types/enums";
import * as utilities from "../utilities";
export interface BuildContext {
/**
* Resources to use for build context.
*
* The location can be:
* * A relative or absolute path to a local directory (`.`, `./app`,
* `/app`, etc.).
* * A remote URL of a Git repository, tarball, or plain text file
* (`https://github.com/user/myrepo.git`, `http://server/context.tar.gz`,
* etc.).
*/
location: string;
/**
* Additional build contexts to use.
*
* These contexts are accessed with `FROM name` or `--from=name`
* statements when using Dockerfile 1.4+ syntax.
*
* Values can be local paths, HTTP URLs, or `docker-image://` images.
*/
named?: {[key: string]: outputs.Context};
}
export interface BuilderConfig {
/**
* Name of an existing buildx builder to use.
*
* Only `docker-container`, `kubernetes`, or `remote` drivers are
* supported. The legacy `docker` driver is not supported.
*
* Equivalent to Docker's `--builder` flag.
*/
name?: string;
}
export interface CacheFrom {
/**
* Upload build caches to Azure's blob storage service.
*/
azblob?: outputs.CacheFromAzureBlob;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: boolean;
/**
* Recommended for use with GitHub Actions workflows.
*
* An action like `crazy-max/ghaction-github-runtime` is recommended to
* expose appropriate credentials to your GitHub workflow.
*/
gha?: outputs.CacheFromGitHubActions;
/**
* A simple backend which caches images on your local filesystem.
*/
local?: outputs.CacheFromLocal;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=inline`).
*/
raw?: string;
/**
* Upload build caches to remote registries.
*/
registry?: outputs.CacheFromRegistry;
/**
* Upload build caches to AWS S3 or an S3-compatible services such as
* MinIO.
*/
s3?: outputs.CacheFromS3;
}
/**
* cacheFromProvideDefaults sets the appropriate defaults for CacheFrom
*/
export function cacheFromProvideDefaults(val: CacheFrom): CacheFrom {
return {
...val,
gha: (val.gha ? outputs.cacheFromGitHubActionsProvideDefaults(val.gha) : undefined),
s3: (val.s3 ? outputs.cacheFromS3ProvideDefaults(val.s3) : undefined),
};
}
export interface CacheFromAzureBlob {
/**
* Base URL of the storage account.
*/
accountUrl?: string;
/**
* The name of the cache image.
*/
name: string;
/**
* Blob storage account key.
*/
secretAccessKey?: string;
}
export interface CacheFromGitHubActions {
/**
* The scope to use for cache keys. Defaults to `buildkit`.
*
* This should be set if building and caching multiple images in one
* workflow, otherwise caches will overwrite each other.
*/
scope?: string;
/**
* The GitHub Actions token to use. This is not a personal access tokens
* and is typically generated automatically as part of each job.
*
* Defaults to `$ACTIONS_RUNTIME_TOKEN`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
token?: string;
/**
* The cache server URL to use for artifacts.
*
* Defaults to `$ACTIONS_RUNTIME_URL`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
url?: string;
}
/**
* cacheFromGitHubActionsProvideDefaults sets the appropriate defaults for CacheFromGitHubActions
*/
export function cacheFromGitHubActionsProvideDefaults(val: CacheFromGitHubActions): CacheFromGitHubActions {
return {
...val,
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_RUNTIME_URL") || ""),
};
}
export interface CacheFromLocal {
/**
* Digest of manifest to import.
*/
digest?: string;
/**
* Path of the local directory where cache gets imported from.
*/
src: string;
}
export interface CacheFromRegistry {
/**
* Fully qualified name of the cache image to import.
*/
ref: string;
}
export interface CacheFromS3 {
/**
* Defaults to `$AWS_ACCESS_KEY_ID`.
*/
accessKeyId?: string;
/**
* Prefix to prepend to blob filenames.
*/
blobsPrefix?: string;
/**
* Name of the S3 bucket.
*/
bucket: string;
/**
* Endpoint of the S3 bucket.
*/
endpointUrl?: string;
/**
* Prefix to prepend on manifest filenames.
*/
manifestsPrefix?: string;
/**
* Name of the cache image.
*/
name?: string;
/**
* The geographic location of the bucket. Defaults to `$AWS_REGION`.
*/
region: string;
/**
* Defaults to `$AWS_SECRET_ACCESS_KEY`.
*/
secretAccessKey?: string;
/**
* Defaults to `$AWS_SESSION_TOKEN`.
*/
sessionToken?: string;
/**
* Uses `bucket` in the URL instead of hostname when `true`.
*/
usePathStyle?: boolean;
}
/**
* cacheFromS3ProvideDefaults sets the appropriate defaults for CacheFromS3
*/
export function cacheFromS3ProvideDefaults(val: CacheFromS3): CacheFromS3 {
return {
...val,
accessKeyId: (val.accessKeyId) ?? (utilities.getEnv("AWS_ACCESS_KEY_ID") || ""),
region: (val.region) ?? (utilities.getEnv("AWS_REGION") || ""),
secretAccessKey: (val.secretAccessKey) ?? (utilities.getEnv("AWS_SECRET_ACCESS_KEY") || ""),
sessionToken: (val.sessionToken) ?? (utilities.getEnv("AWS_SESSION_TOKEN") || ""),
};
}
export interface CacheTo {
/**
* Push cache to Azure's blob storage service.
*/
azblob?: outputs.CacheToAzureBlob;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: boolean;
/**
* Recommended for use with GitHub Actions workflows.
*
* An action like `crazy-max/ghaction-github-runtime` is recommended to
* expose appropriate credentials to your GitHub workflow.
*/
gha?: outputs.CacheToGitHubActions;
/**
* The inline cache storage backend is the simplest implementation to get
* started with, but it does not handle multi-stage builds. Consider the
* `registry` cache backend instead.
*/
inline?: outputs.CacheToInline;
/**
* A simple backend which caches imagines on your local filesystem.
*/
local?: outputs.CacheToLocal;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=inline`)
*/
raw?: string;
/**
* Push caches to remote registries. Incompatible with the `docker` build
* driver.
*/
registry?: outputs.CacheToRegistry;
/**
* Push cache to AWS S3 or S3-compatible services such as MinIO.
*/
s3?: outputs.CacheToS3;
}
/**
* cacheToProvideDefaults sets the appropriate defaults for CacheTo
*/
export function cacheToProvideDefaults(val: CacheTo): CacheTo {
return {
...val,
azblob: (val.azblob ? outputs.cacheToAzureBlobProvideDefaults(val.azblob) : undefined),
gha: (val.gha ? outputs.cacheToGitHubActionsProvideDefaults(val.gha) : undefined),
local: (val.local ? outputs.cacheToLocalProvideDefaults(val.local) : undefined),
registry: (val.registry ? outputs.cacheToRegistryProvideDefaults(val.registry) : undefined),
s3: (val.s3 ? outputs.cacheToS3ProvideDefaults(val.s3) : undefined),
};
}
export interface CacheToAzureBlob {
/**
* Base URL of the storage account.
*/
accountUrl?: string;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: boolean;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: enums.CacheMode;
/**
* The name of the cache image.
*/
name: string;
/**
* Blob storage account key.
*/
secretAccessKey?: string;
}
/**
* cacheToAzureBlobProvideDefaults sets the appropriate defaults for CacheToAzureBlob
*/
export function cacheToAzureBlobProvideDefaults(val: CacheToAzureBlob): CacheToAzureBlob {
return {
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
};
}
export interface CacheToGitHubActions {
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: boolean;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: enums.CacheMode;
/**
* The scope to use for cache keys. Defaults to `buildkit`.
*
* This should be set if building and caching multiple images in one
* workflow, otherwise caches will overwrite each other.
*/
scope?: string;
/**
* The GitHub Actions token to use. This is not a personal access tokens
* and is typically generated automatically as part of each job.
*
* Defaults to `$ACTIONS_RUNTIME_TOKEN`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
token?: string;
/**
* The cache server URL to use for artifacts.
*
* Defaults to `$ACTIONS_RUNTIME_URL`, although a separate action like
* `crazy-max/ghaction-github-runtime` is recommended to expose this
* environment variable to your jobs.
*/
url?: string;
}
/**
* cacheToGitHubActionsProvideDefaults sets the appropriate defaults for CacheToGitHubActions
*/
export function cacheToGitHubActionsProvideDefaults(val: CacheToGitHubActions): CacheToGitHubActions {
return {
...val,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
scope: (val.scope) ?? (utilities.getEnv("buildkit") || ""),
token: (val.token) ?? (utilities.getEnv("ACTIONS_RUNTIME_TOKEN") || ""),
url: (val.url) ?? (utilities.getEnv("ACTIONS_RUNTIME_URL") || ""),
};
}
/**
* Include an inline cache with the exported image.
*/
export interface CacheToInline {
}
export interface CacheToLocal {
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* Path of the local directory to export the cache.
*/
dest: string;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: boolean;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: enums.CacheMode;
}
/**
* cacheToLocalProvideDefaults sets the appropriate defaults for CacheToLocal
*/
export function cacheToLocalProvideDefaults(val: CacheToLocal): CacheToLocal {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
};
}
export interface CacheToRegistry {
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: boolean;
/**
* Export cache manifest as an OCI-compatible image manifest instead of a
* manifest list. Requires `ociMediaTypes` to also be `true`.
*
* Some registries like AWS ECR will not work with caching if this is
* `false`.
*
* Defaults to `false` to match Docker's default behavior.
*/
imageManifest?: boolean;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: enums.CacheMode;
/**
* Whether to use OCI media types in exported manifests. Defaults to
* `true`.
*/
ociMediaTypes?: boolean;
/**
* Fully qualified name of the cache image to import.
*/
ref: string;
}
/**
* cacheToRegistryProvideDefaults sets the appropriate defaults for CacheToRegistry
*/
export function cacheToRegistryProvideDefaults(val: CacheToRegistry): CacheToRegistry {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ignoreError: (val.ignoreError) ?? false,
imageManifest: (val.imageManifest) ?? false,
mode: (val.mode) ?? "min",
ociMediaTypes: (val.ociMediaTypes) ?? true,
};
}
export interface CacheToS3 {
/**
* Defaults to `$AWS_ACCESS_KEY_ID`.
*/
accessKeyId?: string;
/**
* Prefix to prepend to blob filenames.
*/
blobsPrefix?: string;
/**
* Name of the S3 bucket.
*/
bucket: string;
/**
* Endpoint of the S3 bucket.
*/
endpointUrl?: string;
/**
* Ignore errors caused by failed cache exports.
*/
ignoreError?: boolean;
/**
* Prefix to prepend on manifest filenames.
*/
manifestsPrefix?: string;
/**
* The cache mode to use. Defaults to `min`.
*/
mode?: enums.CacheMode;
/**
* Name of the cache image.
*/
name?: string;
/**
* The geographic location of the bucket. Defaults to `$AWS_REGION`.
*/
region: string;
/**
* Defaults to `$AWS_SECRET_ACCESS_KEY`.
*/
secretAccessKey?: string;
/**
* Defaults to `$AWS_SESSION_TOKEN`.
*/
sessionToken?: string;
/**
* Uses `bucket` in the URL instead of hostname when `true`.
*/
usePathStyle?: boolean;
}
/**
* cacheToS3ProvideDefaults sets the appropriate defaults for CacheToS3
*/
export function cacheToS3ProvideDefaults(val: CacheToS3): CacheToS3 {
return {
...val,
accessKeyId: (val.accessKeyId) ?? (utilities.getEnv("AWS_ACCESS_KEY_ID") || ""),
ignoreError: (val.ignoreError) ?? false,
mode: (val.mode) ?? "min",
region: (val.region) ?? (utilities.getEnv("AWS_REGION") || ""),
secretAccessKey: (val.secretAccessKey) ?? (utilities.getEnv("AWS_SECRET_ACCESS_KEY") || ""),
sessionToken: (val.sessionToken) ?? (utilities.getEnv("AWS_SESSION_TOKEN") || ""),
};
}
export interface Context {
/**
* Resources to use for build context.
*
* The location can be:
* * A relative or absolute path to a local directory (`.`, `./app`,
* `/app`, etc.).
* * A remote URL of a Git repository, tarball, or plain text file
* (`https://github.com/user/myrepo.git`, `http://server/context.tar.gz`,
* etc.).
*/
location: string;
}
export interface Dockerfile {
/**
* Raw Dockerfile contents.
*
* Conflicts with `location`.
*
* Equivalent to invoking Docker with `-f -`.
*/
inline?: string;
/**
* Location of the Dockerfile to use.
*
* Can be a relative or absolute path to a local file, or a remote URL.
*
* Defaults to `${context.location}/Dockerfile` if context is on-disk.
*
* Conflicts with `inline`.
*/
location?: string;
}
export interface Export {
/**
* A no-op export. Helpful for silencing the 'no exports' warning if you
* just want to populate caches.
*/
cacheonly?: outputs.ExportCacheOnly;
/**
* When `true` this entry will be excluded. Defaults to `false`.
*/
disabled?: boolean;
/**
* Export as a Docker image layout.
*/
docker?: outputs.ExportDocker;
/**
* Outputs the build result into a container image format.
*/
image?: outputs.ExportImage;
/**
* Export to a local directory as files and directories.
*/
local?: outputs.ExportLocal;
/**
* Identical to the Docker exporter but uses OCI media types by default.
*/
oci?: outputs.ExportOCI;
/**
* A raw string as you would provide it to the Docker CLI (e.g.,
* `type=docker`)
*/
raw?: string;
/**
* Identical to the Image exporter, but pushes by default.
*/
registry?: outputs.ExportRegistry;
/**
* Export to a local directory as a tarball.
*/
tar?: outputs.ExportTar;
}
/**
* exportProvideDefaults sets the appropriate defaults for Export
*/
export function exportProvideDefaults(val: Export): Export {
return {
...val,
docker: (val.docker ? outputs.exportDockerProvideDefaults(val.docker) : undefined),
image: (val.image ? outputs.exportImageProvideDefaults(val.image) : undefined),
oci: (val.oci ? outputs.exportOCIProvideDefaults(val.oci) : undefined),
registry: (val.registry ? outputs.exportRegistryProvideDefaults(val.registry) : undefined),
};
}
export interface ExportCacheOnly {
}
export interface ExportDocker {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: {[key: string]: string};
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* The local export path.
*/
dest?: string;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: string[];
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: boolean;
/**
* Bundle the output into a tarball layout.
*/
tar?: boolean;
}
/**
* exportDockerProvideDefaults sets the appropriate defaults for ExportDocker
*/
export function exportDockerProvideDefaults(val: ExportDocker): ExportDocker {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
tar: (val.tar) ?? true,
};
}
export interface ExportImage {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: {[key: string]: string};
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* Name image with `prefix@<digest>`, used for anonymous images.
*/
danglingNamePrefix?: string;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Allow pushing to an insecure registry.
*/
insecure?: boolean;
/**
* Add additional canonical name (`name@<digest>`).
*/
nameCanonical?: boolean;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: string[];
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: boolean;
/**
* Push after creating the image. Defaults to `false`.
*/
push?: boolean;
/**
* Push image without name.
*/
pushByDigest?: boolean;
/**
* Store resulting images to the worker's image store and ensure all of
* its blobs are in the content store.
*
* Defaults to `true`.
*
* Ignored if the worker doesn't have image store (when using OCI workers,
* for example).
*/
store?: boolean;
/**
* Unpack image after creation (for use with containerd). Defaults to
* `false`.
*/
unpack?: boolean;
}
/**
* exportImageProvideDefaults sets the appropriate defaults for ExportImage
*/
export function exportImageProvideDefaults(val: ExportImage): ExportImage {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
store: (val.store) ?? true,
};
}
export interface ExportLocal {
/**
* Output path.
*/
dest: string;
}
export interface ExportOCI {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: {[key: string]: string};
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* The local export path.
*/
dest?: string;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: string[];
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: boolean;
/**
* Bundle the output into a tarball layout.
*/
tar?: boolean;
}
/**
* exportOCIProvideDefaults sets the appropriate defaults for ExportOCI
*/
export function exportOCIProvideDefaults(val: ExportOCI): ExportOCI {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? true,
tar: (val.tar) ?? true,
};
}
export interface ExportRegistry {
/**
* Attach an arbitrary key/value annotation to the image.
*/
annotations?: {[key: string]: string};
/**
* The compression type to use.
*/
compression?: enums.CompressionType;
/**
* Compression level from 0 to 22.
*/
compressionLevel?: number;
/**
* Name image with `prefix@<digest>`, used for anonymous images.
*/
danglingNamePrefix?: string;
/**
* Forcefully apply compression.
*/
forceCompression?: boolean;
/**
* Allow pushing to an insecure registry.
*/
insecure?: boolean;
/**
* Add additional canonical name (`name@<digest>`).
*/
nameCanonical?: boolean;
/**
* Specify images names to export. This is overridden if tags are already specified.
*/
names?: string[];
/**
* Use OCI media types in exporter manifests.
*/
ociMediaTypes?: boolean;
/**
* Push after creating the image. Defaults to `true`.
*/
push?: boolean;
/**
* Push image without name.
*/
pushByDigest?: boolean;
/**
* Store resulting images to the worker's image store and ensure all of
* its blobs are in the content store.
*
* Defaults to `true`.
*
* Ignored if the worker doesn't have image store (when using OCI workers,
* for example).
*/
store?: boolean;
/**
* Unpack image after creation (for use with containerd). Defaults to
* `false`.
*/
unpack?: boolean;
}
/**
* exportRegistryProvideDefaults sets the appropriate defaults for ExportRegistry
*/
export function exportRegistryProvideDefaults(val: ExportRegistry): ExportRegistry {
return {
...val,
compression: (val.compression) ?? "gzip",
compressionLevel: (val.compressionLevel) ?? 0,
forceCompression: (val.forceCompression) ?? false,
ociMediaTypes: (val.ociMediaTypes) ?? false,
push: (val.push) ?? true,
store: (val.store) ?? true,
};
}
export interface ExportTar {
/**
* Output path.
*/
dest: string;
}
export interface Registry {
/**
* The registry's address (e.g. "docker.io").
*/
address: string;
/**
* Password or token for the registry.
*/
password?: string;
/**
* Username for the registry.
*/
username?: string;
}
export interface SSH {
/**
* Useful for distinguishing different servers that are part of the same
* build.
*
* A value of `default` is appropriate if only dealing with a single host.
*/
id: string;
/**
* SSH agent socket or private keys to expose to the build under the given
* identifier.
*
* Defaults to `[$SSH_AUTH_SOCK]`.
*
* Note that your keys are **not** automatically added when using an
* agent. Run `ssh-add -l` locally to confirm which public keys are
* visible to the agent; these will be exposed to your build.
*/
paths?: string[];
}

View File

@@ -53,7 +53,7 @@ export function getVersion(): string {
/** @internal */
export function resourceOptsDefaults(): any {
return { version: getVersion(), pluginDownloadURL: "github.com/pulumi/pulumi-dockerbuild" };
return { version: getVersion() };
}
/** @internal */