0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-22 20:20:39 +00:00

Merge pull request #223 from appleboy/patch

feat(version): support 18.06.0 tag format.
This commit is contained in:
Thomas Boerger 2019-02-12 14:37:46 +01:00 committed by GitHub
commit 1086846ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 7 deletions

View File

@ -1,4 +1,4 @@
FROM docker:18.06-dind
FROM arm32v6/docker:18.06-dind
ADD release/linux/arm/drone-docker /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]

View File

@ -1,4 +1,4 @@
FROM docker:18.06-dind
FROM arm64v8/docker:18.06-dind
ADD release/linux/arm64/drone-docker /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]

1
go.sum
View File

@ -1,5 +1,6 @@
github.com/aws/aws-sdk-go v1.16.15 h1:kQyxfRyjAwIYjf0225sn/pn+WAlncKyI8dmT3+ItMFE=
github.com/aws/aws-sdk-go v1.16.15/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77 h1:bXc5tB7PFVzIHUfTECDt0Orw6mIAzHePWBmemvtnfiU=
github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77/go.mod h1:4SmsVk3pOgYeJlG54e23Ztd/HucXeH5RmH5bNO+uOpk=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=

25
tags.go
View File

@ -24,6 +24,16 @@ func DefaultTagSuffix(ref, suffix string) []string {
return tags
}
func splitOff(input string, delim string) string {
parts := strings.SplitN(input, delim, 2)
if len(parts) == 2 {
return parts[0]
}
return input
}
// DefaultTags returns a set of default suggested tags based on
// the commit ref.
func DefaultTags(ref string) []string {
@ -40,16 +50,21 @@ func DefaultTags(ref string) []string {
version.String(),
}
}
v = stripTagPrefix(ref)
v = splitOff(splitOff(v, "+"), "-")
dotParts := strings.SplitN(v, ".", 3)
if version.Major == 0 {
return []string{
fmt.Sprintf("%d.%d", version.Major, version.Minor),
fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Patch),
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
}
}
return []string{
fmt.Sprint(version.Major),
fmt.Sprintf("%d.%d", version.Major, version.Minor),
fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Patch),
fmt.Sprintf("%0*d", len(dotParts[0]), version.Major),
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
}
}

View File

@ -93,6 +93,15 @@ func TestDefaultTagSuffix(t *testing.T) {
"1.9.2-nanoserver",
},
},
{
Before: "refs/tags/v18.06.0",
Suffix: "nanoserver",
After: []string{
"18-nanoserver",
"18.06-nanoserver",
"18.06.0-nanoserver",
},
},
}
for _, test := range tests {