Skip to content

Commit 3e0e3c8

Browse files
bump dind to 20.10.9
rebased on master + applied the previous changes commit b96d524 Author: surtur <[email protected]> Date: Fri Oct 22 14:28:24 2021 +0200 chore: bump dind to 20.10.9 commit ca9cfe9 Author: surtur <[email protected]> Date: Tue Jun 8 22:32:45 2021 +0200 chore: bump docker to 20.10.7-dind commit 5dc2b56 Author: surtur <[email protected]> Date: Tue Apr 13 10:00:07 2021 +0200 chore: bump docker to 20.10.6-dind commit 6dc63b2 Author: surtur <[email protected]> Date: Wed Mar 17 02:35:29 2021 +0100 chore: bump docker to 20.10.5-dind commit 1ae4536 Author: surtur <[email protected]> Date: Wed Mar 17 01:11:36 2021 +0100 docker: add multiple different image tags rolling: * latest * edge-dind fixed to a commit: * ${DRONE_COMMIT_SHA:0:8} * ${DRONE_COMMIT_SHA:0:8}-edge-dind * ${DRONE_COMMIT_SHA:0:8}-linux-amd64 commit 6b86978 Author: surtur <[email protected]> Date: Wed Mar 17 02:22:36 2021 +0100 ci: use plugins/docker:linux-amd64 * bump from :18 * add repo tag for dry_run commit 2a52c7e Author: surtur <[email protected]> Date: Tue Mar 16 22:26:30 2021 +0100 chore: bump docker to 19.03.15-dind commit e5693c3 Author: surtur <[email protected]> Date: Tue Mar 16 21:53:51 2021 +0100 ci: dry-run on push+publish to immawanderer commit 07c40b4 Author: surtur <[email protected]> Date: Tue Mar 16 19:59:34 2021 +0100 jsonnet: thow out {arm,gcr,acr,heroku} stuff commit f005615 Author: surtur <[email protected]> Date: Tue Mar 16 19:26:12 2021 +0100 ci: edit .drone.yml to only build for linux-amd64 * rm windows pipelines as I don't have any windows runners * rm arm/arm64 pipelines as I don't have any arm runners * rm {ecr,acr,whatever} publish steps as we're not publishing anything just yet * tag the image under immawanderer, not the official plugins repo * run as a dry_run (cause we're not really publishing, right?) commit 6ec5e71 Merge: 88f8bf1 0911e6a Author: TP Honey <[email protected]> Date: Wed Oct 13 17:19:30 2021 +0100 Merge pull request drone-plugins#338 from tphoney/bump-go-1.13 (maint) bump git to 1.13 for build and test commit 0911e6a Author: TP Honey <[email protected]> Date: Wed Oct 13 14:49:29 2021 +0100 (maint) bump git to 1.13 for build and test commit 88f8bf1 Merge: 607b04a 2d70a1f Author: TP Honey <[email protected]> Date: Wed Oct 13 14:32:03 2021 +0100 Merge pull request drone-plugins#337 from tphoney/prep_v19.03.9 (maint) v19.03.9 release prep commit 2d70a1f Author: TP Honey <[email protected]> Date: Wed Oct 13 14:24:58 2021 +0100 (maint) v19.03.9 release prep commit 607b04a Merge: 72ef7b1 e44c2d4 Author: Eoin McAfee <[email protected]> Date: Thu Sep 23 15:52:24 2021 +0100 Merge pull request drone-plugins#333 from jimsheldon/ecr-externalid adding support for externalId commit e44c2d4 Author: Jim Sheldon <[email protected]> Date: Fri Sep 17 15:33:05 2021 -0400 adding support for externalId commit 72ef7b1 Author: Brad Rydzewski <[email protected]> Date: Mon Aug 2 22:15:39 2021 -0400 log available credentials before login commit fbbeec5 Author: Brad Rydzewski <[email protected]> Date: Mon Aug 2 21:42:22 2021 -0400 use Replace instead of ReplaceAll commit b1d8698 Author: Brad Rydzewski <[email protected]> Date: Mon Aug 2 21:28:37 2021 -0400 print login failure reason to output commit d4cf9f2 Author: Brad Rydzewski <[email protected]> Date: Sun Jul 11 15:50:43 2021 -0400 remove pull always commit f753800 Merge: dd359df c10d367 Author: Brad Rydzewski <[email protected]> Date: Sun Jul 11 15:39:35 2021 -0400 Merge pull request drone-plugins#325 from drone-plugins/revert-322-update-seccomp Revert "Update seccomp to 20.10 docker" commit c10d367 Author: Brad Rydzewski <[email protected]> Date: Sun Jul 11 15:38:04 2021 -0400 Revert "Update seccomp to 20.10 docker (drone-plugins#322)" This reverts commit dd359df. commit dd359df Author: techknowlogick <[email protected]> Date: Wed Jul 7 15:03:54 2021 -0400 Update seccomp to 20.10 docker (drone-plugins#322) * Update seccomp to 20.10 docker commit 729aa5d Merge: f08821b db5c216 Author: TP Honey <[email protected]> Date: Wed Jul 7 19:52:19 2021 +0100 Merge pull request drone-plugins#323 from tphoney/docker_rate_limit (maint) CI, remove the dry run steps, due to rate limiting commit db5c216 Author: TP Honey <[email protected]> Date: Wed Jul 7 19:37:30 2021 +0100 (maint) CI, remove the dry run steps, due to rate limiting commit f08821b Merge: 0f6bd8a 5760e7b Author: Brad Rydzewski <[email protected]> Date: Tue Apr 6 15:55:56 2021 -0400 Merge pull request drone-plugins#300 from rvoitenko/ecr_scan_on_push ECR: adding setting to enable image scanning while repo creation commit 5760e7b Merge: 3501d9a 7ade37a Author: Roman Voitenko <[email protected]> Date: Sat Feb 20 13:32:16 2021 +0100 Merge branch 'master' into ecr_scan_on_push commit 3501d9a Author: Roman Voitenko <[email protected]> Date: Thu Oct 1 10:43:25 2020 +0200 add possibility to turn on/off image scanning not only during repo creation, but when repo already created commit d8b6b48 Author: Roman Voitenko <[email protected]> Date: Wed Sep 30 23:32:23 2020 +0200 add possibility to turn on ECR image scanning for repos created by ecr plugin
1 parent d2940d4 commit 3e0e3c8

