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

[v15] Add tag build support to Makefile #38661

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 40 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ TELEPORT_ARGS ?= start
teleport-hot-reload:
CompileDaemon --graceful-kill=true --exclude-dir=".git" --exclude-dir="node_modules" --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 @@ -421,7 +421,7 @@ clean-ui:

# RELEASE_DIR is where release artifact files are put, such as tarballs, packages, etc.
$(RELEASE_DIR):
mkdir $@
mkdir -p $@

.PHONY:
export
Expand Down Expand Up @@ -468,6 +468,11 @@ build-archive: | $(RELEASE_DIR)
echo $(GITTAG) > teleport/VERSION
tar $(TAR_FLAGS) -c teleport | gzip -n > $(RELEASE).tar.gz
cp $(RELEASE).tar.gz $(RELEASE_DIR)
# linux-amd64 generates a centos7-compatible archive. Make a copy with the -centos7 label,
# for the releases page. We should probably drop that at some point.
$(if $(filter linux-amd64,$(OS)-$(ARCH)), \
cp $(RELEASE).tar.gz $(RELEASE_DIR)/$(subst amd64,amd64-centos7,$(RELEASE)).tar.gz \
)
rm -rf teleport
@echo "---> Created $(RELEASE).tar.gz."

Expand Down Expand Up @@ -1142,8 +1147,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 @@ -1154,6 +1164,32 @@ 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).
.PHONY: tag-publish
tag-publish:
@which gh >/dev/null 2>&1 || { echo 'gh command needed. https://github.com/cli/cli'; exit 1; }
gh workflow run tag-publish.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-publish.yaml

.PHONY: test-package
test-package: remove-temp-files
go test -v ./$(p)
Expand Down
2 changes: 1 addition & 1 deletion e
Submodule e updated from f7e770 to 71bdd5
Loading