Fix auth again

This commit is contained in:
Bryce Lampe
2024-04-16 16:03:05 -07:00
parent 7c9632e428
commit f5d8e81f24
12 changed files with 97 additions and 27 deletions

View File

@@ -0,0 +1 @@
*

View File

@@ -0,0 +1,34 @@
name: dockerhub
description: Push to DockerHub with caching
runtime: yaml
plugins:
providers:
- name: docker-build
path: ../../../bin
outputs:
ref: ${my-image.ref}
resources:
my-image:
type: docker-build:Image
properties:
tags:
- docker.io/pulumibot/buildkit-e2e
push: true
context:
location: .
dockerfile:
inline: FROM alpine
cacheFrom:
- registry:
ref: docker.io/pulumibot/buildkit-e2e:cache
cacheTo:
- registry:
ref: docker.io/pulumibot/buildkit-e2e:cache
registries:
- username: pulumibot
address: docker.io
password: ${dockerHubPassword}
config:
dockerHubPassword:
type: string
secret: true

View File

@@ -1,5 +1,10 @@
name: ecr
description: Push to AWS ECR with caching
runtime: yaml
plugins:
providers:
- name: docker-build
path: ../../../bin
outputs:
ref: ${my-image.ref}
resources:
@@ -8,10 +13,10 @@ resources:
properties:
forceDelete: true
my-image:
type: dockerbuild:Image
type: docker-build:Image
properties:
tags:
- ${ecr-repository.repositoryUrl}:tag-name
- ${ecr-repository.repositoryUrl}:latest
push: true
context:
location: .
@@ -29,7 +34,6 @@ resources:
- username: ${auth-token.userName}
password: ${auth-token.password}
address: ${ecr-repository.repositoryUrl}
runtime: yaml
variables:
auth-token:
fn::aws:ecr:getAuthorizationToken:

View File

@@ -40,3 +40,21 @@ func TestECR(t *testing.T) {
integration.ProgramTest(t, &test)
}
func TestDockerHub(t *testing.T) {
if os.Getenv("DOCKER_HUB_PASSWORD") == "" {
t.Skip("Missing DockerHub credentials")
}
cwd, err := os.Getwd()
require.NoError(t, err)
test := integration.ProgramTestOptions{
Dir: path.Join(cwd, "tests/dockerhub"),
Secrets: map[string]string{
"dockerHubPassword": os.Getenv("DOCKER_HUB_PASSWORD"),
},
}
integration.ProgramTest(t, &test)
}