Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ec30ef1
Added multiarch build support for teleport oss, ent, and fips
fheinecke Sep 23, 2022
7685a16
Exported image/imageTag types
fheinecke Sep 26, 2022
394dd8e
Resigned dronegen
fheinecke Sep 27, 2022
31e475a
Removed remainder of testing changes
fheinecke Sep 27, 2022
e4304e7
Removed changes to submodules
fheinecke Sep 27, 2022
43b212f
Merge branch 'master' into fred/multiarch-teleport-container-images
fheinecke Sep 27, 2022
a98000e
Reverted dockerfile-fips change
fheinecke Sep 28, 2022
0d04218
FIxed docs wording
fheinecke Sep 28, 2022
14bf340
Un-exported most constants
fheinecke Sep 28, 2022
98fca41
Removed teleport.e makefile deb call
fheinecke Sep 28, 2022
186a98c
Moved "sed | cut magic" to files
fheinecke Oct 3, 2022
a2cad2d
Re-added `mkdir -pv /go/cache` to push.go
fheinecke Oct 3, 2022
a4defc5
Command deterministic order fix
fheinecke Oct 3, 2022
dbf8717
Added staging-only tag pipeline
fheinecke Oct 3, 2022
8b22ce7
Moved PR to teleport operator to minimize potential issue impact
fheinecke Oct 4, 2022
3d806f4
Updated promote to pull and push without build
fheinecke Oct 4, 2022
0144af4
Made cron triggers not affect canonical tags
fheinecke Oct 4, 2022
1689c9b
Added check for pre-existing tags on immutable CRs
fheinecke Oct 4, 2022
f6082d3
Added immutability check to manifests
fheinecke Oct 4, 2022
5df9de8
Updated staging ecr to only apply $TIMESTAMP tag on cron triggers
fheinecke Oct 4, 2022
c71ea40
Updated triggerinfo struct to use a triggerflag struct
fheinecke Oct 4, 2022
06bf80b
Fixed makefile after git mistake
fheinecke Oct 4, 2022
8d06bb8
Makefile fix
fheinecke Oct 4, 2022
f16059f
Merge branch 'master' into fred/multiarch-teleport-container-images
fheinecke Oct 4, 2022
c5418b8
Merge branch 'master' into fred/multiarch-teleport-container-images
fheinecke Oct 4, 2022
cdde57d
PR fixes
fheinecke Oct 7, 2022
9c9bd64
Moved internal tools Go version to constant
fheinecke Oct 13, 2022
06e99c4
Separated container images gofile into multiple files
fheinecke Oct 13, 2022
2cf7a2b
Moved testing comment
fheinecke Oct 13, 2022
ecc65bf
Added licenses
fheinecke Oct 13, 2022
666aed9
Reorganized and added docs for container images
fheinecke Oct 13, 2022
a9e339c
Merge branch 'master' into fred/multiarch-teleport-container-images
fheinecke Oct 18, 2022
f694317
Moved const to correct file
fheinecke Oct 18, 2022
e08f422
Tag trigger logic test
fheinecke Oct 18, 2022
dc11b97
Testing specific fix
fheinecke Oct 18, 2022
9961f11
Moved testing to v10.3.2
fheinecke Oct 18, 2022
c8849f0
Make semver dirs
fheinecke Oct 18, 2022
2ad16dd
Refactored local registry name/socket
fheinecke Oct 18, 2022
527c738
Merged previous dockerfile changes
fheinecke Oct 18, 2022
c4d43df
Added TARGETOS TARGETARCH args
fheinecke Oct 18, 2022
1b38f68
Updatd tag to testing tag
fheinecke Oct 18, 2022
dc3963c
Promotion logic test
fheinecke Oct 18, 2022
a51aefc
Promotion fixes
fheinecke Oct 18, 2022
7bbcf92
Testing specific fix
fheinecke Oct 18, 2022
722584f
Removed prerelease check for testing
fheinecke Oct 18, 2022
5d6de2a
Added staging login commands to promote
fheinecke Oct 18, 2022
907c5e1
Fixed missing credentials on promotion pull
fheinecke Oct 18, 2022
10b73af
Rerun tag test with new "full" semver
fheinecke Oct 18, 2022
85f710b
Made staging builds only publish full semver
fheinecke Oct 18, 2022
9719fc2
Added semver logging command
fheinecke Oct 18, 2022
4e121a7
Empty commit to trigger Drone
fheinecke Oct 19, 2022
f4fb7d8
Promotion test
fheinecke Oct 19, 2022
645574d
Fixed preceeding v on promote pull
fheinecke Oct 19, 2022
f76bc4d
Empty commit to trigger Drone
fheinecke Oct 19, 2022
85dfec6
Re-enabled verify not prerelease step on promote
fheinecke Oct 19, 2022
f42c002
Cron trigger test
fheinecke Oct 19, 2022
e21d39d
Testing fix
fheinecke Oct 19, 2022
ebcaf0b
Testing fix 2
fheinecke Oct 19, 2022
c745313
Added sleep timer on docker buildx build
fheinecke Oct 19, 2022
a90b6d3
Testing cleanup
fheinecke Oct 19, 2022
299af25
Merge branch 'master' into fred/multiarch-teleport-container-images
fheinecke Oct 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,008 changes: 2,927 additions & 81 deletions .drone.yml

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ VERSION=12.0.0-dev
DOCKER_IMAGE_QUAY ?= quay.io/gravitational/teleport
DOCKER_IMAGE_ECR ?= public.ecr.aws/gravitational/teleport
DOCKER_IMAGE_STAGING ?= 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport
DOCKER_IMAGE_OPERATOR_STAGING ?= 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-operator


GOPATH ?= $(shell go env GOPATH)
Expand Down Expand Up @@ -1035,23 +1034,6 @@ publish-ci: image-ci
fi
if [ -f e/Makefile ]; then $(MAKE) -C e publish-ci; fi

# Docker image build for Teleport Operator
.PHONY: image-operator-ci
image-operator-ci:
make -C operator docker-build IMG="$(DOCKER_IMAGE_OPERATOR_STAGING):$(VERSION)"

# DOCKER_CLI_EXPERIMENTAL=enabled is set to allow inspecting the manifest for present images.
# https://docs.docker.com/engine/reference/commandline/cli/#experimental-features
# The internal staging images use amazon ECR's immutable repository settings. This makes overwrites impossible currently.
# This can cause issues when drone tagging pipelines must be re-run due to failures.
# Currently the work around for this is to not attempt to push to the image when it already exists.
.PHONY: publish-operator-ci
publish-operator-ci: image-operator-ci
@if DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect "$(DOCKER_IMAGE_OPERATOR_STAGING):$(VERSION)" >/dev/null 2>&1; then \
echo "$(DOCKER_IMAGE_OPERATOR_STAGING):$(VERSION) already exists. "; \
else \
docker push "$(DOCKER_IMAGE_OPERATOR_STAGING):$(VERSION)"; \
fi

.PHONY: print-version
print-version:
Expand Down
2 changes: 2 additions & 0 deletions build.assets/images.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Those variables are extracted from build.assets/Makefile so they can be imported
# by other Makefiles
# These values may need to be updated in `dronegen/container_image_products.go` if
# they change here
BUILDBOX_VERSION ?= teleport11

BUILDBOX=public.ecr.aws/gravitational/teleport-buildbox:$(BUILDBOX_VERSION)
Expand Down
88 changes: 70 additions & 18 deletions dronegen/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const (
// ProductionRegistryQuay is the production image registry that hosts images on quay.io. Will be deprecated in the future.
// See RFD 73 - https://github.com/gravitational/teleport/blob/c18c09f5d562dd46a509154eab4295ad39decc3c/rfd/0073-public-image-registry.md
ProductionRegistryQuay = "quay.io"

// Go version used by internal tools
GoVersion = "1.18"

// The name of this service must match k8s.io/apimachinery/pkg/util/validation `IsDNS1123Subdomain`
// so that it is resolvable
// See https://github.com/drone-runners/drone-runner-kube/blob/master/engine/compiler/compiler.go#L398
// for details
LocalRegistryHostname string = "drone-docker-registry"
LocalRegistrySocket string = LocalRegistryHostname + ":5000"
)

