Skip to content

Commit

Permalink
build: Add tag-build recipe to Makefile (#38481)
Browse files Browse the repository at this point in the history
Add a `tag-build` recipe to the Makefile to kick off a tag build on
GitHub Actions. Currently we cannot trigger the tag build in GitHub
Actions as the teleport repository is public so we are very careful with
credentials in it, and credentials are needed to run the `tag-build`
workflow in the `teleport.e` repository.

The new process for building a tag is to run `make update-tag` as usual,
but to then follow that with `make tag-build` to start the build.
  • Loading branch information
camscale authored Feb 26, 2024
1 parent 5e99fca commit 523c287
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ teleport-hot-reload:
--build="make $(BUILDDIR)/teleport" \
--command="$(BUILDDIR)/teleport $(TELEPORT_ARGS)"

# NOTE: Any changes to the `tsh` build here must be copied to `windows.go` in Dronegen until
# we can use this Makefile for native Windows builds.
# NOTE: Any changes to the `tsh` build here must be copied to `build.assets/windows/build.ps1`
# until we can use this Makefile for native Windows builds.
.PHONY: $(BUILDDIR)/tsh
$(BUILDDIR)/tsh: KUBECTL_VERSION ?= $(shell go run ./build.assets/kubectl-version/main.go)
$(BUILDDIR)/tsh: KUBECTL_SETVERSION ?= -X k8s.io/component-base/version.gitVersion=$(KUBECTL_VERSION)
Expand Down Expand Up @@ -1157,8 +1157,13 @@ $(VERSRC): Makefile
# 3. Run `make update-version`
# 4. Commit version changes to git
# 5. Make sure it all builds (`make release` or equivalent)
# 6. Run `make update-tag` to tag repos with $(VERSION)
# 7. Run `make tag-build` to build the tag on GitHub Actions
# 8. Run `make tag-publish` after `make-build` tag has completed to
# publish the built artifacts.
#
# After the above is done, run `make update-tag` and follow your build on Drone.
# GHA tag builds: https://github.com/gravitational/teleport.e/actions/workflows/tag-build.yaml
# GHA tag publish: https://github.com/gravitational/teleport.e/actions/workflows/tag-publish.yaml
.PHONY: update-tag
update-tag: TAG_REMOTE ?= origin
update-tag:
Expand All @@ -1169,6 +1174,19 @@ update-tag:
(cd e && git tag $(GITTAG) && git push origin $(GITTAG))
git push $(TAG_REMOTE) $(GITTAG) && git push $(TAG_REMOTE) api/$(GITTAG)

# Builds a tag build on GitHub Actions.
# Starts a tag publish run using e/.github/workflows/tag-build.yaml
# for the tag v$(VERSION).
.PHONY: tag-build
tag-build:
@which gh >/dev/null 2>&1 || { echo 'gh command needed. https://github.com/cli/cli'; exit 1; }
gh workflow run tag-build.yaml \
--repo gravitational/teleport.e \
--ref "v$(VERSION)" \
-f "oss-teleport-repo=$(shell gh repo view --json nameWithOwner --jq .nameWithOwner)" \
-f "oss-teleport-ref=v$(VERSION)"
@echo See runs at: https://github.com/gravitational/teleport.e/actions/workflows/tag-build.yaml

# Publishes a tag build.
# Starts a tag publish run using e/.github/workflows/tag-publish.yaml
# for the tag v$(VERSION).
Expand Down

0 comments on commit 523c287

Please sign in to comment.