Inline the format pipeline.
This commit is contained in:
parent
4dee130873
commit
4e9f1e4fac
@ -1,9 +1,13 @@
|
|||||||
apiVersion: tekton.dev/v1beta1
|
apiVersion: tekton.dev/v1beta1
|
||||||
kind: PipelineRun
|
kind: PipelineRun
|
||||||
metadata:
|
metadata:
|
||||||
name: rustfmt
|
name: rust-format
|
||||||
spec:
|
spec:
|
||||||
pipelineSpec:
|
pipelineSpec:
|
||||||
|
timeouts:
|
||||||
|
pipeline: "2h0m0s"
|
||||||
|
tasks: "1h0m40s"
|
||||||
|
finally: "0h30m0s"
|
||||||
params:
|
params:
|
||||||
- name: image-name
|
- name: image-name
|
||||||
description: The name for the built image
|
description: The name for the built image
|
||||||
@ -14,35 +18,17 @@ spec:
|
|||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
description: The path to the Dockerfile
|
description: The path to the Dockerfile
|
||||||
type: string
|
type: string
|
||||||
- name: GIT_USER_NAME
|
|
||||||
description: The username for git
|
|
||||||
type: string
|
|
||||||
default: "fluxcdbot"
|
|
||||||
- name: GIT_USER_EMAIL
|
|
||||||
description: The email for git
|
|
||||||
type: string
|
|
||||||
default: "fluxcdbot@users.noreply.github.com"
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: do-stuff
|
|
||||||
taskSpec:
|
|
||||||
metadata: {}
|
|
||||||
stepTemplate:
|
|
||||||
image: alpine:3.18
|
|
||||||
name: ""
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 600Mi
|
|
||||||
workingDir: /workspace/source
|
|
||||||
steps:
|
|
||||||
- image: alpine:3.18
|
|
||||||
name: do-stuff-step
|
|
||||||
script: |
|
|
||||||
#!/usr/bin/env sh
|
|
||||||
echo "hello world"
|
|
||||||
- name: report-pending
|
- name: report-pending
|
||||||
taskRef:
|
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:
|
runAfter:
|
||||||
- fetch-repository
|
- fetch-repository
|
||||||
params:
|
params:
|
||||||
@ -62,7 +48,14 @@ spec:
|
|||||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
||||||
- name: fetch-repository
|
- name: fetch-repository
|
||||||
taskRef:
|
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:
|
workspaces:
|
||||||
- name: output
|
- name: output
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
@ -75,7 +68,14 @@ spec:
|
|||||||
value: "true"
|
value: "true"
|
||||||
- name: build-image
|
- name: build-image
|
||||||
taskRef:
|
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:
|
params:
|
||||||
- name: IMAGE
|
- name: IMAGE
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
||||||
@ -102,42 +102,62 @@ spec:
|
|||||||
workspace: docker-credentials
|
workspace: docker-credentials
|
||||||
runAfter:
|
runAfter:
|
||||||
- fetch-repository
|
- fetch-repository
|
||||||
- name: rustfmt
|
- name: run-cargo-fmt
|
||||||
taskRef:
|
taskSpec:
|
||||||
name: run-docker-image
|
metadata: {}
|
||||||
workspaces:
|
params:
|
||||||
- name: source
|
- name: docker-image
|
||||||
workspace: git-source
|
type: string
|
||||||
runAfter:
|
description: Docker image to run.
|
||||||
- build-image
|
default: alpine:3.18
|
||||||
params:
|
stepTemplate:
|
||||||
- name: docker-image
|
image: alpine:3.18
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
name: ""
|
||||||
- name: cargo-fix
|
resources:
|
||||||
taskRef:
|
requests:
|
||||||
name: run-docker-image
|
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", "fmt"]
|
||||||
|
args: []
|
||||||
|
env:
|
||||||
|
- name: CARGO_TARGET_DIR
|
||||||
|
value: /target
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
- name: cargo-cache
|
- name: cargo-cache
|
||||||
workspace: cargo-cache
|
workspace: cargo-cache
|
||||||
runAfter:
|
runAfter:
|
||||||
- rustfmt
|
- build-image
|
||||||
params:
|
params:
|
||||||
- name: command
|
|
||||||
value: ["cargo", "fix"]
|
|
||||||
- name: args
|
|
||||||
value: ["--all-targets", "--all-features", "--allow-dirty"]
|
|
||||||
- name: docker-image
|
- name: docker-image
|
||||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
||||||
- name: commit-changes
|
- name: commit-changes
|
||||||
taskRef:
|
taskRef:
|
||||||
name: git-cli
|
resolver: git
|
||||||
|
params:
|
||||||
|
- name: url
|
||||||
|
value: https://github.com/tektoncd/catalog.git
|
||||||
|
- name: revision
|
||||||
|
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||||
|
- name: pathInRepo
|
||||||
|
value: task/git-cli/0.4/git-cli.yaml
|
||||||
params:
|
params:
|
||||||
- name: GIT_USER_NAME
|
- name: GIT_USER_NAME
|
||||||
value: $(params.GIT_USER_NAME)
|
value: fluxcdbot
|
||||||
- name: GIT_USER_EMAIL
|
- name: GIT_USER_EMAIL
|
||||||
value: $(params.GIT_USER_EMAIL)
|
value: "fluxcdbot@users.noreply.github.com"
|
||||||
- name: GIT_SCRIPT
|
- name: GIT_SCRIPT
|
||||||
value: |
|
value: |
|
||||||
pwd
|
pwd
|
||||||
@ -153,7 +173,7 @@ spec:
|
|||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
runAfter:
|
runAfter:
|
||||||
- cargo-fix
|
- run-cargo-fmt
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
when:
|
when:
|
||||||
@ -161,7 +181,14 @@ spec:
|
|||||||
operator: in
|
operator: in
|
||||||
values: ["Succeeded", "Completed"]
|
values: ["Succeeded", "Completed"]
|
||||||
taskRef:
|
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:
|
params:
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: "$(params.JOB_NAME)"
|
value: "$(params.JOB_NAME)"
|
||||||
@ -183,7 +210,14 @@ spec:
|
|||||||
operator: in
|
operator: in
|
||||||
values: ["Failed"]
|
values: ["Failed"]
|
||||||
taskRef:
|
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:
|
params:
|
||||||
- name: CONTEXT
|
- name: CONTEXT
|
||||||
value: "$(params.JOB_NAME)"
|
value: "$(params.JOB_NAME)"
|
||||||
@ -199,9 +233,46 @@ spec:
|
|||||||
value: failure
|
value: failure
|
||||||
- name: TARGET_URL
|
- name: TARGET_URL
|
||||||
value: "https://tekton.fizz.buzz/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)"
|
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
|
||||||
|
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: docker-image
|
||||||
|
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
|
- name: cargo-cache
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: git-source
|
- name: git-source
|
||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
@ -220,11 +291,10 @@ spec:
|
|||||||
secret:
|
secret:
|
||||||
secretName: harbor-plain
|
secretName: harbor-plain
|
||||||
serviceAccountName: build-bot
|
serviceAccountName: build-bot
|
||||||
timeout: 240h0m0s
|
|
||||||
params:
|
params:
|
||||||
- name: image-name
|
- name: image-name
|
||||||
value: "harbor.fizz.buzz/private/organic-fmt"
|
value: "harbor.fizz.buzz/private/organic-development"
|
||||||
- name: path-to-image-context
|
- name: path-to-image-context
|
||||||
value: docker/cargo_fmt/
|
value: docker/organic_development/
|
||||||
- name: path-to-dockerfile
|
- name: path-to-dockerfile
|
||||||
value: docker/cargo_fmt/Dockerfile
|
value: docker/organic_development/Dockerfile
|
@ -2,34 +2,27 @@ apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
|
|||||||
kind: TriggerConfig
|
kind: TriggerConfig
|
||||||
spec:
|
spec:
|
||||||
postsubmits:
|
postsubmits:
|
||||||
# - name: rustfmt
|
- name: rust-test
|
||||||
# source: "pipeline-rustfmt.yaml"
|
source: "pipeline-rust-test.yaml"
|
||||||
# # Override https-based url from lighthouse events.
|
# Override https-based url from lighthouse events.
|
||||||
# clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||||
# branches:
|
skip_branches:
|
||||||
# - ^main$
|
# We already run on every commit, so running when the semver tags get pushed is causing needless double-processing.
|
||||||
# - ^master$
|
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
|
||||||
# - name: rust-test
|
- name: rust-foreign-document-test
|
||||||
# source: "pipeline-rust-test.yaml"
|
source: "pipeline-foreign-document-test.yaml"
|
||||||
# # Override https-based url from lighthouse events.
|
# Override https-based url from lighthouse events.
|
||||||
# clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||||
# skip_branches:
|
skip_branches:
|
||||||
# # We already run on every commit, so running when the semver tags get pushed is causing needless double-processing.
|
# 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]+$"
|
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
|
||||||
# - name: rust-foreign-document-test
|
- name: rust-build
|
||||||
# source: "pipeline-foreign-document-test.yaml"
|
source: "pipeline-rust-build.yaml"
|
||||||
# # Override https-based url from lighthouse events.
|
# Override https-based url from lighthouse events.
|
||||||
# clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||||
# skip_branches:
|
skip_branches:
|
||||||
# # We already run on every commit, so running when the semver tags get pushed is causing needless double-processing.
|
# 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]+$"
|
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
|
||||||
# - name: rust-build
|
|
||||||
# source: "pipeline-rust-build.yaml"
|
|
||||||
# # Override https-based url from lighthouse events.
|
|
||||||
# clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
|
||||||
# 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: clippy
|
- name: clippy
|
||||||
source: "pipeline-rust-clippy.yaml"
|
source: "pipeline-rust-clippy.yaml"
|
||||||
# Override https-based url from lighthouse events.
|
# Override https-based url from lighthouse events.
|
||||||
@ -37,3 +30,10 @@ spec:
|
|||||||
skip_branches:
|
skip_branches:
|
||||||
# We already run on every commit, so running when the semver tags get pushed is causing needless double-processing.
|
# 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]+$"
|
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
|
||||||
|
- name: format
|
||||||
|
source: "pipeline-format.yaml"
|
||||||
|
# Override https-based url from lighthouse events.
|
||||||
|
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||||
|
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]+$"
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
FROM rustlang/rust:nightly-alpine3.19
|
|
||||||
|
|
||||||
RUN apk add --no-cache musl-dev
|
|
||||||
RUN rustup component add rustfmt
|
|
||||||
|
|
||||||
ENTRYPOINT ["cargo", "fmt"]
|
|
@ -1,36 +0,0 @@
|
|||||||
IMAGE_NAME:=cargo-fmt
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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 $(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 $(IMAGE_NAME)
|
|
@ -1,5 +0,0 @@
|
|||||||
FROM rustlang/rust:nightly-alpine3.19
|
|
||||||
|
|
||||||
RUN apk add --no-cache musl-dev
|
|
||||||
|
|
||||||
ENTRYPOINT ["cargo", "clippy", "--no-deps", "--all-targets", "--all-features", "--", "-D", "warnings"]
|
|
@ -1,37 +0,0 @@
|
|||||||
IMAGE_NAME:=organic-clippy
|
|
||||||
# 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 rust-cache cargo-cache
|
|
||||||
|
|
||||||
# NOTE: This target will write to folders underneath the git-root
|
|
||||||
.PHONY: run
|
|
||||||
run: build
|
|
||||||
docker run --rm --init -t --read-only --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source:ro" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target $(IMAGE_NAME)
|
|
||||||
|
|
||||||
.PHONY: shell
|
|
||||||
shell: build
|
|
||||||
docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source:ro" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target $(IMAGE_NAME)
|
|
Loading…
Reference in New Issue
Block a user