var (
Expand Down Expand Up @@ -105,12 +115,20 @@ func pushTriggerForBranch(branches ...string) trigger {
return t
}

func cronTrigger(cronJobNames []string) trigger {
return trigger{
Cron: triggerRef{Include: cronJobNames},
Repo: triggerRef{Include: []string{"gravitational/teleport"}},
}
}

func cloneRepoCommands(cloneDirectory, commit string) []string {
return []string{
fmt.Sprintf("mkdir -pv %q", cloneDirectory),
fmt.Sprintf("cd %q", cloneDirectory),
`git init && git remote add origin ${DRONE_REMOTE_URL}`,
`git fetch origin --tags`,
"git init",
"git remote add origin ${DRONE_REMOTE_URL}",
"git fetch origin --tags",
fmt.Sprintf("git checkout -qf %q", commit),
}
}
Expand Down Expand Up @@ -215,6 +233,27 @@ func dockerService(v ...volumeRef) service {
}
}

// Starts a container registry service at `LocalRegistrySocket`
// This can be pushed/pulled to via `docker push/pull <LocalRegistrySocket>:5000/image:tag`
func dockerRegistryService() service {
return service{
Name: LocalRegistryHostname,
Image: "registry:2",
}
}

// dockerVolumes returns a slice of volumes
// It includes the Docker socket volume by default, plus any extra volumes passed in
func dockerVolumes(v ...volume) []volume {
return append(v, volumeDocker)
}

// dockerVolumeRefs returns a slice of volumeRefs
// It includes the Docker socket volumeRef as a default, plus any extra volumeRefs passed in
func dockerVolumeRefs(v ...volumeRef) []volumeRef {
return append(v, volumeRefDocker)
}

// releaseMakefileTarget gets the correct Makefile target for a given arch/fips/centos combo
func releaseMakefileTarget(b buildType) string {
makefileTarget := fmt.Sprintf("release-%s", b.arch)
Expand Down Expand Up @@ -251,17 +290,23 @@ func waitForDockerStep() step {
}
}

func verifyValidPromoteRunSteps(checkoutPath, commit string, isParallelismEnabled bool) []step {
tagStep := verifyTaggedStep()
cloneStep := cloneRepoStep(checkoutPath, commit)
verifyStep := verifyNotPrereleaseStep(checkoutPath)

if isParallelismEnabled {
cloneStep.DependsOn = []string{tagStep.Name}
verifyStep.DependsOn = []string{cloneStep.Name}
// waitForDockerStep returns a step which checks that the Docker registry is ready
func waitForDockerRegistryStep() step {
return step{
Name: "Wait for docker registry",
Image: "alpine",
Commands: []string{
"apk add curl",
fmt.Sprintf(`timeout 30s /bin/sh -c 'while [ "$(curl -s -o /dev/null -w %%{http_code} http://%s/)" != "200" ]; do sleep 1; done'`, LocalRegistrySocket),
},
}
}

return []step{tagStep, cloneStep, verifyStep}
func verifyValidPromoteRunSteps() []step {
tagStep := verifyTaggedStep()
verifyStep := verifyNotPrereleaseStep()

return []step{tagStep, verifyStep}
}

func verifyTaggedStep() step {
Expand All @@ -283,13 +328,20 @@ func cloneRepoStep(clonePath, commit string) step {
}
}

func verifyNotPrereleaseStep(checkoutPath string) step {
func verifyNotPrereleaseStep() step {
clonePath := "/tmp/repo"
commands := []string{
"apk add git",
}
commands = append(commands, cloneRepoCommands(clonePath, "${DRONE_TAG}")...)
commands = append(commands,
fmt.Sprintf("cd %q", path.Join(clonePath, "build.assets", "tooling")),
"go run ./cmd/check -tag ${DRONE_TAG} -check prerelease || (echo '---> This is a prerelease, not continuing promotion for ${DRONE_TAG}' && exit 78)",
)

return step{
Name: "Check if tag is prerelease",
Image: "golang:1.18-alpine",
Commands: []string{
fmt.Sprintf("cd %q", path.Join(checkoutPath, "build.assets", "tooling")),
"go run ./cmd/check -tag ${DRONE_TAG} -check prerelease || (echo '---> This is a prerelease, not continuing promotion for ${DRONE_TAG}' && exit 78)",
},
Name: "Check if tag is prerelease",
Image: fmt.Sprintf("golang:%s-alpine", GoVersion),
Commands: commands,
}
}
Loading