Skip to content

Commit 5d61486

Browse files
feat: use humctl wait
1 parent 745234e commit 5d61486

File tree

2 files changed

+3
-37
lines changed

2 files changed

+3
-37
lines changed

1_demo.sh

+1-35
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,7 @@ echo "Deploying workload"
55

66
humanitec_app=$(terraform -chdir=setup/terraform output -raw humanitec_app)
77

8-
humctl score deploy --app "$humanitec_app" --env development -f ./score.yaml
9-
10-
echo "Waiting for deployment"
11-
12-
sleep 1
13-
14-
DEPLOYMENT_ID=$(humctl get deployment . -o json \
15-
--app "$humanitec_app" \
16-
--env development \
17-
| jq -r .metadata.id)
18-
19-
IS_DONE=false
20-
CURRENT_STATUS=""
21-
22-
while [ "$IS_DONE" = false ]; do
23-
CURRENT_STATUS=$(humctl get deployment "${DEPLOYMENT_ID}" -o json \
24-
--app "$humanitec_app" \
25-
--env development \
26-
| jq -r .status.status)
27-
28-
if [ "$CURRENT_STATUS" = "in progress" ]; then
29-
echo "Deployment still in progress..."
30-
sleep 2
31-
elif [ "$CURRENT_STATUS" = "failed" ]; then
32-
echo "Deployment failed!"
33-
IS_DONE=true
34-
else
35-
echo "Deployment complete!"
36-
IS_DONE=true
37-
fi
38-
done
39-
if [ "$CURRENT_STATUS" = "failed" ]; then
40-
humctl get deployment-error --app "$humanitec_app" --env development
41-
exit 1
42-
fi
8+
humctl score deploy --app "$humanitec_app" --env development -f ./score.yaml --wait
439

4410
workload_host=$(humctl get active-resources --app "$humanitec_app" --env development -o yaml | yq '.[] | select(.metadata.type == "route") | .status.resource.host')
4511

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM alpine:3.19
22

3-
LABEL org.opencontainers.image.source https://github.com/johanneswuerbach/5min-idp
3+
LABEL org.opencontainers.image.source https://github.com/humanitec-tutorials/5min-idp
44

55
RUN apk add --no-cache \
66
bash curl git jq bash-completion docker-cli && \
@@ -43,7 +43,7 @@ RUN curl -fsSL https://github.com/mikefarah/yq/releases/latest/download/yq_linu
4343

4444
# install humctl (https://github.com/humanitec/cli/releases)
4545
RUN mkdir /tmp/humctl && \
46-
curl -fsSL https://github.com/humanitec/cli/releases/download/v0.21.1/cli_0.21.1_linux_${TARGETARCH}.tar.gz > /tmp/humctl/humctl.tar.gz && \
46+
curl -fsSL https://github.com/humanitec/cli/releases/download/v0.23.0/cli_0.23.0_linux_${TARGETARCH}.tar.gz > /tmp/humctl/humctl.tar.gz && \
4747
tar -zxvf /tmp/humctl/humctl.tar.gz -C /tmp/humctl && \
4848
install -o root -g root -m 0755 /tmp/humctl/humctl /usr/local/bin/humctl && \
4949
humctl completion bash > /etc/bash_completion.d/humctl && \

0 commit comments

Comments
 (0)