From 5adb1f21370d193e7eee95ae8d5e2650736978d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Mon, 15 Jan 2024 15:36:34 +0100 Subject: [PATCH] chore: Jenkins X build pack --- .idea/.gitignore | 8 ++++ .idea/compiler.xml | 18 +++++++ .idea/encodings.xml | 6 +++ .idea/misc.xml | 7 +++ .lighthouse/jenkins-x/pullrequest.yaml | 41 ++++++++++++++++ .lighthouse/jenkins-x/release.yaml | 47 +++++++++++++++++++ .lighthouse/jenkins-x/triggers.yaml | 16 +++++++ Dockerfile | 4 ++ Makefile | 0 OWNERS | 4 ++ OWNERS_ALIASES | 2 + .../cert-secret-syncer}/.helmignore | 0 .../cert-secret-syncer}/Chart.yaml | 0 .../templates/_helpers.tpl | 0 .../templates/deployment.yaml | 0 .../cert-secret-syncer}/templates/role.yaml | 0 .../templates/service.yaml | 0 .../templates/serviceaccount.yaml | 0 .../cert-secret-syncer}/values.yaml | 0 preview/Kptfile | 11 +++++ preview/helmfile.yaml | 34 ++++++++++++++ preview/values.yaml.gotmpl | 8 ++++ 22 files changed, 206 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .lighthouse/jenkins-x/pullrequest.yaml create mode 100644 .lighthouse/jenkins-x/release.yaml create mode 100644 .lighthouse/jenkins-x/triggers.yaml create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 OWNERS create mode 100644 OWNERS_ALIASES rename {helm => charts/cert-secret-syncer}/.helmignore (100%) rename {helm => charts/cert-secret-syncer}/Chart.yaml (100%) rename {helm => charts/cert-secret-syncer}/templates/_helpers.tpl (100%) rename {helm => charts/cert-secret-syncer}/templates/deployment.yaml (100%) rename {helm => charts/cert-secret-syncer}/templates/role.yaml (100%) rename {helm => charts/cert-secret-syncer}/templates/service.yaml (100%) rename {helm => charts/cert-secret-syncer}/templates/serviceaccount.yaml (100%) rename {helm => charts/cert-secret-syncer}/values.yaml (100%) create mode 100644 preview/Kptfile create mode 100644 preview/helmfile.yaml create mode 100644 preview/values.yaml.gotmpl diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..586e00a --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..71fed2b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.lighthouse/jenkins-x/pullrequest.yaml b/.lighthouse/jenkins-x/pullrequest.yaml new file mode 100644 index 0000000..6171227 --- /dev/null +++ b/.lighthouse/jenkins-x/pullrequest.yaml @@ -0,0 +1,41 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + creationTimestamp: null + name: pullrequest +spec: + pipelineSpec: + tasks: + - name: from-build-pack + resources: {} + taskSpec: + metadata: {} + stepTemplate: + image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go/pullrequest.yaml@versionStream + name: "" + resources: + # override limits for all containers here + limits: {} + workingDir: /workspace/source + steps: + - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream + name: "" + resources: {} + - name: jx-variables + resources: + # override requests for the pod here + requests: + cpu: 400m + memory: 600Mi + - name: build-make-linux + resources: {} + - name: check-registry + resources: {} + - name: build-container-build + resources: {} + - name: promote-jx-preview + resources: {} + podTemplate: {} + serviceAccountName: tekton-bot + timeout: 12h0m0s +status: {} diff --git a/.lighthouse/jenkins-x/release.yaml b/.lighthouse/jenkins-x/release.yaml new file mode 100644 index 0000000..2e93626 --- /dev/null +++ b/.lighthouse/jenkins-x/release.yaml @@ -0,0 +1,47 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + creationTimestamp: null + name: release +spec: + pipelineSpec: + tasks: + - name: from-build-pack + resources: {} + taskSpec: + metadata: {} + stepTemplate: + image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go/release.yaml@versionStream + name: "" + resources: + # override limits for all containers here + limits: {} + workingDir: /workspace/source + steps: + - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone.yaml@versionStream + name: "" + resources: {} + - name: next-version + resources: {} + - name: jx-variables + resources: + # override requests for the pod here + requests: + cpu: 400m + memory: 600Mi + - name: build-make-build + resources: {} + - name: check-registry + resources: {} + - name: build-container-build + resources: {} + - name: promote-changelog + resources: {} + - name: promote-helm-release + resources: {} + - name: promote-jx-promote + resources: {} + podTemplate: {} + serviceAccountName: tekton-bot + timeout: 12h0m0s +status: {} diff --git a/.lighthouse/jenkins-x/triggers.yaml b/.lighthouse/jenkins-x/triggers.yaml new file mode 100644 index 0000000..ae2fcfa --- /dev/null +++ b/.lighthouse/jenkins-x/triggers.yaml @@ -0,0 +1,16 @@ +apiVersion: config.lighthouse.jenkins-x.io/v1alpha1 +kind: TriggerConfig +spec: + presubmits: + - name: pr + context: "pr" + always_run: true + optional: false + source: "pullrequest.yaml" + postsubmits: + - name: release + context: "release" + source: "release.yaml" + branches: + - ^main$ + - ^master$ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fdb0267 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM scratch +EXPOSE 8080 +ENTRYPOINT ["/cert-secret-syncer"] +COPY ./bin/ / \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000..c4ff9e6 --- /dev/null +++ b/OWNERS @@ -0,0 +1,4 @@ +approvers: +- maintainers +reviewers: +- maintainers diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 0000000..8511b71 --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,2 @@ +foreignAliases: +- name: users diff --git a/helm/.helmignore b/charts/cert-secret-syncer/.helmignore similarity index 100% rename from helm/.helmignore rename to charts/cert-secret-syncer/.helmignore diff --git a/helm/Chart.yaml b/charts/cert-secret-syncer/Chart.yaml similarity index 100% rename from helm/Chart.yaml rename to charts/cert-secret-syncer/Chart.yaml diff --git a/helm/templates/_helpers.tpl b/charts/cert-secret-syncer/templates/_helpers.tpl similarity index 100% rename from helm/templates/_helpers.tpl rename to charts/cert-secret-syncer/templates/_helpers.tpl diff --git a/helm/templates/deployment.yaml b/charts/cert-secret-syncer/templates/deployment.yaml similarity index 100% rename from helm/templates/deployment.yaml rename to charts/cert-secret-syncer/templates/deployment.yaml diff --git a/helm/templates/role.yaml b/charts/cert-secret-syncer/templates/role.yaml similarity index 100% rename from helm/templates/role.yaml rename to charts/cert-secret-syncer/templates/role.yaml diff --git a/helm/templates/service.yaml b/charts/cert-secret-syncer/templates/service.yaml similarity index 100% rename from helm/templates/service.yaml rename to charts/cert-secret-syncer/templates/service.yaml diff --git a/helm/templates/serviceaccount.yaml b/charts/cert-secret-syncer/templates/serviceaccount.yaml similarity index 100% rename from helm/templates/serviceaccount.yaml rename to charts/cert-secret-syncer/templates/serviceaccount.yaml diff --git a/helm/values.yaml b/charts/cert-secret-syncer/values.yaml similarity index 100% rename from helm/values.yaml rename to charts/cert-secret-syncer/values.yaml diff --git a/preview/Kptfile b/preview/Kptfile new file mode 100644 index 0000000..6e6ae8a --- /dev/null +++ b/preview/Kptfile @@ -0,0 +1,11 @@ +apiVersion: kpt.dev/v1alpha1 +kind: Kptfile +metadata: + name: preview +upstream: + type: git + git: + commit: b52b35506a05e046d54615c3ade97f3aef8bfb08 + repo: https://github.com/jenkins-x/jx3-pipeline-catalog + directory: /helm/preview + ref: master diff --git a/preview/helmfile.yaml b/preview/helmfile.yaml new file mode 100644 index 0000000..aaf0966 --- /dev/null +++ b/preview/helmfile.yaml @@ -0,0 +1,34 @@ +environments: + default: + values: + - jx-values.yaml +helmDefaults: + # time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300) + timeout: 600 +repositories: +- name: jx3 + url: https://jenkins-x-charts.github.io/repo +releases: +- chart: jx3/jx-verify + name: jx-verify + namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}' +- chart: '../charts/{{ requiredEnv "APP_NAME" }}' + name: preview + wait: true + createNamespace: true + namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}' + values: + - jx-values.yaml + - values.yaml.gotmpl + hooks: + - events: ["presync"] + showlogs: true + command: "jx" + args: + - secret + - copy + - --create-namespace + - --selector + - "secret.jenkins-x.io/replica-source=true" + - --to + - '{{ requiredEnv "PREVIEW_NAMESPACE" }}' diff --git a/preview/values.yaml.gotmpl b/preview/values.yaml.gotmpl new file mode 100644 index 0000000..0283df2 --- /dev/null +++ b/preview/values.yaml.gotmpl @@ -0,0 +1,8 @@ +jxRequirements: + ingress: + namespaceSubDomain: "-pr{{ requiredEnv "PULL_NUMBER" }}." + +image: + repository: "{{ requiredEnv "DOCKER_REGISTRY" }}/{{ requiredEnv "DOCKER_REGISTRY_ORG" }}/{{ requiredEnv "APP_NAME" }}" + tag: "{{ requiredEnv "VERSION" }}" + pullPolicy: "Always"