Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v12] drone: Replace tag build pipelines with GHA workflows #35540

Merged
merged 8 commits into from
Dec 8, 2023

Conversation

camscale
Copy link
Contributor

@camscale camscale commented Dec 8, 2023

Replace the remaining tag build pipelines that are currently built on
drone with calls to GitHub Actions workflows instead. Also update the
build-linux-arm64 pipeline to call the common release-linux workflow
instead of the arm64-specific release-linux-arm64 workflow.

The following pipelines were updated:

  • build-linux-amd64
  • build-linux-amd64-fips
  • build-linux-386
  • build-linux-arm64
  • build-linux-arm

The following pipelines were added:

  • build-legacy-amis
  • build-oci

The following pipelines were removed:

  • build-linux-amd64-deb
  • build-linux-amd64-fips-deb
  • build-linux-amd64-centos7-rpm
  • build-linux-amd64-centos7-fips-rpm
  • build-linux-386-deb
  • build-linux-386-rpm
  • build-linux-arm64-deb
  • build-linux-arm64-rpm
  • build-linux-arm-deb
  • build-linux-arm-rpm
  • build-oss-amis
  • build-ent-amis
  • teleport-container-images-branch-tag
  • build-linux-amd64-centos7
  • build-linux-amd64-centos7-fips

The deb/rpm pipelines are no longer needed as the GHA workflow for
building linux release builds these OS packages. The centos7 pipelines
are not needed as they generate the same artifacts as the non-centos7
pipelines (this removes some redundant build steps). The oss/ent ami
pipelines were manually added before and the pair of them have been
replaced with a single GHA workflow. The container images pipeline is
replaced with the build-oci pipeline, building the legacy OCIs and the
operator OCIs.

Update e to bring in github workflow changes and bump the Go version.

Issue: #20729
Backport: #35235

Unroll the loops over architectures, fips and package type and just list
all the pipelines explicitly. This makes it a bit easier to understand
the combinations and to replace them with GitHub actions workflows.

Running `make dronegen` results in no changes to `.drone.yml`.
Convert some of the linux-based tag build pipelines to run on GitHub
Actions. The following pipelines have been converted:

    build-linux-amd64
    build-linux-amd64-centos7
    build-linux-amd64-centos7-fips
    build-linux-386
    build-linux-arm
    build-linux-amd64-deb
    build-linux-amd64-deb-fips
    build-linux-amd64-centos7-rpm
    build-linux-amd64-centos7-fips-rpm
    build-linux-386-deb
    build-linux-386-rpm
    build-linux-arm-deb
    build-linux-arm-rpm

The GHA workflows builds tarballs as well as deb/rpm packages in the one
workflow, so the `-deb` and `-rpm` pipelines will need to be manually
removed from `.drone.yml`. The amd64 centos7 and non-centos7 pipelines
have been combined as they were calling the same `make` target
duplicating work. The amd64 build is always done on centos7. As a
result, we do not name the pipeline with -centos7 any more, but we do
still specify it as the build.assets `Makefile` still has a centos7
target which is called, and we do still release an asset named with
"centos7".

Still remaining of the linux-based tag build pipelines are the arm64
pipelines which are already converted using a different workflow and the
non-native windows build.
Convert the build-linux-arm64 and push-build-linux-arm64 pipelines to
use the common `release-linux` workflow instead of the arm64-specific
`release-linux-arm64` workflow. This aligns it with the other linux
build pipelines and allows us to get rid of the specific workflow.

The pipelines for building the arm64 rpm and deb packages have not been
generated by dronegen for some time now - since the arm64 build was
converted to GitHub Actions. The OS packages were still built as
dronegen does not remove pipelines, so the existing pipelines from
before the GHA migration remained in `.drone.yml` and continued to run.

These os packaging pipelines will be manually removed in a subsequent
commit.
Generate a pipeline for calling a GitHub Actions workflow to generate
the legacy AMIs. There were two existing manually added pipelines -
`build-oss-amis` and `build-ent-amis` - that are replaced by this.

