Skip to content

Commit

Permalink
Merge pull request #301 from stefanprodan/timoni-module
Browse files Browse the repository at this point in the history
Add Timoni module
  • Loading branch information
stefanprodan committed Sep 22, 2023
2 parents aaa47e5 + dfc4a6d commit 1495fd8
Show file tree
Hide file tree
Showing 125 changed files with 27,290 additions and 421 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
timoni/podinfo/cue.mod/* linguist-vendored
31 changes: 14 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore Go cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
Expand All @@ -39,7 +36,9 @@ jobs:
with:
version: v3.10.3
- name: Setup CUE
uses: cue-lang/setup-cue@main
uses: cue-lang/[email protected]
- name: Setup Timoni
uses: stefanprodan/timoni/actions/setup@main
- name: Run unit tests
run: make test
- name: Validate Helm chart
Expand All @@ -49,24 +48,22 @@ jobs:
- name: Validate Kustomize overlay
run: |
kubectl kustomize ./kustomize/ | kubeconform -strict -summary -kubernetes-version ${{ env.KUBERNETES_VERSION }}
- name: Generate CUE definitions
run: make cue-mod
- name: Verify CUE formatting
working-directory: ./cue
working-directory: ./timoni/podinfo
run: |
cue fmt .
cue fmt ./..
status=$(git status . --porcelain)
[[ -z "$status" ]] || {
echo "CUE files are not correctly formatted"
echo "$status"
git diff
exit 1
}
- name: Validate CUE
working-directory: ./cue
- name: Validate Timoni module
working-directory: ./timoni/podinfo
run: |
cue vet --all-errors --concrete .
cue gen | kubeconform -strict -summary -skip=ServiceMonitor -kubernetes-version ${{ env.KUBERNETES_VERSION }}
timoni mod lint .
timoni build podinfo . -f test_values.cue | kubeconform -strict -summary -skip=ServiceMonitor -kubernetes-version ${{ env.KUBERNETES_VERSION }}
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
Expand Down
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ version-set:
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/webapp/backend/deployment.yaml && \
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/frontend/deployment.yaml && \
/usr/bin/sed -i '' "s/podinfo:$$current/podinfo:$$next/g" deploy/bases/backend/deployment.yaml && \
/usr/bin/sed -i '' "s/$$current/$$next/g" cue/main.cue && \
echo "Version $$next set in code, deployment, chart and kustomize"
/usr/bin/sed -i '' "s/$$current/$$next/g" timoni/podinfo/values.cue && \
echo "Version $$next set in code, deployment, module, chart and kustomize"

release:
git tag -s -m $(VERSION) $(VERSION)
Expand All @@ -95,13 +95,6 @@ swagger:
go get github.com/swaggo/swag/cmd/swag@latest
cd pkg/api && $$(go env GOPATH)/bin/swag init -g server.go

.PHONY: cue-mod
cue-mod:
@cd cue && go mod init github.com/stefanprodan/podinfo/cue
@cd cue && go get k8s.io/api/...
@cd cue && cue get go k8s.io/api/...

.PHONY: cue-gen
cue-gen:
@cd cue && cue fmt ./... && cue vet --all-errors --concrete ./...
@cd cue && cue gen
.PHONY: timoni-build
timoni-build:
@timoni build podinfo ./timoni/podinfo -f ./timoni/podinfo/test_values.cue
60 changes: 0 additions & 60 deletions cue/README.md

This file was deleted.

1 change: 0 additions & 1 deletion cue/cue.mod/module.cue

This file was deleted.

33 changes: 0 additions & 33 deletions cue/main.cue

This file was deleted.

12 changes: 0 additions & 12 deletions cue/main_tool.cue

This file was deleted.

26 changes: 0 additions & 26 deletions cue/podinfo/app.cue

This file was deleted.

41 changes: 0 additions & 41 deletions cue/podinfo/config.cue

This file was deleted.

110 changes: 0 additions & 110 deletions cue/podinfo/deployment.cue

This file was deleted.

Loading

0 comments on commit 1495fd8

Please sign in to comment.