diff --git a/.forgejo/workflows/functions.yml b/.forgejo/workflows/functions.yml index d51c178..7d4417b 100644 --- a/.forgejo/workflows/functions.yml +++ b/.forgejo/workflows/functions.yml @@ -39,9 +39,17 @@ jobs: - name: Build run: | - spin registry push --build code.icb4dc0.de/infrastructure/functions/comics + spin registry push --build code.icb4dc0.de/infrastructure/functions/comics:${{ github.sha }} working-directory: comics + - name: Update image reference + run: | + kustomize edit set image comics=code.icb4dc0.de/infrastructure/functions/comics:${{ github.sha }} + git add kustomization.yaml + git commit -m "chore(deploy): update comics image reference" + git push + working-directory: deploy + - name: Upsert Argo App run: | argocd app create functions -f deploy/argo-app.yaml --upsert --server argo-cd-argocd-server.argo-system.svc --auth-token ${{ secrets.ARGOCD_TOKEN }} --plaintext diff --git a/comics/main.go b/comics/main.go index 88e874d..c55d17d 100644 --- a/comics/main.go +++ b/comics/main.go @@ -21,8 +21,9 @@ type MonkeyUserEntry struct { URL string `json:"url"` } -type ImageReference struct { - URL string `json:"url"` +type Comic struct { + Title string `json:"title"` + URL string `json:"url"` } func init() { @@ -84,7 +85,9 @@ func monkeyUserComic(w http.ResponseWriter, re *http.Request, _ httprouter.Param return } - var ref ImageReference + ref := Comic{ + Title: entry.Title, + } comicDoc.Find("div.content > p > img").Each(func(_ int, s *goquery.Selection) { for _, node := range s.Nodes { diff --git a/deploy/apps/comics.yaml b/deploy/apps/comics.yaml index ee7df8c..7ad7196 100644 --- a/deploy/apps/comics.yaml +++ b/deploy/apps/comics.yaml @@ -3,6 +3,6 @@ kind: SpinApp metadata: name: comics spec: - image: "code.icb4dc0.de/infrastructure/functions/comics:latest" + image: "comics" executor: containerd-shim-spin replicas: 2 diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml index fa692ac..84796fd 100644 --- a/deploy/kustomization.yaml +++ b/deploy/kustomization.yaml @@ -3,8 +3,16 @@ kind: Kustomization namespace: functions +images: + - name: comics + newName: code.icb4dc0.de/infrastructure/functions/comics + newTag: latest + resources: - resources/namespace.yaml - resources/executor.yaml - resources/routes.yaml - apps/comics.yaml + +configurations: + - kustomizeconfig/spinapp.yaml diff --git a/deploy/kustomizeconfig/spinapp.yaml b/deploy/kustomizeconfig/spinapp.yaml new file mode 100644 index 0000000..b3ab1ff --- /dev/null +++ b/deploy/kustomizeconfig/spinapp.yaml @@ -0,0 +1,3 @@ +images: + - path: spec/image + kind: SpinApp