From a4e433dab145dc4d3776a9d8337682f38d477603 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 6 Apr 2024 12:21:18 -0400 Subject: [PATCH] Inline build pipeline. --- .lighthouse/pipeline-build-organic.yaml | 663 ++++++++++++++++++++++++ .lighthouse/pipeline-format.yaml | 3 +- .lighthouse/pipeline-rust-build.yaml | 332 ------------ .lighthouse/pipeline-rust-clippy.yaml | 1 + .lighthouse/triggers.yaml | 4 +- docker/organic_build/Dockerfile | 7 - docker/organic_build/Makefile | 37 -- docker/organic_development/Dockerfile | 4 + 8 files changed, 672 insertions(+), 379 deletions(-) create mode 100644 .lighthouse/pipeline-build-organic.yaml delete mode 100644 .lighthouse/pipeline-rust-build.yaml delete mode 100644 docker/organic_build/Dockerfile delete mode 100644 docker/organic_build/Makefile diff --git a/.lighthouse/pipeline-build-organic.yaml b/.lighthouse/pipeline-build-organic.yaml new file mode 100644 index 0000000..2282413 --- /dev/null +++ b/.lighthouse/pipeline-build-organic.yaml @@ -0,0 +1,663 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: build-organic +spec: + pipelineSpec: + params: + - name: image-name + description: The name for the built image + type: string + - name: path-to-image-context + description: The path to the build context + type: string + - name: path-to-dockerfile + description: The path to the Dockerfile + type: string + tasks: + - name: report-pending + taskRef: + resolver: git + params: + - name: url + value: https://github.com/tektoncd/catalog.git + - name: revision + value: df36b3853a5657fd883015cdbf07ad6466918acf + - name: pathInRepo + value: task/gitea-set-status/0.1/gitea-set-status.yaml + runAfter: + - fetch-repository + params: + - name: CONTEXT + value: "$(params.JOB_NAME)" + - name: REPO_FULL_NAME + value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" + - name: GITEA_HOST_URL + value: code.fizz.buzz + - name: SHA + value: $(tasks.fetch-repository.results.commit) + - name: DESCRIPTION + value: "Build $(params.JOB_NAME) has started" + - name: STATE + value: pending + - name: TARGET_URL + value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" + - name: fetch-repository + taskRef: + resolver: git + params: + - name: url + value: https://github.com/tektoncd/catalog.git + - name: revision + value: df36b3853a5657fd883015cdbf07ad6466918acf + - name: pathInRepo + value: task/git-clone/0.9/git-clone.yaml + workspaces: + - name: output + workspace: git-source + params: + - name: url + value: $(params.REPO_URL) + - name: revision + value: $(params.PULL_BASE_SHA) + - name: deleteExisting + value: "true" + - name: build-image + taskRef: + resolver: git + params: + - name: url + value: https://github.com/tektoncd/catalog.git + - name: revision + value: df36b3853a5657fd883015cdbf07ad6466918acf + - name: pathInRepo + value: task/kaniko/0.6/kaniko.yaml + params: + - name: IMAGE + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + - name: CONTEXT + value: $(params.path-to-image-context) + - name: DOCKERFILE + value: $(params.path-to-dockerfile) + - name: BUILDER_IMAGE + value: "gcr.io/kaniko-project/executor:v1.12.1" + - name: EXTRA_ARGS + value: + - --target=wasm + - --cache=true + - --cache-copy-layers + - --cache-repo=harbor.fizz.buzz/kanikocache/cache + - --use-new-run # Should result in a speed-up + - --reproducible # To remove timestamps so layer caching works. + - --snapshot-mode=redo + - --skip-unused-stages=true + - --registry-mirror=dockerhub.dockerhub.svc.cluster.local + workspaces: + - name: source + workspace: git-source + - name: dockerconfig + workspace: docker-credentials + runAfter: + - fetch-repository + ############# + - name: run-image-none + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: ["--no-default-features"] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: none + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-tracing + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: ["--no-default-features", "--features", "tracing"] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: tracing + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-compare + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: ["--no-default-features", "--features", "compare"] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: compare + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-default + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: [] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: default + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-tracing-compare + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: ["--no-default-features", "--features", "tracing,compare"] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: tracing-compare + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-compare-foreign + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: + [ + "--no-default-features", + "--features", + "compare,foreign_document_test", + ] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: compare-foreign + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-all + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: + [ + "--no-default-features", + "--features", + "tracing,compare,foreign_document_test", + ] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: all + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-wasm + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: + [ + "--target", + "wasm32-unknown-unknown", + "--profile", + "wasm", + "--bin", + "wasm", + "--no-default-features", + "--features", + "wasm", + ] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: wasm + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + - name: run-image-wasm-test + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + stepTemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["cargo", "build"] + args: + [ + "--bin", + "wasm_test", + "--no-default-features", + "--features", + "wasm_test", + ] + env: + - name: CARGO_TARGET_DIR + value: /target + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: wasm-test + runAfter: + - build-image + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + ############# + finally: + - name: report-success + when: + - input: "$(tasks.status)" + operator: in + values: ["Succeeded", "Completed"] + taskRef: + resolver: git + params: + - name: url + value: https://github.com/tektoncd/catalog.git + - name: revision + value: df36b3853a5657fd883015cdbf07ad6466918acf + - name: pathInRepo + value: task/gitea-set-status/0.1/gitea-set-status.yaml + params: + - name: CONTEXT + value: "$(params.JOB_NAME)" + - name: REPO_FULL_NAME + value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" + - name: GITEA_HOST_URL + value: code.fizz.buzz + - name: SHA + value: "$(tasks.fetch-repository.results.commit)" + - name: DESCRIPTION + value: "Build $(params.JOB_NAME) has succeeded" + - name: STATE + value: success + - name: TARGET_URL + value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" + - name: report-failure + when: + - input: "$(tasks.status)" + operator: in + values: ["Failed"] + taskRef: + resolver: git + params: + - name: url + value: https://github.com/tektoncd/catalog.git + - name: revision + value: df36b3853a5657fd883015cdbf07ad6466918acf + - name: pathInRepo + value: task/gitea-set-status/0.1/gitea-set-status.yaml + params: + - name: CONTEXT + value: "$(params.JOB_NAME)" + - name: REPO_FULL_NAME + value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" + - name: GITEA_HOST_URL + value: code.fizz.buzz + - name: SHA + value: "$(tasks.fetch-repository.results.commit)" + - name: DESCRIPTION + value: "Build $(params.JOB_NAME) has failed" + - name: STATE + value: failure + - name: TARGET_URL + value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" + - name: cargo-cache-autoclean + taskSpec: + metadata: {} + params: + - name: docker-image + type: string + description: Docker image to run. + default: alpine:3.18 + - name: cache-subdir + type: string + description: subPath used in the persistent volume for the cargo cache. + steptemplate: + image: alpine:3.18 + name: "" + resources: + requests: + cpu: 10m + memory: 600Mi + workingDir: /workspace/source + workspaces: + - name: source + mountPath: /source + - name: cargo-cache + mountPath: /usr/local/cargo/registry + optional: true + steps: + - name: run + image: $(params.docker-image) + workingDir: "$(workspaces.source.path)" + command: ["ls", "$(workspaces.cargo-cache.path)"] + # command: [echo, $(params.cache-subdir)] + # command: [cargo, cache, --autoclean] + args: [] + workspaces: + - name: source + workspace: git-source + - name: cargo-cache + workspace: cargo-cache + subPath: $(params.cache-subdir) + params: + - name: docker-image + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" + - name: cache-subdir + value: none + # matrix: + # params: + # - name: cache-subdir + # value: + # - none + # - tracing + # - compare + # - default + # - tracing-compare + # - compare-foreign + # - all + # - wasm + # - wasm-test + workspaces: + - name: git-source + - name: docker-credentials + - name: cargo-cache + workspaces: + - name: git-source + volumeClaimTemplate: + spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + subPath: rust-source + - name: cargo-cache + persistentVolumeClaim: + claimName: organic-cargo-cache-build + - name: docker-credentials + secret: + secretName: harbor-plain + serviceAccountName: build-bot + timeout: 240h0m0s + params: + - name: image-name + value: "harbor.fizz.buzz/private/organic-development-wasm" + - name: path-to-image-context + value: . + - name: path-to-dockerfile + value: docker/organic_development/Dockerfile diff --git a/.lighthouse/pipeline-format.yaml b/.lighthouse/pipeline-format.yaml index c1c5e53..f270079 100644 --- a/.lighthouse/pipeline-format.yaml +++ b/.lighthouse/pipeline-format.yaml @@ -75,7 +75,7 @@ spec: - name: revision value: df36b3853a5657fd883015cdbf07ad6466918acf - name: pathInRepo - value: task/kaniko/0.6//kaniko.yaml + value: task/kaniko/0.6/kaniko.yaml params: - name: IMAGE value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" @@ -87,6 +87,7 @@ spec: value: "gcr.io/kaniko-project/executor:v1.12.1" - name: EXTRA_ARGS value: + - --target=builder - --cache=true - --cache-copy-layers - --cache-repo=harbor.fizz.buzz/kanikocache/cache diff --git a/.lighthouse/pipeline-rust-build.yaml b/.lighthouse/pipeline-rust-build.yaml deleted file mode 100644 index b21ce7e..0000000 --- a/.lighthouse/pipeline-rust-build.yaml +++ /dev/null @@ -1,332 +0,0 @@ -apiVersion: tekton.dev/v1beta1 -kind: PipelineRun -metadata: - name: rust-build -spec: - pipelineSpec: - params: - - name: image-name - description: The name for the built image - type: string - - name: path-to-image-context - description: The path to the build context - type: string - - name: path-to-dockerfile - description: The path to the Dockerfile - type: string - tasks: - - name: report-pending - taskRef: - name: gitea-set-status - runAfter: - - fetch-repository - params: - - name: CONTEXT - value: "$(params.JOB_NAME)" - - name: REPO_FULL_NAME - value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" - - name: GITEA_HOST_URL - value: code.fizz.buzz - - name: SHA - value: "$(tasks.fetch-repository.results.commit)" - - name: DESCRIPTION - value: "Build $(params.JOB_NAME) has started" - - name: STATE - value: pending - - name: TARGET_URL - value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" - - name: fetch-repository - taskRef: - name: git-clone - workspaces: - - name: output - workspace: git-source - params: - - name: url - value: $(params.REPO_URL) - - name: revision - value: $(params.PULL_BASE_SHA) - - name: deleteExisting - value: "true" - - name: build-image - taskRef: - name: kaniko - params: - - name: IMAGE - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: CONTEXT - value: $(params.path-to-image-context) - - name: DOCKERFILE - value: $(params.path-to-dockerfile) - - name: BUILDER_IMAGE - value: "gcr.io/kaniko-project/executor:v1.12.1" - - name: EXTRA_ARGS - value: - - --cache=true - - --cache-copy-layers - - --cache-repo=harbor.fizz.buzz/kanikocache/cache - - --use-new-run # Should result in a speed-up - - --reproducible # To remove timestamps so layer caching works. - - --snapshot-mode=redo - - --skip-unused-stages=true - - --registry-mirror=dockerhub.dockerhub.svc.cluster.local - workspaces: - - name: source - workspace: git-source - - name: dockerconfig - workspace: docker-credentials - runAfter: - - fetch-repository - - name: run-image-none - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - build-image - params: - - name: args - value: ["--no-default-features"] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-tracing - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-none - params: - - name: args - value: ["--no-default-features", "--features", "tracing"] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-compare - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-tracing - params: - - name: args - value: ["--no-default-features", "--features", "compare"] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-default - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-compare - params: - - name: args - value: [] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-tracing-compare - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-default - params: - - name: args - value: ["--no-default-features", "--features", "tracing,compare"] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-compare-foreign - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-tracing-compare - params: - - name: args - value: - [ - "--no-default-features", - "--features", - "compare,foreign_document_test", - ] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-all - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-compare-foreign - params: - - name: args - value: - [ - "--no-default-features", - "--features", - "tracing,compare,foreign_document_test", - ] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-wasm - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-all - params: - - name: args - value: - [ - "--target", - "wasm32-unknown-unknown", - "--profile", - "wasm", - "--bin", - "wasm", - "--no-default-features", - "--features", - "wasm", - ] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - - name: run-image-wasm-test - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - runAfter: - - run-image-wasm - params: - - name: args - value: - [ - "--bin", - "wasm_test", - "--no-default-features", - "--features", - "wasm_test", - ] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - finally: - - name: report-success - when: - - input: "$(tasks.status)" - operator: in - values: ["Succeeded", "Completed"] - taskRef: - name: gitea-set-status - params: - - name: CONTEXT - value: "$(params.JOB_NAME)" - - name: REPO_FULL_NAME - value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" - - name: GITEA_HOST_URL - value: code.fizz.buzz - - name: SHA - value: "$(tasks.fetch-repository.results.commit)" - - name: DESCRIPTION - value: "Build $(params.JOB_NAME) has succeeded" - - name: STATE - value: success - - name: TARGET_URL - value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" - - name: report-failure - when: - - input: "$(tasks.status)" - operator: in - values: ["Failed"] - taskRef: - name: gitea-set-status - params: - - name: CONTEXT - value: "$(params.JOB_NAME)" - - name: REPO_FULL_NAME - value: "$(params.REPO_OWNER)/$(params.REPO_NAME)" - - name: GITEA_HOST_URL - value: code.fizz.buzz - - name: SHA - value: "$(tasks.fetch-repository.results.commit)" - - name: DESCRIPTION - value: "Build $(params.JOB_NAME) has failed" - - name: STATE - value: failure - - name: TARGET_URL - value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" - - name: cargo-cache-autoclean - taskRef: - name: run-docker-image - workspaces: - - name: source - workspace: git-source - - name: cargo-cache - workspace: cargo-cache - params: - - name: command - value: [cargo, cache, --autoclean] - - name: args - value: [] - - name: docker-image - value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - workspaces: - - name: git-source - - name: docker-credentials - - name: cargo-cache - workspaces: - - name: git-source - volumeClaimTemplate: - spec: - storageClassName: "nfs-client" - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - subPath: rust-source - - name: cargo-cache - persistentVolumeClaim: - claimName: organic-cargo-cache-build - - name: docker-credentials - secret: - secretName: harbor-plain - serviceAccountName: build-bot - timeout: 240h0m0s - params: - - name: image-name - value: "harbor.fizz.buzz/private/organic-build" - - name: path-to-image-context - value: docker/organic_build/ - - name: path-to-dockerfile - value: docker/organic_build/Dockerfile diff --git a/.lighthouse/pipeline-rust-clippy.yaml b/.lighthouse/pipeline-rust-clippy.yaml index a676171..2ae1266 100644 --- a/.lighthouse/pipeline-rust-clippy.yaml +++ b/.lighthouse/pipeline-rust-clippy.yaml @@ -87,6 +87,7 @@ spec: value: "gcr.io/kaniko-project/executor:v1.12.1" - name: EXTRA_ARGS value: + - --target=builder - --cache=true - --cache-copy-layers - --cache-repo=harbor.fizz.buzz/kanikocache/cache diff --git a/.lighthouse/triggers.yaml b/.lighthouse/triggers.yaml index 1882ff5..752accd 100644 --- a/.lighthouse/triggers.yaml +++ b/.lighthouse/triggers.yaml @@ -16,8 +16,8 @@ spec: skip_branches: # We already run on every commit, so running when the semver tags get pushed is causing needless double-processing. - "^v[0-9]+\\.[0-9]+\\.[0-9]+$" - - name: rust-build - source: "pipeline-rust-build.yaml" + - name: build-organic + source: "pipeline-build-organic.yaml" # Override https-based url from lighthouse events. clone_uri: "git@code.fizz.buzz:talexander/organic.git" skip_branches: diff --git a/docker/organic_build/Dockerfile b/docker/organic_build/Dockerfile deleted file mode 100644 index 146f64f..0000000 --- a/docker/organic_build/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM rustlang/rust:nightly-alpine3.19 - -RUN apk add --no-cache musl-dev -RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache -RUN rustup target add wasm32-unknown-unknown - -ENTRYPOINT ["cargo", "build"] diff --git a/docker/organic_build/Makefile b/docker/organic_build/Makefile deleted file mode 100644 index ab76282..0000000 --- a/docker/organic_build/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -IMAGE_NAME:=organic-build -# REMOTE_REPO:=harbor.fizz.buzz/private - -.PHONY: all -all: build push - -.PHONY: build -build: - docker build -t $(IMAGE_NAME) -f Dockerfile . - -.PHONY: push -push: -ifdef REMOTE_REPO - docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME) - docker push $(REMOTE_REPO)/$(IMAGE_NAME) -else - @echo "REMOTE_REPO not defined, not pushing to a remote repo." -endif - -.PHONY: clean -clean: - docker rmi $(IMAGE_NAME) -ifdef REMOTE_REPO - docker rmi $(REMOTE_REPO)/$(IMAGE_NAME) -else - @echo "REMOTE_REPO not defined, not removing from remote repo." -endif - docker volume rm cargo-cache - -# NOTE: This target will write to folders underneath the git-root -.PHONY: run -run: build - docker run --rm --init --read-only --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry $(IMAGE_NAME) - -.PHONY: shell -shell: build - docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry $(IMAGE_NAME) diff --git a/docker/organic_development/Dockerfile b/docker/organic_development/Dockerfile index 26c97bc..bdc7b85 100644 --- a/docker/organic_development/Dockerfile +++ b/docker/organic_development/Dockerfile @@ -5,3 +5,7 @@ RUN cargo install --locked --no-default-features --features ci-autoclean cargo-c RUN rustup component add rustfmt RUN rustup component add clippy RUN rustup component add rustc-codegen-cranelift + +FROM builder AS wasm + +RUN rustup target add wasm32-unknown-unknown