File tree

7 files changed

+109
-52
lines changed

7 files changed

+109
-52
lines changed

.drone.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ platform:
88

99
steps:
1010
- name: vet
11-
pull: always
12-
image: golang:1.11
11+
image: golang:1.13
1312
commands:
1413
- go vet ./...
1514
environment:
@@ -19,8 +18,7 @@ steps:
1918
path: /go
2019

2120
- name: test
22-
pull: always
23-
image: golang:1.11
21+
image: golang:1.13
2422
commands:
2523
- go test -cover ./...
2624
environment:
@@ -51,8 +49,7 @@ platform:
5149

5250
steps:
5351
- name: build-push
54-
pull: always
55-
image: golang:1.11
52+
image: golang:1.13
5653
commands:
5754
- "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker"
5855
environment:
@@ -64,8 +61,7 @@ steps:
6461
- tag
6562

6663
- name: build-tag
67-
pull: always
68-
image: golang:1.11
64+
image: golang:1.13
6965
commands:
7066
- "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker"
7167
environment:
@@ -76,8 +72,7 @@ steps:
7672
- tag
7773

7874
- name: executable
79-
pull: always
80-
image: golang:1.11
75+
image: golang:1.13
8176
commands:
8277
- ./release/linux/amd64/drone-docker --help
8378

