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

build: on a dev branch automatically start the UI #4896

Merged
merged 15 commits into from
Jan 18, 2021
Merged
7 changes: 4 additions & 3 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ jobs:
if [ ${{matrix.test}} == smoke ] || [ ${{matrix.test}} == test-e2e-cron ] ; then
PROFILE=minimal
fi
KUBECONFIG=~/.kube/config make start PROFILE=$PROFILE E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} ALWAYS_OFFLOAD_NODE_STATUS=${{matrix.alwaysOffloadNodeStatus}} DEV_IMAGE=true STATIC_FILES=false 2>&1 > /tmp/log/argo-e2e/argo.log &
KUBECONFIG=~/.kube/config make install PROFILE=$PROFILE E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} ALWAYS_OFFLOAD_NODE_STATUS=${{matrix.alwaysOffloadNodeStatus}} DEV_IMAGE=true STATIC_FILES=false
KUBECONFIG=~/.kube/config make start PROFILE=$PROFILE E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} ALWAYS_OFFLOAD_NODE_STATUS=${{matrix.alwaysOffloadNodeStatus}} DEV_IMAGE=true STATIC_FILES=false 2>&1 > /tmp/log/argo-e2e/argo.log &
- name: Install gotestsum
run: go install gotest.tools/gotestsum
- name: Wait for Argo Server to be ready
Expand All @@ -123,10 +124,10 @@ jobs:
GOPATH: /home/runner/go
run: make ${{ matrix.test }} GOTEST='gotestsum --format testname --'
- name: Upload logs
if: ${{ always() }}
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.test }}-${{ github.run_id }}-argo.log
name: ${{ matrix.test }}-${{matrix.containerRuntimeExecutor}}-${{matrix.alwaysOffloadNodeStatus}}-${{ github.run_id }}-argo.log
path: /tmp/log/argo-e2e/argo.log

