Also automatically run cargo-fix after rustfmt.
This commit is contained in:
parent
db0ea7394e
commit
b3c638428b
@ -14,13 +14,13 @@ 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: command
|
- name: rustfmt-command
|
||||||
type: array
|
type: array
|
||||||
description: Command to run.
|
description: Command to run rustfmt.
|
||||||
default: []
|
default: []
|
||||||
- name: args
|
- name: rustfmt-args
|
||||||
type: array
|
type: array
|
||||||
description: Arguments passed to command.
|
description: Arguments passed to rustfmt.
|
||||||
default: []
|
default: []
|
||||||
- name: GIT_USER_NAME
|
- name: GIT_USER_NAME
|
||||||
description: The username for git
|
description: The username for git
|
||||||
@ -119,19 +119,36 @@ spec:
|
|||||||
runAfter:
|
runAfter:
|
||||||
- fetch-repository
|
- fetch-repository
|
||||||
- detect-tag
|
- detect-tag
|
||||||
- name: run-image
|
- name: rustfmt
|
||||||
|
taskRef:
|
||||||
|
name: run-docker-image
|
||||||
|
workspaces:
|
||||||
|
- name: source
|
||||||
|
workspace: git-source
|
||||||
|
- name: cargo-cache
|
||||||
|
workspace: cargo-cache
|
||||||
|
runAfter:
|
||||||
|
- build-image
|
||||||
|
params:
|
||||||
|
- name: command
|
||||||
|
value: ["$(params.rustfmt-command[*])"]
|
||||||
|
- name: args
|
||||||
|
value: ["$(params.rustfmt-args[*])"]
|
||||||
|
- name: docker-image
|
||||||
|
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
||||||
|
- name: cargo-fix
|
||||||
taskRef:
|
taskRef:
|
||||||
name: run-docker-image
|
name: run-docker-image
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
runAfter:
|
runAfter:
|
||||||
- build-image
|
- rustfmt
|
||||||
params:
|
params:
|
||||||
- name: command
|
- name: command
|
||||||
value: ["$(params.command[*])"]
|
value: ["cargo", "fix"]
|
||||||
- name: args
|
- name: args
|
||||||
value: ["$(params.args[*])"]
|
value: ["--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
|
||||||
@ -148,7 +165,7 @@ spec:
|
|||||||
git config --global --add safe.directory /workspace/source
|
git config --global --add safe.directory /workspace/source
|
||||||
git_status=$(git status --porcelain)
|
git_status=$(git status --porcelain)
|
||||||
if [ -n "$git_status" ]; then
|
if [ -n "$git_status" ]; then
|
||||||
git commit -a -m "CI: format rust code."
|
git commit -a -m "CI: autofix rust code."
|
||||||
git push origin HEAD:$(params.PULL_BASE_REF)
|
git push origin HEAD:$(params.PULL_BASE_REF)
|
||||||
else
|
else
|
||||||
echo "No changes to commit."
|
echo "No changes to commit."
|
||||||
@ -157,7 +174,7 @@ spec:
|
|||||||
- name: source
|
- name: source
|
||||||
workspace: git-source
|
workspace: git-source
|
||||||
runAfter:
|
runAfter:
|
||||||
- run-image
|
- cargo-fix
|
||||||
finally:
|
finally:
|
||||||
- name: report-success
|
- name: report-success
|
||||||
when:
|
when:
|
||||||
@ -217,6 +234,9 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
storage: 10Gi
|
storage: 10Gi
|
||||||
subPath: rust-source
|
subPath: rust-source
|
||||||
|
- name: cargo-cache
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: cargo-cache
|
||||||
- name: docker-credentials
|
- name: docker-credentials
|
||||||
secret:
|
secret:
|
||||||
secretName: harbor-plain
|
secretName: harbor-plain
|
||||||
|
Loading…
x
Reference in New Issue
Block a user