The new pipeline needs to be manually added and the old ones manually
removed.
Replace the `teleport-container-images-branch-tag` workflow that builds
the legacy and operator OCI images with a call to the GitHub Actions
workflow that does the same on GitHub Actions.

This requires the manual addition of the `build-oci` pipeline and manual
removal of the `teleport-container-images-branch-tag` pipeline, followed
by running `make dronegen` to flesh out `build-oci` and sign .drone.yml.
Remove the now-unused functions and vars after converting pipelines to
calling GitHub Actions instead of running stuff on Drone.
Update .drone.yml by running `make dronegen` to update the following
pipelines to call GitHub Actions to build instead of building on Drone:

build-linux-amd64
build-linux-amd64-fips
build-linux-386
build-linux-arm64
build-linux-arm

Add two new pipelines for building AMIs and OCIs on GHA:

build-legacy-amis
build-oci

Remove the following pipelines as the build of deb/rpm packages are done
within the above pipelines on GitHub Actions now and the ami/oci
pipelines have been replaced:

build-linux-amd64-deb
build-linux-amd64-fips-deb
build-linux-amd64-centos7-rpm
build-linux-amd64-centos7-fips-rpm
build-linux-386-deb
build-linux-386-rpm
build-linux-arm64-deb
build-linux-arm64-rpm
build-linux-arm-deb
build-linux-arm-rpm
build-oss-amis
build-ent-amis
teleport-container-images-branch-tag

Remove the following pipelines as AMD64 builds are always centos7 builds, but
we were just doing it twice. No need for these any more, as the GHA workflow
will build the release artifacts for these with the centos7 targets:

build-linux-amd64-centos7
build-linux-amd64-centos7-fips

The pipelines were added/removed using the following script, followed by
`make dronegen`:

AWK_SCRIPT='
/^---$/ { printf "%s", accumulator; accumulator = "" }
/^---$/ || accumulator { accumulator = accumulator $0 "\n" }
/^name: / {
	drop = $2 == to_remove
	if ($2 == before && to_add) {
		printf "---\nname: %s\n", to_add
	}
	if (!drop) { printf "%s", accumulator }
	accumulator = ""
	next
}
!drop && !accumulator { print }
ENDFILE { printf "%s", accumulator }'

toremove=(
	build-linux-amd64-{centos7,centos7-fips}
	build-linux-amd64-{deb,fips-deb,centos7-rpm,centos7-fips-rpm}
	build-linux-386-{deb,rpm}
	build-linux-arm64-{deb,rpm}
	build-linux-arm-{deb,rpm}
	build-{oss,ent}-amis
	teleport-container-images-branch-tag
)
add_before=build-buildboxes
toadd=(
	build-legacy-amis
	build-oci
)

for pipeline in "${toremove[@]}"; do
	gawk -i inplace -v to_remove=$pipeline "$AWK_SCRIPT" .drone.yml
done
for pipeline in "${toadd[@]}"; do
	gawk -i inplace -v to_add=$pipeline -v before=$add_before "$AWK_SCRIPT" .drone.yml
done
Update e ref to bring in:
* [v12] ci: Remove 'v' from OCI version labels (#2821)
* [v12] chore: Bump Go to v1.20.12 (#2839)
* [v12] ci: Build single-arch images for legacy/operator OCI (#2856)
@camscale
Copy link
Contributor Author

camscale commented Dec 8, 2023

@camscale
Copy link
Contributor Author

camscale commented Dec 8, 2023

(Hopefully a) successful promotion: https://drone.platform.teleport.sh/gravitational/teleport/31628 (i'll be out the door before it finishes).

@camscale camscale added this pull request to the merge queue Dec 8, 2023
Merged via the queue into branch/v12 with commit fdb254b Dec 8, 2023
@camscale camscale deleted the camh/v12/gha-tag-build branch December 8, 2023 08:25
@camscale camscale added the no-changelog Indicates that a PR does not require a changelog entry label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants