Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
70 changes: 59 additions & 11 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load('ext://restart_process', 'docker_build_with_restart')

if not os.path.exists("./charts/mccp/charts"):
# Download chart deps on first run. This command is slow, so you'd have to
# re-run it yourself if you upgrade the chart
Expand Down Expand Up @@ -36,16 +38,62 @@ docker_build('weaveworks/cluster-controller', '../cluster-controller/')
docker_build('weaveworks/cluster-bootstrap-controller', '../cluster-bootstrap-controller/',
build_args={'GITHUB_BUILD_USERNAME': 'wge-build-bot', 'GITHUB_BUILD_TOKEN': os.getenv('GITHUB_TOKEN')}
)
docker_build(
'weaveworks/weave-gitops-enterprise-clusters-service',
'.',
dockerfile='cmd/clusters-service/Dockerfile',
build_args={'GITHUB_BUILD_TOKEN': os.getenv('GITHUB_TOKEN'), 'image_tag': 'tilt'}
)
docker_build(
'weaveworks/weave-gitops-enterprise-ui-server',
'ui-cra',
build_args={'GITHUB_TOKEN': os.getenv('GITHUB_TOKEN')}
)

native_build = os.getenv('NATIVE_BUILD', False)

if native_build:
local_resource(
'clusters-service',
'GOOS=linux GOARCH=amd64 make build',
deps=[
'./cmd/clusters-service',
],
ignore=[
'./cmd/clusters-service/bin'
],
dir='cmd/clusters-service',
)

local_resource(
'ui',
'make build',
deps=[
'./ui-cra/src',
],
dir='ui-cra',
)

docker_build_with_restart(
'weaveworks/weave-gitops-enterprise-clusters-service',
'.',
dockerfile="cmd/clusters-service/dev.dockerfile",
entrypoint='/app/clusters-service',
build_args={'GITHUB_BUILD_TOKEN': os.getenv('GITHUB_TOKEN'), 'image_tag': 'tilt'},
live_update=[
sync('cmd/clusters-service/bin', '/app'),
],
ignore=[
'cmd/clusters-service/clusters-service'
]
)

docker_build(
'weaveworks/weave-gitops-enterprise-ui-server',
'ui-cra',
dockerfile="ui-cra/dev.dockerfile",
build_args={'GITHUB_TOKEN': os.getenv('GITHUB_TOKEN')},
)
else:
docker_build(
'weaveworks/weave-gitops-enterprise-clusters-service',
'.',
dockerfile='cmd/clusters-service/Dockerfile',
build_args={'GITHUB_BUILD_TOKEN': os.getenv('GITHUB_TOKEN'), 'image_tag': 'tilt'}
)
docker_build(
'weaveworks/weave-gitops-enterprise-ui-server',
'ui-cra',
build_args={'GITHUB_TOKEN': os.getenv('GITHUB_TOKEN')}
)

k8s_resource('chart-mccp-cluster-service', port_forwards='8000')
1 change: 1 addition & 0 deletions cmd/clusters-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
clusters-service
bin
4 changes: 2 additions & 2 deletions cmd/clusters-service/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ install:

.PHONY: build
build:
go build -o clusters-service main.go
go build -o bin/clusters-service main.go

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
Expand Down Expand Up @@ -42,4 +42,4 @@ unit-tests:
# Runs all tests, including integration tests
.PHONY: tests
tests:
@go test -v ./... -tags=integration
@go test -v ./... -tags=integration
7 changes: 7 additions & 0 deletions cmd/clusters-service/dev.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine

RUN apk add --no-cache ca-certificates tini

RUN addgroup -S clusters-service && adduser -S clusters-service -G clusters-service

COPY ./cmd/clusters-service/bin /app
6 changes: 6 additions & 0 deletions ui-cra/dev.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine

RUN mkdir /html
COPY ./build /html

CMD ["sh", "-c", "mv -v /html/* /target/"]