Skip to content

Commit

Permalink
humctl score validate and humctl resources test-definition (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu-benoit authored Dec 20, 2024
2 parents 2b204dd + 94d120b commit a643d24
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 5 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: ci
permissions:
contents: read
id-token: write
on:
push:
branches:
- main
pull_request:
jobs:
score-validate:
runs-on: ubuntu-24.04
env:
HUMCTL_VERSION: '*'
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: |
scoreFiles=$(ls -d score/*/score*)
for scoreFile in ${scoreFiles}
do
echo ${scoreFile}
humctl score validate ${scoreFile} --strict --local
done
test-definition-echo:
runs-on: ubuntu-24.04
env:
HUMCTL_VERSION: '*'
steps:
- name: checkout code
uses: actions/checkout@v4
- name: install humctl
uses: humanitec/setup-cli-action@v1
with:
version: ${{ env.HUMCTL_VERSION }}
- name: test-definition echo-driver
run: |
resourceDefinitions=$(ls -d resource-definitions/echo-driver/*/*.yaml)
for resourceDefinition in ${resourceDefinitions}
do
echo ${resourceDefinition}
inputs=$(echo ${resourceDefinition} | sed "s,/,-,g")
humctl resources test-definition ${resourceDefinition} --generate > ${inputs}
sed -i 's/context.res.id: ""/context.res.id: "modules.test.externals.test"/g' ${inputs}
sed -i 's/""/"test"/g' ${inputs}
humctl resources test-definition ${resourceDefinition} --inputs ${inputs}
done
test-definition-template:
runs-on: ubuntu-24.04
env:
HUMCTL_VERSION: '*'
steps:
- name: checkout code
uses: actions/checkout@v4
- name: install humctl
uses: humanitec/setup-cli-action@v1
with:
version: ${{ env.HUMCTL_VERSION }}
- name: test-definition template-driver
run: |
resourceDefinitions=$(ls -d resource-definitions/template-driver/*/*.yaml)
for resourceDefinition in ${resourceDefinitions}
do
echo ${resourceDefinition}
if [ "${resourceDefinition}" != "resource-definitions/template-driver/ingress/ingress-traefik-multiple-routes.yaml" ]; then
inputs=$(echo ${resourceDefinition} | sed "s,/,-,g")
humctl resources test-definition ${resourceDefinition} --generate > ${inputs}
sed -i 's/context.res.id: ""/context.res.id: "modules.test.externals.test"/g' ${inputs}
sed -i 's/""/"test"/g' ${inputs}
humctl resources test-definition ${resourceDefinition} --inputs ${inputs}
fi
done
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
entity:
name: ambassador-ingress
type: ingress
driver_type: template
driver_type: humanitec/template
driver_inputs:
values:
templates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
entity:
name: traefik-ingress
type: ingress
driver_type: template
driver_type: humanitec/template
driver_inputs:
values:
templates:
Expand Down
2 changes: 1 addition & 1 deletion score/multiple-workloads/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This example shows how to deploy multiple workloads within one deployment.

Doing so requires a separate Score file per workload ([`score.example-service.yaml`](score.example-service.yaml) and [`score.another-service.yaml`](score.another-service.yaml)). The example also uses a Score extension file ([`score.humanitec.yaml`](score.humanitec.yaml)) to apply some common settings to both workloads.
Doing so requires a separate Score file per workload ([`score.example-service.yaml`](score.example-service.yaml) and [`score.another-service.yaml`](score.another-service.yaml)). The example also uses a Score extension file ([`humanitec.score.yaml`](humanitec.score.yaml)) to apply some common settings to both workloads.

The file [`deploy-config.yaml`](deploy-config.yaml) wraps all those files into a deploy configuration which can be passed in to `humctl` using the `--deploy-config` flag. See the [CLI documentation](https://developer.humanitec.com/platform-orchestrator/reference/cli-references/#score-integration) for details.
4 changes: 2 additions & 2 deletions score/multiple-workloads/deploy-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ScoreDeployConfig
workloads:
- name: example-service
specFile: ./score.example-service.yaml
extensionsFile: ./score.humanitec.yaml
extensionsFile: ./humanitec.score.yaml
- name: another-service
specFile: ./score.another-service.yaml
extensionsFile: ./score.humanitec.yaml
extensionsFile: ./humanitec.score.yaml

0 comments on commit a643d24

Please sign in to comment.