Skip to content

Commit

Permalink
humctl 0.19.1 - score validate & score deploy (#109)
Browse files Browse the repository at this point in the history
* HUMCTL_VERSION: '0.19.1'

* humctl score validate

* validate --strict

* humctl score deploy

* No score output anymore
  • Loading branch information
mathieu-benoit authored Mar 29, 2024
1 parent 52cd284 commit 541d60c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/close-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- closed
env:
ENVIRONMENT_ID: pr-${{ github.event.number }}
HUMCTL_VERSION: '0.14.0'
HUMCTL_VERSION: '0.19.1'
jobs:
ob-pr-closed:
runs-on: ubuntu-latest
Expand Down
71 changes: 20 additions & 51 deletions .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ env:
SCORE_HELM_VERSION: 'latest'
SCORE_HUMANITEC_VERSION: 'latest'
WORKLOAD_NAME: my-sample-app
HUMCTL_VERSION: '0.15.0'
HUMCTL_VERSION: '0.19.1'
jobs:
build-run-test-push:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: install humctl
uses: humanitec/setup-cli-action@v1
with:
version: ${{ env.HUMCTL_VERSION }}
- name: humctl score validate
run: |
humctl score validate score/score.yaml \
--token ${{ secrets.HUMANITEC_TOKEN }} \
--org ${{ secrets.HUMANITEC_ORG }} \
--strict
- name: install score-compose
uses: score-spec/setup-score@v2
with:
Expand Down Expand Up @@ -170,58 +180,28 @@ jobs:
file: score-humanitec
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ env.SCORE_HUMANITEC_VERSION }}
- name: deploy score-humanitec
- name: humctl score deploy
run: |
score-humanitec delta \
--retry \
--deploy \
--token ${{ secrets.HUMANITEC_TOKEN }} \
--org ${{ secrets.HUMANITEC_ORG }} \
--app ${{ vars.APP_NAME }} \
--env ${{ env.ENVIRONMENT_ID }} \
HUMANITEC_CLI_ALPHA_FEATURES=score-deploy humctl score deploy \
-f score/score.yaml \
--extensions score/humanitec.score.yaml \
--message "$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.pull_request.commits_url }}?per_page=10" | jq -r .[-1].commit.message)" \
--image ${{ env.IMAGE_NAME }}@${IMAGE_DIGEST} \
--message "$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.pull_request.commits_url }}?per_page=10" | jq -r .[-1].commit.message)" \
--workload-source-url "https://github.com/${{ github.repository }}/blob/${{ github.head_ref }}/score/score.yaml" \
| tee score_output.json
- name: wait for deployment
run: |
sleep 1
DEPLOYMENT_ID=$(humctl get deployment . -o json \
--token ${{ secrets.HUMANITEC_TOKEN }} \
--org ${{ secrets.HUMANITEC_ORG }} \
--app ${{ vars.APP_NAME }} \
--env ${{ env.ENVIRONMENT_ID }} \
| jq -r .metadata.id)
echo "DEPLOYMENT_ID=${DEPLOYMENT_ID}" >> ${{ github.env }}
IS_DONE=false
CURRENT_STATUS=""
while [ "$IS_DONE" = false ]; do
CURRENT_STATUS=$(humctl get deployment ${DEPLOYMENT_ID} -o json \
--wait
- name: build comment message
if: ${{ always() }}
run: |
DEPLOYMENT_ID=$(humctl get deployment . -o json \
--token ${{ secrets.HUMANITEC_TOKEN }} \
--org ${{ secrets.HUMANITEC_ORG }} \
--app ${{ vars.APP_NAME }} \
--env ${{ env.ENVIRONMENT_ID }} \
| jq -r .status.status)
if [ "$CURRENT_STATUS" = "in progress" ]; then
echo "Deployment still in progress..."
sleep 1
elif [ "$CURRENT_STATUS" = "failed" ]; then
echo "Deployment failed!"
IS_DONE=true
else
echo "Deployment successfully completed!"
IS_DONE=true
fi
done
echo $CURRENT_STATUS
if [ "$CURRENT_STATUS" = "failed" ]; then
exit 1
fi
- name: build comment message
if: ${{ always() }}
run: |
| jq -r .metadata.id)
ENV_URL="https://app.humanitec.io/orgs/"${{ secrets.HUMANITEC_ORG }}"/apps/"${{ vars.APP_NAME }}"/envs/"${{ env.ENVIRONMENT_ID }}"/deploys/"${DEPLOYMENT_ID}
DOMAINS=$(humctl get active-resources \
--token ${{ secrets.HUMANITEC_TOKEN }} \
Expand Down Expand Up @@ -319,17 +299,6 @@ jobs:
echo "</details>" >> pr_message.txt
fi
echo "<details><summary>Score Output</summary>" >> pr_message.txt
echo "" >> pr_message.txt
echo "### Score Output:" >> pr_message.txt
echo '```json' >> pr_message.txt
echo "" >> pr_message.txt
cat score_output.json >> pr_message.txt
echo "" >> pr_message.txt
echo '```' >> pr_message.txt
echo "" >> pr_message.txt
echo "</details>" >> pr_message.txt
cat pr_message.txt
- name: comment pr
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
ENVIRONMENT_ID: development
SCORE_HUMANITEC_VERSION: 'latest'
WORKLOAD_NAME: my-sample-app
HUMCTL_VERSION: '0.14.0'
HUMCTL_VERSION: '0.19.1'
jobs:
build-push:
runs-on: ubuntu-22.04
Expand Down

0 comments on commit 541d60c

Please sign in to comment.