Skip to content

Commit a643d24

Browse files
humctl score validate and humctl resources test-definition (#120)
2 parents 2b204dd + 94d120b commit a643d24

File tree

6 files changed

+84
-5
lines changed

6 files changed

+84
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: ci
2+
permissions:
3+
contents: read
4+
id-token: write
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
jobs:
11+
score-validate:
12+
runs-on: ubuntu-24.04
13+
env:
14+
HUMCTL_VERSION: '*'
15+
steps:
16+
- name: checkout code
17+
uses: actions/checkout@v4
18+
- name: install humctl
19+
uses: humanitec/setup-cli-action@v1
20+
with:
21+
version: ${{ env.HUMCTL_VERSION }}
22+
- name: humctl score validate
23+
run: |
24+
scoreFiles=$(ls -d score/*/score*)
25+
for scoreFile in ${scoreFiles}
26+
do
27+
echo ${scoreFile}
28+
humctl score validate ${scoreFile} --strict --local
29+
done
30+
31+
test-definition-echo:
32+
runs-on: ubuntu-24.04
33+
env:
34+
HUMCTL_VERSION: '*'
35+
steps:
36+
- name: checkout code
37+
uses: actions/checkout@v4
38+
- name: install humctl
39+
uses: humanitec/setup-cli-action@v1
40+
with:
41+
version: ${{ env.HUMCTL_VERSION }}
42+
- name: test-definition echo-driver
43+
run: |
44+
resourceDefinitions=$(ls -d resource-definitions/echo-driver/*/*.yaml)
45+
for resourceDefinition in ${resourceDefinitions}
46+
do
47+
echo ${resourceDefinition}
48+
inputs=$(echo ${resourceDefinition} | sed "s,/,-,g")
49+
humctl resources test-definition ${resourceDefinition} --generate > ${inputs}
50+
sed -i 's/context.res.id: ""/context.res.id: "modules.test.externals.test"/g' ${inputs}
51+
sed -i 's/""/"test"/g' ${inputs}
52+
humctl resources test-definition ${resourceDefinition} --inputs ${inputs}
53+
done
54+
test-definition-template:
55+
runs-on: ubuntu-24.04
56+
env:
57+
HUMCTL_VERSION: '*'
58+
steps:
59+
- name: checkout code
60+
uses: actions/checkout@v4
61+
- name: install humctl
62+
uses: humanitec/setup-cli-action@v1
63+
with:
64+
version: ${{ env.HUMCTL_VERSION }}
65+
- name: test-definition template-driver
66+
run: |
67+
resourceDefinitions=$(ls -d resource-definitions/template-driver/*/*.yaml)
68+
for resourceDefinition in ${resourceDefinitions}
69+
do
70+
echo ${resourceDefinition}
71+
if [ "${resourceDefinition}" != "resource-definitions/template-driver/ingress/ingress-traefik-multiple-routes.yaml" ]; then
72+
inputs=$(echo ${resourceDefinition} | sed "s,/,-,g")
73+
humctl resources test-definition ${resourceDefinition} --generate > ${inputs}
74+
sed -i 's/context.res.id: ""/context.res.id: "modules.test.externals.test"/g' ${inputs}
75+
sed -i 's/""/"test"/g' ${inputs}
76+
humctl resources test-definition ${resourceDefinition} --inputs ${inputs}
77+
fi
78+
done
79+

resource-definitions/template-driver/ingress/ingress-ambassador.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
entity:
77
name: ambassador-ingress
88
type: ingress
9-
driver_type: template
9+
driver_type: humanitec/template
1010
driver_inputs:
1111
values:
1212
templates:

resource-definitions/template-driver/ingress/ingress-traefik.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
entity:
77
name: traefik-ingress
88
type: ingress
9-
driver_type: template
9+
driver_type: humanitec/template
1010
driver_inputs:
1111
values:
1212
templates:

score/multiple-workloads/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This example shows how to deploy multiple workloads within one deployment.
22

3-
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.
3+
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.
44

55
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.

score/multiple-workloads/deploy-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: ScoreDeployConfig
33
workloads:
44
- name: example-service
55
specFile: ./score.example-service.yaml
6-
extensionsFile: ./score.humanitec.yaml
6+
extensionsFile: ./humanitec.score.yaml
77
- name: another-service
88
specFile: ./score.another-service.yaml
9-
extensionsFile: ./score.humanitec.yaml
9+
extensionsFile: ./humanitec.score.yaml

0 commit comments

Comments
 (0)