.github_changelog_generator

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
since-tag=v19.03.8
2+

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Changelog
2+
3+
## [v19.03.9](https://github.com/drone-plugins/drone-docker/tree/v19.03.9) (2021-10-13)
4+
5+
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v19.03.8...v19.03.9)
6+
7+
**Implemented enhancements:**
8+
9+
- adding support for externalId [\#333](https://github.com/drone-plugins/drone-docker/pull/333) ([jimsheldon](https://github.com/jimsheldon))
10+
- Add support for automatic opencontainer labels [\#313](https://github.com/drone-plugins/drone-docker/pull/313) ([codrut-fc](https://github.com/codrut-fc))
11+
- add custom seccomp profile [\#312](https://github.com/drone-plugins/drone-docker/pull/312) ([xoxys](https://github.com/xoxys))
12+
- ECR: adding setting to enable image scanning while repo creation [\#300](https://github.com/drone-plugins/drone-docker/pull/300) ([rvoitenko](https://github.com/rvoitenko))
13+
14+
**Fixed bugs:**
15+
16+
- Revert "Update seccomp to 20.10 docker" [\#325](https://github.com/drone-plugins/drone-docker/pull/325) ([bradrydzewski](https://github.com/bradrydzewski))
17+
18+
**Merged pull requests:**
19+
20+
- \(maint\) CI, remove the dry run steps, due to rate limiting [\#323](https://github.com/drone-plugins/drone-docker/pull/323) ([tphoney](https://github.com/tphoney))
21+
- Update seccomp to 20.10 docker [\#322](https://github.com/drone-plugins/drone-docker/pull/322) ([techknowlogick](https://github.com/techknowlogick))
22+
23+
24+
25+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

cmd/drone-ecr/main.go

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ func main() {
3737
lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY")
3838
repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY")
3939
assumeRole = getenv("PLUGIN_ASSUME_ROLE")
40+
externalId = getenv("PLUGIN_EXTERNAL_ID")
41+
scanOnPush = parseBoolOrDefault(false, getenv("PLUGIN_SCAN_ON_PUSH"))
4042
)
4143

4244
// set the region
@@ -56,7 +58,7 @@ func main() {
5658
log.Fatal(fmt.Sprintf("error creating aws session: %v", err))
5759
}
5860

59-
svc := getECRClient(sess, assumeRole)
61+
svc := getECRClient(sess, assumeRole, externalId)
6062
username, password, defaultRegistry, err := getAuthInfo(svc)
6163

6264
if registry == "" {
@@ -72,10 +74,14 @@ func main() {
7274
}
7375

7476
if create {
75-
err = ensureRepoExists(svc, trimHostname(repo, registry))
77+
err = ensureRepoExists(svc, trimHostname(repo, registry), scanOnPush)
7678
if err != nil {
7779
log.Fatal(fmt.Sprintf("error creating ECR repo: %v", err))
7880
}
81+
err = updateImageScannningConfig(svc, trimHostname(repo, registry), scanOnPush)
82+
if err != nil {
83+
log.Fatal(fmt.Sprintf("error updating scan on push for ECR repo: %v", err))
84+
}
7985
}
8086

8187
if lifecyclePolicy != "" {
@@ -118,9 +124,10 @@ func trimHostname(repo, registry string) string {
118124
return repo
119125
}
120126

121-
func ensureRepoExists(svc *ecr.ECR, name string) (err error) {
127+
func ensureRepoExists(svc *ecr.ECR, name string, scanOnPush bool) (err error) {
122128
input := &ecr.CreateRepositoryInput{}
123129
input.SetRepositoryName(name)
130+
input.SetImageScanningConfiguration(&ecr.ImageScanningConfiguration{ScanOnPush: &scanOnPush})
124131
_, err = svc.CreateRepository(input)
125132
if err != nil {
126133
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ecr.ErrCodeRepositoryAlreadyExistsException {
@@ -132,6 +139,15 @@ func ensureRepoExists(svc *ecr.ECR, name string) (err error) {
132139
return
133140
}
134141

142+
func updateImageScannningConfig(svc *ecr.ECR, name string, scanOnPush bool) (err error) {
143+
input := &ecr.PutImageScanningConfigurationInput{}
144+
input.SetRepositoryName(name)
145+
input.SetImageScanningConfiguration(&ecr.ImageScanningConfiguration{ScanOnPush: &scanOnPush})
146+
_, err = svc.PutImageScanningConfiguration(input)
147+
148+
return err
149+
}
150+
135151
func uploadLifeCyclePolicy(svc *ecr.ECR, lifecyclePolicy string, name string) (err error) {
136152
input := &ecr.PutLifecyclePolicyInput{}
137153
input.SetLifecyclePolicyText(lifecyclePolicy)
@@ -193,11 +209,19 @@ func getenv(key ...string) (s string) {
193209
return
194210
}
195211

196-
func getECRClient(sess *session.Session, role string) *ecr.ECR {
212+
func getECRClient(sess *session.Session, role string, externalId string) *ecr.ECR {
197213
if role == "" {
198214
return ecr.New(sess)
199215
}
200-
return ecr.New(sess, &aws.Config{
201-
Credentials: stscreds.NewCredentials(sess, role),
202-
})
216+
if externalId != "" {
217+
return ecr.New(sess, &aws.Config{
218+
Credentials: stscreds.NewCredentials(sess, role, func(p *stscreds.AssumeRoleProvider) {
219+
p.ExternalID = &externalId
220+
}),
221+
})
222+
} else {
223+
return ecr.New(sess, &aws.Config{
224+
Credentials: stscreds.NewCredentials(sess, role),
225+
})
226+
}
203227
}

docker.go

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ type (
3939

4040
// Build defines Docker build parameters.
4141
Build struct {
42-
Remote string // Git remote URL
43-
Name string // Docker build using default named tag
44-
Dockerfile string // Docker build Dockerfile
45-
Context string // Docker build context
46-
Tags []string // Docker build tags
47-
Args []string // Docker build args
48-
ArgsEnv []string // Docker build args from env
49-
Target string // Docker build target
50-
Squash bool // Docker build squash
51-
Pull bool // Docker build pull
52-
CacheFrom []string // Docker build cache-from
53-
Compress bool // Docker build compress
54-
Repo string // Docker build repository
55-
LabelSchema []string // label-schema Label map
56-
AutoLabel bool // auto-label bool
57-
Labels []string // Label map
58-
Link string // Git repo link
59-
NoCache bool // Docker build no-cache
60-
AddHost []string // Docker build add-host
61-
Quiet bool // Docker build quiet
42+
Remote string // Git remote URL
43+
Name string // Docker build using default named tag
44+
Dockerfile string // Docker build Dockerfile
45+
Context string // Docker build context
46+
Tags []string // Docker build tags
47+
Args []string // Docker build args
48+
ArgsEnv []string // Docker build args from env
49+
Target string // Docker build target
50+
Squash bool // Docker build squash
51+
Pull bool // Docker build pull
52+
CacheFrom []string // Docker build cache-from
53+
Compress bool // Docker build compress
54+
Repo string // Docker build repository
55+
LabelSchema []string // label-schema Label map
56+
AutoLabel bool // auto-label bool
57+
Labels []string // Label map
58+
Link string // Git repo link
59+
NoCache bool // Docker build no-cache
60+
AddHost []string // Docker build add-host
61+
Quiet bool // Docker build quiet
6262
}
6363

6464
// Plugin defines the Docker plugin parameters.
@@ -80,16 +80,33 @@ func (p Plugin) Exec() error {
8080

8181
// poll the docker daemon until it is started. This ensures the daemon is
8282
// ready to accept connections before we proceed.
83-
for i := 0; i < 15; i++ {
83+
for i := 0; ; i++ {
8484
cmd := commandInfo()
8585
err := cmd.Run()
8686
if err == nil {
8787
break
8888
}
89+
if i == 15 {
90+
fmt.Println("Unable to reach Docker Daemon after 15 attempts.")
91+
break
92+
}
8993
time.Sleep(time.Second * 1)
9094
}
9195

92-
// Create Auth Config File
96+
// for debugging purposes, log the type of authentication
97+
// credentials that have been provided.
98+
switch {
99+
case p.Login.Password != "" && p.Login.Config != "":
100+
fmt.Println("Detected registry credentials and registry credentials file")
101+
case p.Login.Password != "":
102+
fmt.Println("Detected registry credentials")
103+
case p.Login.Config != "":
104+
fmt.Println("Detected registry credentials file")
105+
default:
106+
fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.")
107+
}
108+
109+
// create Auth Config File
93110
if p.Login.Config != "" {
94111
os.MkdirAll(dockerHome, 0600)
95112

@@ -103,21 +120,15 @@ func (p Plugin) Exec() error {
103120
// login to the Docker registry
104121
if p.Login.Password != "" {
105122
cmd := commandLogin(p.Login)
106-
err := cmd.Run()
123+
raw, err := cmd.CombinedOutput()
107124
if err != nil {
108-
return fmt.Errorf("Error authenticating: %s", err)
125+
out := string(raw)
126+
out = strings.Replace(out, "WARNING! Using --password via the CLI is insecure. Use --password-stdin.", "", -1)
127+
fmt.Println(out)
128+
return fmt.Errorf("Error authenticating: exit status 1")
109129
}
110130
}
111131

112-
switch {
113-
case p.Login.Password != "":
114-
fmt.Println("Detected registry credentials")
115-
case p.Login.Config != "":
116-
fmt.Println("Detected registry credentials file")
117-
default:
118-
fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.")
119-
}
120-
121132
if p.Build.Squash && !p.Daemon.Experimental {
122133
fmt.Println("Squash build flag is only available when Docker deamon is started with experimental flag. Ignoring...")
123134
p.Build.Squash = false

docker/docker/Dockerfile.linux.amd64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker:20.10.7-dind
1+
FROM docker:20.10.9-dind
22

33
ENV DOCKER_HOST=unix:///var/run/docker.sock
44

pipeline.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local test_pipeline_name = 'testing';
55
local windows(os) = os == 'windows';
66

77
local golang_image(os, version) =
8-
'golang:' + '1.11' + if windows(os) then '-windowsservercore-' + version else '';
8+
'golang:' + '1.13' + if windows(os) then '-windowsservercore-' + version else '';
99

1010
{
1111
test(os='linux', arch='amd64', version='')::

0 commit comments

Comments
 (0)