Fix ECR auth
This commit is contained in:
1
examples/tests/ecr/.dockerignore
Normal file
1
examples/tests/ecr/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
*
|
||||
36
examples/tests/ecr/Pulumi.yaml
Normal file
36
examples/tests/ecr/Pulumi.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: ecr
|
||||
description: Push to AWS ECR with caching
|
||||
outputs:
|
||||
ref: ${my-image.ref}
|
||||
resources:
|
||||
ecr-repository:
|
||||
type: aws:ecr:Repository
|
||||
properties:
|
||||
forceDelete: true
|
||||
my-image:
|
||||
type: dockerbuild:Image
|
||||
properties:
|
||||
tags:
|
||||
- ${ecr-repository.repositoryUrl}:tag-name
|
||||
push: true
|
||||
context:
|
||||
location: .
|
||||
dockerfile:
|
||||
inline: FROM alpine
|
||||
cacheFrom:
|
||||
- registry:
|
||||
ref: ${ecr-repository.repositoryUrl}:cache
|
||||
cacheTo:
|
||||
- registry:
|
||||
ref: ${ecr-repository.repositoryUrl}:cache
|
||||
imageManifest: true
|
||||
ociMediaTypes: true
|
||||
registries:
|
||||
- username: ${auth-token.userName}
|
||||
password: ${auth-token.password}
|
||||
address: ${ecr-repository.repositoryUrl}
|
||||
runtime: yaml
|
||||
variables:
|
||||
auth-token:
|
||||
fn::aws:ecr:getAuthorizationToken:
|
||||
registryId: ${ecr-repository.registryId}
|
||||
@@ -25,3 +25,18 @@ func TestYAMLExample(t *testing.T) {
|
||||
|
||||
integration.ProgramTest(t, &test)
|
||||
}
|
||||
|
||||
func TestECR(t *testing.T) {
|
||||
if os.Getenv("AWS_SESSION_TOKEN") == "" {
|
||||
t.Skip("Missing AWS credentials")
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
test := integration.ProgramTestOptions{
|
||||
Dir: path.Join(cwd, "tests/ecr"),
|
||||
}
|
||||
|
||||
integration.ProgramTest(t, &test)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user