Add a CI job to format the rust.
This commit is contained in:
parent
5d59efd426
commit
edcad08406
@ -28,3 +28,65 @@ spec:
|
||||
storage: 10Gi
|
||||
subPath: organic-source
|
||||
params: []
|
||||
- name: cargo-fmt
|
||||
agent: tekton-pipeline
|
||||
branches:
|
||||
- ^main$
|
||||
- ^master$
|
||||
context: cargo-fmt
|
||||
max_concurrency: 1
|
||||
# Override https-based url from lighthouse events.
|
||||
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||
pipeline_run_spec:
|
||||
serviceAccountName: build-bot
|
||||
pipelineRef:
|
||||
name: cargo-fmt-pipeline
|
||||
namespace: lighthouse
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: rust-source
|
||||
params:
|
||||
- name: GIT_BRANCH
|
||||
value: "master"
|
||||
- name: build-cargo-fmt
|
||||
agent: tekton-pipeline
|
||||
branches:
|
||||
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
|
||||
context: build-docker
|
||||
max_concurrency: 1
|
||||
# Override https-based url from lighthouse events.
|
||||
clone_uri: "git@code.fizz.buzz:talexander/organic.git"
|
||||
pipeline_run_spec:
|
||||
serviceAccountName: build-bot
|
||||
pipelineRef:
|
||||
name: build-docker-pipeline
|
||||
namespace: lighthouse
|
||||
workspaces:
|
||||
- name: git-source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
subPath: git-source
|
||||
- name: docker-credentials
|
||||
secret:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/cargo-fmt"
|
||||
- name: path-to-image-context
|
||||
value: docker/cargo_fmt/
|
||||
- name: path-to-dockerfile
|
||||
value: docker/cargo_fmt/Dockerfile
|
||||
|
5
docker/cargo_fmt/Dockerfile
Normal file
5
docker/cargo_fmt/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM harbor.fizz.buzz/dockerhub/library/rust:1.70.0
|
||||
|
||||
RUN rustup component add rustfmt
|
||||
|
||||
ENTRYPOINT ["cargo", "fmt"]
|
35
docker/cargo_fmt/Makefile
Normal file
35
docker/cargo_fmt/Makefile
Normal file
@ -0,0 +1,35 @@
|
||||
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
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
docker run --rm -i -t $(IMAGE_NAME)
|
||||
|
||||
.PHONY: shell
|
||||
shell:
|
||||
docker run --rm -i -t --entrypoint /bin/bash $(IMAGE_NAME)
|
Loading…
x
Reference in New Issue
Block a user