mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-26 15:40:35 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
39da697e1e
@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ecr"
|
"github.com/aws/aws-sdk-go/service/ecr"
|
||||||
)
|
)
|
||||||
@ -28,6 +29,7 @@ func main() {
|
|||||||
create = parseBoolOrDefault(false, getenv("PLUGIN_CREATE_REPOSITORY", "ECR_CREATE_REPOSITORY"))
|
create = parseBoolOrDefault(false, getenv("PLUGIN_CREATE_REPOSITORY", "ECR_CREATE_REPOSITORY"))
|
||||||
lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY")
|
lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY")
|
||||||
repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY")
|
repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY")
|
||||||
|
assumeRole = getenv("PLUGIN_ASSUME_ROLE")
|
||||||
)
|
)
|
||||||
|
|
||||||
// set the region
|
// set the region
|
||||||
@ -43,12 +45,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sess, err := session.NewSession(&aws.Config{Region: ®ion})
|
sess, err := session.NewSession(&aws.Config{Region: ®ion})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(fmt.Sprintf("error creating aws session: %v", err))
|
log.Fatal(fmt.Sprintf("error creating aws session: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
svc := ecr.New(sess)
|
svc := getECRClient(sess, assumeRole)
|
||||||
username, password, defaultRegistry, err := getAuthInfo(svc)
|
username, password, defaultRegistry, err := getAuthInfo(svc)
|
||||||
|
|
||||||
if registry == "" {
|
if registry == "" {
|
||||||
@ -184,3 +185,12 @@ func getenv(key ...string) (s string) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getECRClient(sess *session.Session, role string) *ecr.ECR {
|
||||||
|
if role == "" {
|
||||||
|
return ecr.New(sess)
|
||||||
|
}
|
||||||
|
return ecr.New(sess, &aws.Config{
|
||||||
|
Credentials: stscreds.NewCredentials(sess, role),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -13,7 +13,8 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
|
|||||||
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
RUN /innoextract.exe dockertoolbox.exe
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
FROM plugins/base:windows-1809
|
FROM mcr.microsoft.com/windows/nanoserver:1809
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone Docker" `
|
org.label-schema.name="Drone Docker" `
|
||||||
|
Loading…
Reference in New Issue
Block a user