Skip to content

Commit

Permalink
Enable building teleport with the new UI location (gravitational#20361)
Browse files Browse the repository at this point in the history
* Changes for merging webapps into teleport.
  • Loading branch information
hatched authored Jan 18, 2023
1 parent a1b3b1c commit 34f102b
Show file tree
Hide file tree
Showing 23 changed files with 184 additions and 408 deletions.
135 changes: 29 additions & 106 deletions .drone.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/doc-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
uses: actions/checkout@v3

- name: Run tests
run: cd /src/content && yarn markdown-lint
run: cd /src && yarn markdown-lint
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ go.work.sum

# Buf side-effects
/github.com
node_modules

.air.toml
webassets/
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "e"]
path = e
url = [email protected]:gravitational/teleport.e.git
[submodule "webassets"]
path = webassets
url = https://github.com/gravitational/webassets.git
63 changes: 34 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ CGOFLAG_TSH ?= $(CGOFLAG)
#
# 'make all' builds all 3 executables and places them in the current directory.
#
# IMPORTANT: the binaries will not contain the web UI assets and `teleport`
# won't start without setting the environment variable DEBUG=1
# This is the default build target for convenience of working on
# a web UI.
# IMPORTANT:
# Unless called with the `WEBASSETS_TAG` env variable set to "webassets_embed"
# the binaries will not contain the web UI assets and `teleport` won't start
# without setting the environment variable DEBUG=1.
.PHONY: all
all: version
@echo "---> Building OSS binaries."
Expand Down Expand Up @@ -378,7 +378,7 @@ endif
# make full-ent - Builds Teleport enterprise binaries
#
.PHONY:full-ent
full-ent:
full-ent: ensure-webassets-e
ifneq ("$(OS)", "windows")
@if [ -f e/Makefile ]; then $(MAKE) -C e full; fi
endif
Expand All @@ -387,7 +387,7 @@ endif
# make clean - Removes all build artifacts.
#
.PHONY: clean
clean:
clean: clean-ui
@echo "---> Cleaning up OSS build artifacts."
rm -rf $(BUILDDIR)
# Check if the variable is set to prevent calling remove on the root directory.
Expand All @@ -404,13 +404,18 @@ endif
rm -f gitref.go
rm -rf build.assets/tooling/bin

.PHONY: clean-ui
clean-ui:
rm -rf webassets/*
find . -type d -name node_modules -prune -exec rm -rf {} \;

#
# make release - Produces a binary release tarball.
#
.PHONY:
export
release:
@echo "---> $(RELEASE_MESSAGE)"
@echo "---> OSS $(RELEASE_MESSAGE)"
ifeq ("$(OS)", "windows")
$(MAKE) --no-print-directory release-windows
else ifeq ("$(OS)", "darwin")
Expand Down Expand Up @@ -600,8 +605,9 @@ helmunit/installed:
# The CI environment is responsible for setting HELM_PLUGINS to a directory where
# quintish/helm-unittest is installed.
#
# The unittest plugin changed in teleport12, if the tests are failing, please ensure
# you are using https://github.com/quintush/helm-unittest and not the vbehar fork.
# Github Actions build uses /workspace as homedir and Helm can't pick up plugins by default there,
# so override the plugin location via environemnt variable when running in CI. Github Actions provide CI=true
# environment variable.
.PHONY: test-helm
test-helm: helmunit/installed
helm unittest -3 examples/chart/teleport-cluster
Expand Down Expand Up @@ -1197,37 +1203,20 @@ test-compat:
.PHONY: ensure-webassets
ensure-webassets:
@if [ ! -d $(shell pwd)/webassets/teleport/ ]; then \
$(MAKE) init-webapps-submodules; \
$(MAKE) build-ui; \
fi;

.PHONY: ensure-webassets-e
ensure-webassets-e:
@if [ ! -d $(shell pwd)/webassets/e/teleport ]; then \
$(MAKE) init-webapps-submodules-e; \
$(MAKE) build-ui-e; \
fi;

.PHONY: init-webapps-submodules
init-webapps-submodules:
echo "init webassets submodule"
git submodule update --init webassets

.PHONY: init-webapps-submodules-e
init-webapps-submodules-e:
echo "init webassets oss and enterprise submodules"
git submodule update --init --recursive webassets

.PHONY: init-submodules-e
init-submodules-e: init-webapps-submodules-e
init-submodules-e:
git submodule init e
git submodule update

# update-webassets creates a PR in the teleport repo to update webassets submodule.
.PHONY: update-webassets
update-webassets: WEBASSETS_BRANCH ?= 'master'
update-webassets: TELEPORT_BRANCH ?= 'master'
update-webassets:
build.assets/webapps/update-teleport-webassets.sh -w $(WEBASSETS_BRANCH) -t $(TELEPORT_BRANCH)

# dronegen generates .drone.yml config
#
# Usage:
Expand All @@ -1245,3 +1234,19 @@ dronegen:
.PHONY: backport
backport:
(cd ./assets/backport && go run main.go -pr=$(PR) -to=$(TO))

.PHONY: ensure-js-deps
ensure-js-deps:
yarn install --ignore-scripts

.PHONY: build-ui
build-ui: ensure-js-deps
yarn build-ui-oss

.PHONY: build-ui-e
build-ui-e: ensure-js-deps
yarn build-ui-e

.PHONY: docker-ui
docker-ui:
$(MAKE) -C build.assets ui
19 changes: 8 additions & 11 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ GOMODCACHE ?= /tmp/gomodcache
# TODO(hugoShaka) remove HELM_PLUGINS with teleport13 buildbox
DOCKERFLAGS := --rm=true -v "$$(pwd)/../":$(SRCDIR) -v /tmp:/tmp -w $(SRCDIR) -h $(HOSTNAME) -e GOMODCACHE=$(GOMODCACHE) -e HELM_PLUGINS=/home/ci/.local/share/helm/plugins-new

# delete after webapps migration to teleport
WEBAPPSSRCDIR=/go/src/github.com/gravitational/webapps
WEBAPPSDOCKERFLAGS := $(DOCKERFLAGS) -v "$$(pwd)/../../webapps":$(WEBAPPSSRCDIR)

ADDFLAGS ?=
BATSFLAGS :=
NOROOT=-u $$(id -u):$$(id -g)
Expand Down Expand Up @@ -239,7 +235,6 @@ buildbox-teleterm: buildbox
--cache-from $(BUILDBOX_TELETERM) \
--tag $(BUILDBOX_TELETERM) -f Dockerfile-teleterm .


CONNECT_VERSION ?= $(VERSION)
ifeq ($(CONNECT_VERSION),)
CONNECT_VERSION := $(BUILDBOX_VERSION)-dev
Expand All @@ -248,14 +243,15 @@ endif
#
# Builds Teleport Connect inside the buildbox-teleterm container.
#
# Note: this assumes that gravitational/webapps already exists on the filesystem
# and is a sibling directory to Teleport. This is temporary and will be
# resolved when the webapps code is moved into this repository.
#
.PHONY:teleterm
teleterm: buildbox-teleterm
docker run $(WEBAPPSDOCKERFLAGS) $(NOROOT) $(BUILDBOX_TELETERM) \
bash -c "cd ../webapps && export CONNECT_TSH_BIN_PATH=\$$PWD/../teleport/build/tsh && yarn install --frozen-lockfile && yarn build-term && yarn package-term -c.extraMetadata.version=$(CONNECT_VERSION)"
docker run $(DOCKERFLAGS) $(NOROOT) $(BUILDBOX_TELETERM) \
bash -c "cd $(SRCDIR) && export CONNECT_TSH_BIN_PATH=\$$PWD/../teleport/build/tsh && yarn install --frozen-lockfile && yarn build-term && yarn package-term -c.extraMetadata.version=$(CONNECT_VERSION)"

.PHONY:ui
ui: buildbox
docker run -v "$$(pwd)/../":/teleport $(BUILDBOX) \
bash -c "cd ../teleport && yarn install --frozen-lockfile && yarn build-ui"

# grpc generates GRPC stubs from inside the buildbox
.PHONY: grpc
Expand Down Expand Up @@ -396,6 +392,7 @@ enter/teleterm: buildbox-teleterm
#
.PHONY:release
release: buildbox
@echo "Build Assets Release"
docker run $(DOCKERFLAGS) $(NOROOT) $(BUILDBOX_NAME) \
/usr/bin/make release -e ADDFLAGS="$(ADDFLAGS)" OS=$(OS) ARCH=$(ARCH) RUNTIME=$(GOLANG_VERSION) FIDO2=$(FIDO2) PIV=$(PIV) REPRODUCIBLE=yes

Expand Down
25 changes: 0 additions & 25 deletions build.assets/webapps/README.md

This file was deleted.

86 changes: 0 additions & 86 deletions build.assets/webapps/update-teleport-webassets.sh

This file was deleted.

18 changes: 0 additions & 18 deletions build.assets/webapps/webapps-version.ps1

This file was deleted.

23 changes: 0 additions & 23 deletions build.assets/webapps/webapps-version.sh

This file was deleted.

Loading

0 comments on commit 34f102b

Please sign in to comment.