commit 985fffcb8ba4cad01578b5c7d8c37ae89c404b0e Author: Scaffolder Date: Wed May 20 16:57:56 2026 +0000 initial commit Change-Id: I3b5927ebd95850e39277c110434ca77965cb953f diff --git a/.tekton/pipeline.yaml b/.tekton/pipeline.yaml new file mode 100644 index 0000000..b79c037 --- /dev/null +++ b/.tekton/pipeline.yaml @@ -0,0 +1,24 @@ +# Reuses the cluster-wide build-sign-deploy Pipeline in the demo-secure namespace. +# To run on every push, install OpenShift Pipelines as Code or fire the EventListener +# in demo-secure with the right git-revision. +apiVersion: tekton.dev/v1 +kind: PipelineRun +metadata: + generateName: new-go-app- + namespace: new-go-app +spec: + pipelineRef: + name: build-sign-deploy + namespace: demo-secure + serviceAccountName: pipeline + params: + - name: image + value: image-registry.openshift-image-registry.svc:5000/new-go-app/new-go-app:latest + workspaces: + - name: source + volumeClaimTemplate: + spec: + accessModes: [ReadWriteOnce] + resources: + requests: + storage: 2Gi diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eaa013a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM registry.access.redhat.com/ubi9/go-toolset:1.22 AS build +WORKDIR /opt/app-root/src +COPY . . +RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o /tmp/app . + +FROM registry.access.redhat.com/ubi9-minimal:latest +COPY --from=build /tmp/app /usr/local/bin/app +USER 1001 +EXPOSE 8080 +ENTRYPOINT ["/usr/local/bin/app"] diff --git a/argocd-app.yaml b/argocd-app.yaml new file mode 100644 index 0000000..d524ce2 --- /dev/null +++ b/argocd-app.yaml @@ -0,0 +1,28 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: new-go-app + namespace: openshift-gitops + labels: + category: app +spec: + project: default + source: + repoURL: + targetRevision: master + path: deploy + destination: + server: https://kubernetes.default.svc + namespace: new-go-app + ignoreDifferences: + - group: apps + kind: Deployment + jsonPointers: + - /spec/template/spec/containers/0/image + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..e636729 --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,14 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: new-go-app + description: new demo go app + annotations: + backstage.io/kubernetes-id: new-go-app + backstage.io/kubernetes-namespace: new-go-app + janus-idp.io/tekton: new-go-app + argocd/app-name: new-go-app +spec: + type: service + lifecycle: experimental + owner: platform diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2e2867c --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module new-go-app + +go 1.22 diff --git a/main.go b/main.go new file mode 100644 index 0000000..f8c23c5 --- /dev/null +++ b/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "os" +) + +func main() { + http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { + fmt.Fprintf(w, "hello from new-go-app\n") + }) + http.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + }) + port := os.Getenv("PORT") + if port == "" { + port = "8080" + } + log.Printf("new-go-app listening on :%s", port) + log.Fatal(http.ListenAndServe(":"+port, nil)) +}