No-op during Read if credentials are invalid (#194)
The `Image` resource already ignores errors during read but the `Index` resource was requiring the inspect call to always succeed. This will often fail due to https://github.com/pulumi/pulumi/issues/4981 (note however in this case credentials are stored with the resource instead of the provider). This changes our logic to instead emit a warning if the credentials are invalid. Fixes https://github.com/pulumi/pulumi-docker-build/issues/121.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Refreshing an `Index` resource will no longer fail if its stored credentials
|
||||
have expired. (https://github.com/pulumi/pulumi-docker-build/pull/194)
|
||||
|
||||
## 0.0.5 (2024-08-08)
|
||||
|
||||
### Fixed
|
||||
|
||||
4
go.mod
4
go.mod
@@ -24,7 +24,7 @@ require (
|
||||
github.com/pulumi/pulumi/sdk/nodejs/cmd/pulumi-language-nodejs/v3 v3.0.0-20240805173038-c428a91a4c3c
|
||||
github.com/pulumi/pulumi/sdk/python/cmd/pulumi-language-python/v3 v3.0.0-20240805173038-c428a91a4c3c
|
||||
github.com/pulumi/pulumi/sdk/v3 v3.128.0
|
||||
github.com/regclient/regclient v0.6.1
|
||||
github.com/regclient/regclient v0.7.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/afero v1.11.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
@@ -460,7 +460,7 @@ require (
|
||||
golang.org/x/net v0.26.0 // indirect
|
||||
golang.org/x/oauth2 v0.18.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/sys v0.24.0 // indirect
|
||||
golang.org/x/term v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -969,8 +969,8 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0=
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs=
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ=
|
||||
github.com/regclient/regclient v0.6.1 h1:4PxrGxMXrLpPrSaet8QZl568CVOolyHyukLL9UyogoU=
|
||||
github.com/regclient/regclient v0.6.1/go.mod h1:hCKbRHYMx6LJntAhXzWVV7Oxyn9DzNVJoOKJaSnU5BM=
|
||||
github.com/regclient/regclient v0.7.1 h1:qEsJrTmZd98fZKjueAbrZCSNGU+ifnr6xjlSAs3WOPs=
|
||||
github.com/regclient/regclient v0.7.1/go.mod h1:+w/BFtJuw0h0nzIw/z2+1FuA2/dVXBzDq4rYmziJpMc=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
@@ -1378,8 +1378,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -46,27 +46,27 @@ import pulumi_docker_build as docker_build
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"registry": {
|
||||
"image_manifest": True,
|
||||
"oci_media_types": True,
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "./app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
)],
|
||||
registries=[{
|
||||
"address": ecr_repository.repository_url,
|
||||
"password": auth_token.password,
|
||||
"username": auth_token.user_name,
|
||||
}],
|
||||
tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
|
||||
pulumi.export("ref", my_image.ref)
|
||||
```
|
||||
@@ -277,7 +277,7 @@ public class App {
|
||||
.registryId(ecrRepository.registryId())
|
||||
.build());
|
||||
|
||||
var myImage = new Image("myImage", ImageArgs.builder()
|
||||
var myImage = new Image("myImage", ImageArgs.builder()
|
||||
.cacheFrom(CacheFromArgs.builder()
|
||||
.registry(CacheFromRegistryArgs.builder()
|
||||
.ref(ecrRepository.repositoryUrl().applyValue(repositoryUrl -> String.format("%s:cache", repositoryUrl)))
|
||||
@@ -330,9 +330,9 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
platforms=[
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
@@ -428,7 +428,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.build())
|
||||
@@ -468,15 +468,15 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
)],
|
||||
registries=[{
|
||||
"address": "docker.io",
|
||||
"password": docker_hub_password,
|
||||
"username": "pulumibot",
|
||||
}],
|
||||
tags=["docker.io/pulumi/pulumi:3.107.0"])
|
||||
pulumi.export("ref", my_image["ref"])
|
||||
```
|
||||
@@ -594,7 +594,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.build())
|
||||
@@ -642,20 +642,20 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"local": {
|
||||
"src": "tmp/cache",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"local": {
|
||||
"dest": "tmp/cache",
|
||||
"mode": docker_build.CacheMode.MAX,
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -782,7 +782,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.cacheFrom(CacheFromArgs.builder()
|
||||
.local(CacheFromLocalArgs.builder()
|
||||
.src("tmp/cache")
|
||||
@@ -827,12 +827,12 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
builder={
|
||||
"name": "cloud-builder-name",
|
||||
},
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exec_=True,
|
||||
push=False)
|
||||
```
|
||||
@@ -926,7 +926,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.builder(BuilderConfigArgs.builder()
|
||||
.name("cloud-builder-name")
|
||||
.build())
|
||||
@@ -966,9 +966,9 @@ image = docker_build.Image("image",
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1057,7 +1057,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.buildArgs(Map.of("SET_ME_TO_TRUE", "true"))
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
@@ -1089,9 +1089,9 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False,
|
||||
target="build-me")
|
||||
```
|
||||
@@ -1175,7 +1175,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.build())
|
||||
@@ -1211,14 +1211,14 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
"named": {
|
||||
"golang_latest": {
|
||||
"location": "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1313,7 +1313,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.named(Map.of("golang:latest", Map.of("location", "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984")))
|
||||
@@ -1344,9 +1344,9 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1426,7 +1426,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile")
|
||||
.build())
|
||||
@@ -1461,14 +1461,14 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline="""FROM busybox
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
dockerfile={
|
||||
"inline": """FROM busybox
|
||||
COPY hello.c ./
|
||||
""",
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1562,7 +1562,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.build())
|
||||
@@ -1601,12 +1601,12 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://github.com/docker-library/hello-world.git",
|
||||
},
|
||||
dockerfile={
|
||||
"location": "app/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1696,7 +1696,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("https://github.com/docker-library/hello-world.git")
|
||||
.build())
|
||||
@@ -1734,14 +1734,14 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exports=[{
|
||||
"docker": {
|
||||
"tar": True,
|
||||
},
|
||||
}],
|
||||
push=False)
|
||||
```
|
||||
```csharp
|
||||
@@ -1843,7 +1843,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
var image = new Image("image", ImageArgs.builder()
|
||||
.context(BuildContextArgs.builder()
|
||||
.location("app")
|
||||
.build())
|
||||
|
||||
@@ -57,37 +57,37 @@ import pulumi
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
amd64 = docker_build.Image("amd64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-amd64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
arm64 = docker_build.Image("arm64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-arm64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
index = docker_build.Index("index",
|
||||
@@ -355,7 +355,7 @@ public class App {
|
||||
}
|
||||
|
||||
public static void stack(Context ctx) {
|
||||
var amd64 = new Image("amd64", ImageArgs.builder()
|
||||
var amd64 = new Image("amd64", ImageArgs.builder()
|
||||
.cacheFrom(CacheFromArgs.builder()
|
||||
.registry(CacheFromRegistryArgs.builder()
|
||||
.ref("docker.io/pulumi/pulumi:cache-amd64")
|
||||
@@ -374,7 +374,7 @@ public class App {
|
||||
.tags("docker.io/pulumi/pulumi:3.107.0-amd64")
|
||||
.build());
|
||||
|
||||
var arm64 = new Image("arm64", ImageArgs.builder()
|
||||
var arm64 = new Image("arm64", ImageArgs.builder()
|
||||
.cacheFrom(CacheFromArgs.builder()
|
||||
.registry(CacheFromRegistryArgs.builder()
|
||||
.ref("docker.io/pulumi/pulumi:cache-arm64")
|
||||
@@ -393,7 +393,7 @@ public class App {
|
||||
.tags("docker.io/pulumi/pulumi:3.107.0-arm64")
|
||||
.build());
|
||||
|
||||
var index = new Index("index", IndexArgs.builder()
|
||||
var index = new Index("index", IndexArgs.builder()
|
||||
.sources(
|
||||
amd64.ref(),
|
||||
arm64.ref())
|
||||
|
||||
@@ -802,6 +802,7 @@ func (i *Image) Read(
|
||||
continue
|
||||
}
|
||||
|
||||
//nolint:gocritic // Bytes aren't copied in a hot path.
|
||||
for _, d := range descriptors {
|
||||
if d.Platform != nil && d.Platform.Architecture == "unknown" {
|
||||
// Ignore cache manifests.
|
||||
|
||||
@@ -16,6 +16,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -23,6 +24,8 @@ import (
|
||||
// For examples/docs.
|
||||
_ "embed"
|
||||
|
||||
"github.com/regclient/regclient/types/errs"
|
||||
|
||||
provider "github.com/pulumi/pulumi-go-provider"
|
||||
"github.com/pulumi/pulumi-go-provider/infer"
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
||||
@@ -194,12 +197,12 @@ func (i *Index) Read(
|
||||
provider.GetLogger(ctx).Debug("reading index with tag " + input.Tag)
|
||||
|
||||
digest, err := cli.ManifestInspect(ctx, input.Tag)
|
||||
if err != nil && strings.Contains(err.Error(), "No such manifest:") && input.isPushed() {
|
||||
if errors.Is(err, errs.ErrNotFound) {
|
||||
// A remote tag was expected but isn't there -- delete the resource.
|
||||
return "", input, state, err
|
||||
return "", input, state, nil
|
||||
}
|
||||
if err != nil && strings.Contains(err.Error(), "No such manifest:") && !input.isPushed() {
|
||||
// Nothing was pushed, so just use the tag without digest..
|
||||
if errors.Is(err, errs.ErrHTTPUnauthorized) {
|
||||
provider.GetLogger(ctx).Warning("invalid credentials, skipping")
|
||||
return name, input, state, nil
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -18,8 +18,10 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/regclient/regclient/types/errs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
provider "github.com/pulumi/pulumi-go-provider"
|
||||
"github.com/pulumi/pulumi-go-provider/integration"
|
||||
@@ -84,6 +86,40 @@ func TestIndexLifecycle(t *testing.T) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "expired credentials",
|
||||
client: func(t *testing.T) Client {
|
||||
ctrl := gomock.NewController(t)
|
||||
c := NewMockClient(ctrl)
|
||||
c.EXPECT().ManifestCreate(gomock.Any(), true, gomock.Any(), gomock.Any())
|
||||
c.EXPECT().ManifestInspect(gomock.Any(), gomock.Any()).Return("", errs.ErrHTTPUnauthorized)
|
||||
c.EXPECT().ManifestDelete(gomock.Any(), gomock.Any()).Return(nil)
|
||||
return c
|
||||
},
|
||||
op: func(t *testing.T) integration.Operation {
|
||||
return integration.Operation{
|
||||
Inputs: resource.PropertyMap{
|
||||
"tag": resource.NewStringProperty(
|
||||
"docker.io/pulumibot/buildkit-e2e:manifest",
|
||||
),
|
||||
"sources": resource.NewArrayProperty([]resource.PropertyValue{
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:arm64"),
|
||||
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e:amd64"),
|
||||
}),
|
||||
"push": resource.NewBoolProperty(true),
|
||||
"registry": resource.NewObjectProperty(resource.PropertyMap{
|
||||
"address": resource.NewStringProperty("docker.io"),
|
||||
"username": resource.NewStringProperty("pulumibot"),
|
||||
"password": resource.NewSecretProperty(&resource.Secret{
|
||||
Element: resource.NewStringProperty(
|
||||
os.Getenv("DOCKER_HUB_PASSWORD"),
|
||||
),
|
||||
}),
|
||||
}),
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
2
sdk/go/dockerbuild/go.mod
generated
2
sdk/go/dockerbuild/go.mod
generated
@@ -88,7 +88,7 @@ require (
|
||||
golang.org/x/mod v0.18.0 // indirect
|
||||
golang.org/x/net v0.26.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/sys v0.24.0 // indirect
|
||||
golang.org/x/term v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/tools v0.22.0 // indirect
|
||||
|
||||
4
sdk/go/dockerbuild/go.sum
generated
4
sdk/go/dockerbuild/go.sum
generated
@@ -273,8 +273,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
|
||||
@@ -167,7 +167,7 @@ import javax.annotation.Nullable;
|
||||
* .registryId(ecrRepository.registryId())
|
||||
* .build());
|
||||
*
|
||||
* var myImage = new Image("myImage", ImageArgs.builder()
|
||||
* var myImage = new Image("myImage", ImageArgs.builder()
|
||||
* .cacheFrom(CacheFromArgs.builder()
|
||||
* .registry(CacheFromRegistryArgs.builder()
|
||||
* .ref(ecrRepository.repositoryUrl().applyValue(repositoryUrl -> String.format("%s:cache", repositoryUrl)))
|
||||
@@ -221,7 +221,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .build())
|
||||
@@ -260,7 +260,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .build())
|
||||
@@ -306,7 +306,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .cacheFrom(CacheFromArgs.builder()
|
||||
* .local(CacheFromLocalArgs.builder()
|
||||
* .src("tmp/cache")
|
||||
@@ -353,7 +353,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .builder(BuilderConfigArgs.builder()
|
||||
* .name("cloud-builder-name")
|
||||
* .build())
|
||||
@@ -392,7 +392,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .buildArgs(Map.of("SET_ME_TO_TRUE", "true"))
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
@@ -428,7 +428,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .build())
|
||||
@@ -464,7 +464,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .named(Map.of("golang:latest", Map.of("location", "docker-image://golang{@literal @}sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984")))
|
||||
@@ -500,7 +500,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile")
|
||||
* .build())
|
||||
@@ -536,7 +536,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .build())
|
||||
@@ -578,7 +578,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("https://github.com/docker-library/hello-world.git")
|
||||
* .build())
|
||||
@@ -618,7 +618,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* var image = new Image("image", ImageArgs.builder()
|
||||
* .context(BuildContextArgs.builder()
|
||||
* .location("app")
|
||||
* .build())
|
||||
|
||||
@@ -68,7 +68,7 @@ import javax.annotation.Nullable;
|
||||
* }
|
||||
*
|
||||
* public static void stack(Context ctx) {
|
||||
* var amd64 = new Image("amd64", ImageArgs.builder()
|
||||
* var amd64 = new Image("amd64", ImageArgs.builder()
|
||||
* .cacheFrom(CacheFromArgs.builder()
|
||||
* .registry(CacheFromRegistryArgs.builder()
|
||||
* .ref("docker.io/pulumi/pulumi:cache-amd64")
|
||||
@@ -87,7 +87,7 @@ import javax.annotation.Nullable;
|
||||
* .tags("docker.io/pulumi/pulumi:3.107.0-amd64")
|
||||
* .build());
|
||||
*
|
||||
* var arm64 = new Image("arm64", ImageArgs.builder()
|
||||
* var arm64 = new Image("arm64", ImageArgs.builder()
|
||||
* .cacheFrom(CacheFromArgs.builder()
|
||||
* .registry(CacheFromRegistryArgs.builder()
|
||||
* .ref("docker.io/pulumi/pulumi:cache-arm64")
|
||||
@@ -106,7 +106,7 @@ import javax.annotation.Nullable;
|
||||
* .tags("docker.io/pulumi/pulumi:3.107.0-arm64")
|
||||
* .build());
|
||||
*
|
||||
* var index = new Index("index", IndexArgs.builder()
|
||||
* var index = new Index("index", IndexArgs.builder()
|
||||
* .sources(
|
||||
* amd64.ref(),
|
||||
* arm64.ref())
|
||||
|
||||
348
sdk/python/pulumi_docker_build/image.py
generated
348
sdk/python/pulumi_docker_build/image.py
generated
@@ -718,27 +718,27 @@ class Image(pulumi.CustomResource):
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"registry": {
|
||||
"image_manifest": True,
|
||||
"oci_media_types": True,
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "./app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
)],
|
||||
registries=[{
|
||||
"address": ecr_repository.repository_url,
|
||||
"password": auth_token.password,
|
||||
"username": auth_token.user_name,
|
||||
}],
|
||||
tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
|
||||
pulumi.export("ref", my_image.ref)
|
||||
```
|
||||
@@ -748,9 +748,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
platforms=[
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
@@ -763,15 +763,15 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
)],
|
||||
registries=[{
|
||||
"address": "docker.io",
|
||||
"password": docker_hub_password,
|
||||
"username": "pulumibot",
|
||||
}],
|
||||
tags=["docker.io/pulumi/pulumi:3.107.0"])
|
||||
pulumi.export("ref", my_image["ref"])
|
||||
```
|
||||
@@ -781,20 +781,20 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"local": {
|
||||
"src": "tmp/cache",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"local": {
|
||||
"dest": "tmp/cache",
|
||||
"mode": docker_build.CacheMode.MAX,
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Docker Build Cloud
|
||||
@@ -803,12 +803,12 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
builder={
|
||||
"name": "cloud-builder-name",
|
||||
},
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exec_=True,
|
||||
push=False)
|
||||
```
|
||||
@@ -821,9 +821,9 @@ class Image(pulumi.CustomResource):
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Build target
|
||||
@@ -832,9 +832,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False,
|
||||
target="build-me")
|
||||
```
|
||||
@@ -844,14 +844,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
"named": {
|
||||
"golang_latest": {
|
||||
"location": "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Remote context
|
||||
@@ -860,9 +860,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Inline Dockerfile
|
||||
@@ -871,14 +871,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline=\"\"\"FROM busybox
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
dockerfile={
|
||||
"inline": \"\"\"FROM busybox
|
||||
COPY hello.c ./
|
||||
\"\"\",
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Remote context
|
||||
@@ -887,12 +887,12 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://github.com/docker-library/hello-world.git",
|
||||
},
|
||||
dockerfile={
|
||||
"location": "app/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Local export
|
||||
@@ -901,14 +901,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exports=[{
|
||||
"docker": {
|
||||
"tar": True,
|
||||
},
|
||||
}],
|
||||
push=False)
|
||||
```
|
||||
|
||||
@@ -1156,27 +1156,27 @@ class Image(pulumi.CustomResource):
|
||||
ecr_repository = aws.ecr.Repository("ecr-repository")
|
||||
auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)
|
||||
my_image = docker_build.Image("my-image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
image_manifest=True,
|
||||
oci_media_types=True,
|
||||
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="./app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"registry": {
|
||||
"image_manifest": True,
|
||||
"oci_media_types": True,
|
||||
"ref": ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:cache"),
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "./app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address=ecr_repository.repository_url,
|
||||
password=auth_token.password,
|
||||
username=auth_token.user_name,
|
||||
)],
|
||||
registries=[{
|
||||
"address": ecr_repository.repository_url,
|
||||
"password": auth_token.password,
|
||||
"username": auth_token.user_name,
|
||||
}],
|
||||
tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")])
|
||||
pulumi.export("ref", my_image.ref)
|
||||
```
|
||||
@@ -1186,9 +1186,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
platforms=[
|
||||
docker_build.Platform.PLAN9_AMD64,
|
||||
docker_build.Platform.PLAN9_386,
|
||||
@@ -1201,15 +1201,15 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=True,
|
||||
registries=[docker_build.RegistryArgs(
|
||||
address="docker.io",
|
||||
password=docker_hub_password,
|
||||
username="pulumibot",
|
||||
)],
|
||||
registries=[{
|
||||
"address": "docker.io",
|
||||
"password": docker_hub_password,
|
||||
"username": "pulumibot",
|
||||
}],
|
||||
tags=["docker.io/pulumi/pulumi:3.107.0"])
|
||||
pulumi.export("ref", my_image["ref"])
|
||||
```
|
||||
@@ -1219,20 +1219,20 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
local=docker_build.CacheFromLocalArgs(
|
||||
src="tmp/cache",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
local=docker_build.CacheToLocalArgs(
|
||||
dest="tmp/cache",
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"local": {
|
||||
"src": "tmp/cache",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"local": {
|
||||
"dest": "tmp/cache",
|
||||
"mode": docker_build.CacheMode.MAX,
|
||||
},
|
||||
}],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Docker Build Cloud
|
||||
@@ -1241,12 +1241,12 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
builder=docker_build.BuilderConfigArgs(
|
||||
name="cloud-builder-name",
|
||||
),
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
builder={
|
||||
"name": "cloud-builder-name",
|
||||
},
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exec_=True,
|
||||
push=False)
|
||||
```
|
||||
@@ -1259,9 +1259,9 @@ class Image(pulumi.CustomResource):
|
||||
build_args={
|
||||
"SET_ME_TO_TRUE": "true",
|
||||
},
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Build target
|
||||
@@ -1270,9 +1270,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
push=False,
|
||||
target="build-me")
|
||||
```
|
||||
@@ -1282,14 +1282,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
named={
|
||||
"golang:latest": docker_build.ContextArgs(
|
||||
location="docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
),
|
||||
context={
|
||||
"location": "app",
|
||||
"named": {
|
||||
"golang_latest": {
|
||||
"location": "docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984",
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Remote context
|
||||
@@ -1298,9 +1298,9 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Inline Dockerfile
|
||||
@@ -1309,14 +1309,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
inline=\"\"\"FROM busybox
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
dockerfile={
|
||||
"inline": \"\"\"FROM busybox
|
||||
COPY hello.c ./
|
||||
\"\"\",
|
||||
),
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Remote context
|
||||
@@ -1325,12 +1325,12 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="https://github.com/docker-library/hello-world.git",
|
||||
),
|
||||
dockerfile=docker_build.DockerfileArgs(
|
||||
location="app/Dockerfile",
|
||||
),
|
||||
context={
|
||||
"location": "https://github.com/docker-library/hello-world.git",
|
||||
},
|
||||
dockerfile={
|
||||
"location": "app/Dockerfile",
|
||||
},
|
||||
push=False)
|
||||
```
|
||||
### Local export
|
||||
@@ -1339,14 +1339,14 @@ class Image(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
image = docker_build.Image("image",
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
exports=[docker_build.ExportArgs(
|
||||
docker=docker_build.ExportDockerArgs(
|
||||
tar=True,
|
||||
),
|
||||
)],
|
||||
context={
|
||||
"location": "app",
|
||||
},
|
||||
exports=[{
|
||||
"docker": {
|
||||
"tar": True,
|
||||
},
|
||||
}],
|
||||
push=False)
|
||||
```
|
||||
|
||||
|
||||
112
sdk/python/pulumi_docker_build/index.py
generated
112
sdk/python/pulumi_docker_build/index.py
generated
@@ -131,37 +131,37 @@ class Index(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
amd64 = docker_build.Image("amd64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-amd64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
arm64 = docker_build.Image("arm64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-arm64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
index = docker_build.Index("index",
|
||||
@@ -218,37 +218,37 @@ class Index(pulumi.CustomResource):
|
||||
import pulumi_docker_build as docker_build
|
||||
|
||||
amd64 = docker_build.Image("amd64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-amd64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-amd64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
arm64 = docker_build.Image("arm64",
|
||||
cache_from=[docker_build.CacheFromArgs(
|
||||
registry=docker_build.CacheFromRegistryArgs(
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
cache_to=[docker_build.CacheToArgs(
|
||||
registry=docker_build.CacheToRegistryArgs(
|
||||
mode=docker_build.CacheMode.MAX,
|
||||
ref="docker.io/pulumi/pulumi:cache-arm64",
|
||||
),
|
||||
)],
|
||||
context=docker_build.BuildContextArgs(
|
||||
location="app",
|
||||
),
|
||||
cache_from=[{
|
||||
"registry": {
|
||||
"ref": "docker.io/pulumi/pulumi:cache-arm64",
|
||||
},
|
||||
}],
|
||||
cache_to=[{
|
||||
"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"])
|
||||
index = docker_build.Index("index",
|
||||
|
||||
Reference in New Issue
Block a user