codegen:
Expand Down
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GIT_REMOTE = origin
GIT_BRANCH = $(shell git rev-parse --symbolic-full-name --verify --quiet --abbrev-ref HEAD)
GIT_TAG = $(shell git describe --always --tags --abbrev=0 || echo untagged)
GIT_TREE_STATE = $(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
DEV_BRANCH = $(shell [ $(GIT_BRANCH) = master ] || [ `echo $(GIT_BRANCH) | cut -c -8` = release- ] && echo false || echo true)

export DOCKER_BUILDKIT = 1

Expand Down Expand Up @@ -48,7 +49,8 @@ CONTROLLER_IMAGE_FILE := dist/controller-image.marker

# perform static compilation
STATIC_BUILD ?= true
STATIC_FILES ?= true
# should we build the static files?
STATIC_FILES ?= $(shell [ $(DEV_BRANCH) = true ] && echo false || echo true)
GOTEST ?= go test
PROFILE ?= minimal
# by keeping this short we speed up the tests
Expand All @@ -59,7 +61,7 @@ AUTH_MODE := hybrid
ifeq ($(PROFILE),sso)
AUTH_MODE := sso
endif
ifeq ($(STATIC_FILES),false)
ifneq ($(CI),)
AUTH_MODE := client
endif
# Which mode to run in:
Expand Down Expand Up @@ -168,15 +170,15 @@ images: cli-image executor-image controller-image
.PHONY: cli
cli: dist/argo argo-server.crt argo-server.key

ui/dist/app/index.html: $(shell find ui/src -type f && find ui -maxdepth 1 -type f)
# Build UI
@mkdir -p ui/dist/app
ifeq ($(STATIC_FILES),true)
ui/dist/app/index.html: $(shell find ui/src -type f && find ui -maxdepth 1 -type f)
# `yarn install` is fast (~2s), so you can call it safely.
JOBS=max yarn --cwd ui install
# `yarn build` is slow, so we guard it with a up-to-date check.
JOBS=max yarn --cwd ui build
else
ui/dist/app/index.html:
@mkdir -p ui/dist/app
echo "Built without static files" > ui/dist/app/index.html
endif

Expand Down Expand Up @@ -426,7 +428,9 @@ argosay: test/e2e/images/argosay/v2/argosay
ifeq ($(K3D),true)
k3d image import argoproj/argosay:v2
endif
ifeq ($(DOCKER_PUSH),true)
docker push argoproj/argosay:v2
endif

test/e2e/images/argosay/v2/argosay: test/e2e/images/argosay/v2/main/argosay.go
cd test/e2e/images/argosay/v2 && GOOS=linux CGO_ENABLED=0 go build -ldflags '-w -s' -o argosay ./main
Expand All @@ -446,6 +450,7 @@ start: controller-image cli-image install executor-image
else
start: install controller cli executor-image $(GOPATH)/bin/goreman
endif
@echo "starting STATIC_FILES=$(STATIC_FILES) (DEV_BRANCH=$(DEV_BRANCH), GIT_BRANCH=$(GIT_BRANCH)), AUTH_MODE=$(AUTH_MODE), RUN_MODE=$(RUN_MODE)"
ifeq ($(RUN_MODE),kubernetes)
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Available deploy argo-server
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Available deploy workflow-controller
Expand All @@ -467,7 +472,7 @@ endif
sleep 10s
./hack/port-forward.sh
ifeq ($(RUN_MODE),local)
env DEFAULT_REQUEUE_TIME=$(DEFAULT_REQUEUE_TIME) SECURE=$(SECURE) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) LOG_LEVEL=$(LOG_LEVEL) UPPERIO_DB_DEBUG=$(UPPERIO_DB_DEBUG) VERSION=$(VERSION) AUTH_MODE=$(AUTH_MODE) NAMESPACED=$(NAMESPACED) NAMESPACE=$(KUBE_NAMESPACE) $(GOPATH)/bin/goreman -set-ports=false -logtime=false start
env DEFAULT_REQUEUE_TIME=$(DEFAULT_REQUEUE_TIME) SECURE=$(SECURE) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) LOG_LEVEL=$(LOG_LEVEL) UPPERIO_DB_DEBUG=$(UPPERIO_DB_DEBUG) VERSION=$(VERSION) AUTH_MODE=$(AUTH_MODE) NAMESPACED=$(NAMESPACED) NAMESPACE=$(KUBE_NAMESPACE) $(GOPATH)/bin/goreman -set-ports=false -logtime=false start controller argo-server $(shell [ $(STATIC_FILES) = false ] && echo ui || echo)
endif

.PHONY: wait
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
controller: DEFAULT_REQUEUE_TIME=${DEFAULT_REQUEUE_TIME} LEADER_ELECTION_IDENTITY=local ALWAYS_OFFLOAD_NODE_STATUS=${ALWAYS_OFFLOAD_NODE_STATUS} OFFLOAD_NODE_STATUS_TTL=30s WORKFLOW_GC_PERIOD=30s UPPERIO_DB_DEBUG=${UPPERIO_DB_DEBUG} ARCHIVED_WORKFLOW_GC_PERIOD=30s ./dist/workflow-controller --executor-image argoproj/argoexec:${VERSION} --namespaced=${NAMESPACED} --namespace ${NAMESPACE} --loglevel ${LOG_LEVEL}
argo-server: UPPERIO_DB_DEBUG=${UPPERIO_DB_DEBUG} ./dist/argo --loglevel ${LOG_LEVEL} server --namespaced=${NAMESPACED} --namespace ${NAMESPACE} --auth-mode ${AUTH_MODE} --secure=$SECURE --x-frame-options=SAMEORIGIN
ui: yarn --cwd ui install && yarn --cwd ui start
8 changes: 8 additions & 0 deletions workflow/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ func expectWorkflow(ctx context.Context, controller *WorkflowController, name st
test(wf)
}

func getPod(woc *wfOperationCtx, name string) (*apiv1.Pod, error) {
return woc.controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).Get(context.Background(), name, metav1.GetOptions{})
}

func listPods(woc *wfOperationCtx) (*apiv1.PodList, error) {
return woc.controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).List(context.Background(), metav1.ListOptions{})
}

type with func(pod *apiv1.Pod)

func withOutputs(v string) with { return withAnnotation(common.AnnotationKeyOutputs, v) }
Expand Down
Loading