From 9d750ed5e122be36342a690c56afabfc489a78a8 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 10 Apr 2024 20:54:49 -0400 Subject: [PATCH] Fix workflows for new targets. --- .dockerignore | 1 + .lighthouse/pipeline-format.yaml | 4 +- .lighthouse/pipeline-rust-clippy.yaml | 4 +- .lighthouse/pipeline-rust-test.yaml | 132 +++++++++++++++++++++----- 4 files changed, 112 insertions(+), 29 deletions(-) diff --git a/.dockerignore b/.dockerignore index d11570b7..df22a2d3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,4 @@ target Cargo.lock notes/ +.lighthouse/ diff --git a/.lighthouse/pipeline-format.yaml b/.lighthouse/pipeline-format.yaml index f2700796..012034d4 100644 --- a/.lighthouse/pipeline-format.yaml +++ b/.lighthouse/pipeline-format.yaml @@ -87,7 +87,7 @@ spec: value: "gcr.io/kaniko-project/executor:v1.12.1" - name: EXTRA_ARGS value: - - --target=builder + - --target=format - --cache=true - --cache-copy-layers - --cache-repo=harbor.fizz.buzz/kanikocache/cache @@ -294,7 +294,7 @@ spec: serviceAccountName: build-bot params: - name: image-name - value: "harbor.fizz.buzz/private/organic-development" + value: "harbor.fizz.buzz/private/organic-development-format" - name: path-to-image-context value: docker/organic_development/ - name: path-to-dockerfile diff --git a/.lighthouse/pipeline-rust-clippy.yaml b/.lighthouse/pipeline-rust-clippy.yaml index 2ae1266f..b2a061cb 100644 --- a/.lighthouse/pipeline-rust-clippy.yaml +++ b/.lighthouse/pipeline-rust-clippy.yaml @@ -87,7 +87,7 @@ spec: value: "gcr.io/kaniko-project/executor:v1.12.1" - name: EXTRA_ARGS value: - - --target=builder + - --target=clippy - --cache=true - --cache-copy-layers - --cache-repo=harbor.fizz.buzz/kanikocache/cache @@ -273,7 +273,7 @@ spec: serviceAccountName: build-bot params: - name: image-name - value: "harbor.fizz.buzz/private/organic-development" + value: "harbor.fizz.buzz/private/organic-development-clippy" - name: path-to-image-context value: docker/organic_development/ - name: path-to-dockerfile diff --git a/.lighthouse/pipeline-rust-test.yaml b/.lighthouse/pipeline-rust-test.yaml index 25d1ed3f..cf93344f 100644 --- a/.lighthouse/pipeline-rust-test.yaml +++ b/.lighthouse/pipeline-rust-test.yaml @@ -38,7 +38,14 @@ spec: echo "hello world" - name: report-pending taskRef: - name: gitea-set-status + 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: @@ -58,7 +65,14 @@ spec: value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)" - name: fetch-repository taskRef: - name: git-clone + 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 @@ -71,7 +85,14 @@ spec: value: "true" - name: build-image taskRef: - name: kaniko + 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)" @@ -99,9 +120,46 @@ spec: workspace: docker-credentials runAfter: - fetch-repository - - name: run-image - taskRef: - name: run-docker-image + - name: run-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", "test"] + args: + [ + --no-default-features, + --features, + "compare,wasm_test", + --no-fail-fast, + --lib, + --test, + test_loader, + ] + env: + - name: CARGO_TARGET_DIR + value: /target workspaces: - name: source workspace: git-source @@ -110,17 +168,6 @@ spec: runAfter: - build-image params: - - name: args - value: - [ - --no-default-features, - --features, - "compare,wasm_test", - --no-fail-fast, - --lib, - --test, - test_loader, - ] - name: docker-image value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" finally: @@ -130,7 +177,14 @@ spec: operator: in values: ["Succeeded", "Completed"] taskRef: - name: gitea-set-status + 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)" @@ -152,7 +206,14 @@ spec: operator: in values: ["Failed"] taskRef: - name: gitea-set-status + 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)" @@ -169,18 +230,39 @@ spec: - 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 + 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, cache, --autoclean] + args: [] 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: