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

test: Fix bug in port-forward.sh #5895

Merged
merged 14 commits into from
May 13, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
echo '127.0.0.1 mysql' | sudo tee -a /etc/hosts
- run: make install controller cli $(go env GOPATH)/bin/goreman PROFILE=${{matrix.profile}} E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info
- run: make start PROFILE=${{matrix.profile}} E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info UI=false 2>&1 > /tmp/log/argo-e2e/argo.log &
- run: make start PROFILE=${{matrix.profile}} E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info UI=false > /tmp/log/argo-e2e/argo.log 2>&1 &
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

order of redirect here meant stderr was not being captured, which made this time-consuming to debug

timeout-minutes: 4
- name: make/pull argoexec-image
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- v*
branches:
- master
- dev-*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert - we should be creating image on dev-*


defaults:
run:
Expand Down
46 changes: 23 additions & 23 deletions hack/port-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,56 @@ set -eu -o pipefail

pf() {
set -eu -o pipefail
name=$1
resource=$2
port=$3
resource=$1
port=$2
dest_port=${4:-"$port"}
./hack/free-port.sh $port
kubectl -n argo port-forward "$resource" "$port:$dest_port" > /dev/null &
# wait until port forward is established
echo "port-forward $resource $port"
kubectl -n argo port-forward "svc/$resource" "$port:$dest_port" > /dev/null &
until lsof -i ":$port" > /dev/null ; do sleep 1s ; done
info "$name on http://localhost:$port"
}

info() {
echo '[INFO] ' "$@"
wait-for() {
set -eu -o pipefail
echo "wait-for $1"
kubectl -n argo wait --timeout 1m --for=condition=Available deploy/$1
}

if [[ "$(kubectl -n argo get pod -l app=minio -o name)" != "" ]]; then
pf MinIO deploy/minio 9000
fi
wait-for minio
Copy link
Contributor Author

@alexec alexec May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builds were failing because we need to wait for pods to be ready (which is the same as deployment being available) before starting port-forward

pf minio 9000

dex=$(kubectl -n argo get pod -l app=dex -o name)
if [[ "$dex" != "" ]]; then
pf DEX svc/dex 5556
wait-for dex
pf dex 5556
fi

postgres=$(kubectl -n argo get pod -l app=postgres -o name)
if [[ "$postgres" != "" ]]; then
pf Postgres "$postgres" 5432
wait-for postgres
pf postgres 5432
fi

mysql=$(kubectl -n argo get pod -l app=mysql -o name)
if [[ "$mysql" != "" ]]; then
kubectl -n argo wait --for=condition=Available deploy mysql
pf MySQL "$mysql" 3306
wait-for mysql
pf mysql 3306
fi

if [[ "$(kubectl -n argo get pod -l app=argo-server -o name)" != "" ]]; then
kubectl -n argo wait --for=condition=Available deploy argo-server
pf "Argo Server" svc/argo-server 2746
wait-for argo-server
pf argo-server 2746
fi

if [[ "$(kubectl -n argo get pod -l app=workflow-controller -o name)" != "" ]]; then
kubectl -n argo wait --for=condition=Available deploy workflow-controller
pf "Workflow Controller Metrics" svc/workflow-controller-metrics 9090
wait-for workflow-controller
pf workflow-controller-metrics 9090
if [[ "$(kubectl -n argo get svc -l app=workflow-controller-pprof -o name)" != "" ]]; then
pf "Workflow Controller PProf" svc/workflow-controller-pprof 6060
pf workflow-controller-pprof 6060
fi
fi

if [[ "$(kubectl -n argo get pod -l app=prometheus -o name)" != "" ]]; then
kubectl -n argo wait --for=condition=Available deploy prometheus
pf "Prometheus Server" svc/prometheus 9091 9090
wait-for prometheus
pf prometheus 9091 9090
fi