Merge branch 'fix_docker'
Some checks failed
format Build format has failed
clippy Build clippy has failed
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-test Build rust-test has succeeded
build-organic Build build-organic has succeeded

This commit is contained in:
Tom Alexander 2024-04-11 20:24:06 -04:00
commit 7223e08df3
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
20 changed files with 1268 additions and 678 deletions

View File

@ -2,3 +2,4 @@
target target
Cargo.lock Cargo.lock
notes/ notes/
.lighthouse/

View File

@ -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: 60Mi
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: 60Mi
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:
- run-image-none
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: 60Mi
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:
- run-image-tracing
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: 60Mi
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:
- run-image-compare
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: 60Mi
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:
- run-image-default
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: 60Mi
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:
- run-image-tracing-compare
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: 60Mi
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:
- run-image-compare-foreign
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: 60Mi
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:
- run-image-all
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: 60Mi
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:
- run-image-wasm
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: 60Mi
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

View File

@ -28,7 +28,7 @@ spec:
resources: resources:
requests: requests:
cpu: 10m cpu: 10m
memory: 600Mi memory: 60Mi
workingDir: /workspace/source workingDir: /workspace/source
steps: steps:
- image: alpine:3.18 - image: alpine:3.18
@ -38,7 +38,14 @@ spec:
echo "hello world" 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:
@ -58,7 +65,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
@ -71,7 +85,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)"
@ -83,7 +104,7 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- --target=foreign-document-test - --target=foreign-document
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@ -99,9 +120,35 @@ spec:
workspace: docker-credentials workspace: docker-credentials
runAfter: runAfter:
- fetch-repository - fetch-repository
- name: run-image - name: run-test
taskRef: taskSpec:
name: run-docker-image 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: 60Mi
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)"
env:
- name: CARGO_TARGET_DIR
value: /target
workspaces: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
@ -119,7 +166,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)"
@ -141,7 +195,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)"
@ -158,18 +219,39 @@ spec:
- 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 - name: cargo-cache-autoclean
taskRef: taskSpec:
name: run-docker-image 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: 60Mi
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: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
- name: cargo-cache - name: cargo-cache
workspace: cargo-cache workspace: cargo-cache
params: params:
- name: command
value: [cargo, cache, --autoclean]
- name: args
value: []
- name: docker-image - name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
workspaces: workspaces:

View File

@ -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)"
@ -87,6 +87,7 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- --target=format
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@ -102,42 +103,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: 60Mi
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 +174,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 +182,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 +211,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 +234,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: 60Mi
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 +292,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-format"
- 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

View File

@ -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

View File

@ -1,9 +1,13 @@
apiVersion: tekton.dev/v1beta1 apiVersion: tekton.dev/v1beta1
kind: PipelineRun kind: PipelineRun
metadata: metadata:
name: clippy name: rust-clippy
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)"
@ -87,6 +87,7 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- --target=clippy
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@ -102,9 +103,47 @@ spec:
workspace: docker-credentials workspace: docker-credentials
runAfter: runAfter:
- fetch-repository - fetch-repository
- name: clippy - name: run-cargo-clippy
taskRef: taskSpec:
name: run-docker-image 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: 60Mi
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",
"clippy",
"--no-deps",
"--all-targets",
"--all-features",
"--",
"-D",
"warnings",
]
args: []
env:
- name: CARGO_TARGET_DIR
value: /target
workspaces: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
@ -122,7 +161,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)"
@ -144,7 +190,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)"
@ -160,9 +213,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: 60Mi
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:
@ -181,11 +271,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-clippy" value: "harbor.fizz.buzz/private/organic-development-clippy"
- name: path-to-image-context - name: path-to-image-context
value: docker/organic_clippy/ value: docker/organic_development/
- name: path-to-dockerfile - name: path-to-dockerfile
value: docker/organic_clippy/Dockerfile value: docker/organic_development/Dockerfile

View File

@ -28,7 +28,7 @@ spec:
resources: resources:
requests: requests:
cpu: 10m cpu: 10m
memory: 600Mi memory: 60Mi
workingDir: /workspace/source workingDir: /workspace/source
steps: steps:
- image: alpine:3.18 - image: alpine:3.18
@ -38,7 +38,14 @@ spec:
echo "hello world" 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:
@ -58,7 +65,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
@ -71,7 +85,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)"
@ -99,9 +120,46 @@ spec:
workspace: docker-credentials workspace: docker-credentials
runAfter: runAfter:
- fetch-repository - fetch-repository
- name: run-image - name: run-test
taskRef: taskSpec:
name: run-docker-image 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: 60Mi
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: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
@ -110,17 +168,6 @@ spec:
runAfter: runAfter:
- build-image - build-image
params: params:
- name: args
value:
[
--no-default-features,
--features,
"compare,wasm_test",
--no-fail-fast,
--lib,
--test,
test_loader,
]
- name: docker-image - name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
finally: finally:
@ -130,7 +177,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)"
@ -152,7 +206,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)"
@ -169,18 +230,39 @@ spec:
- 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 - name: cargo-cache-autoclean
taskRef: taskSpec:
name: run-docker-image 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: 60Mi
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: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
- name: cargo-cache - name: cargo-cache
workspace: cargo-cache workspace: cargo-cache
params: params:
- name: command
value: [cargo, cache, --autoclean]
- name: args
value: []
- name: docker-image - name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
workspaces: workspaces:

View File

@ -2,36 +2,36 @@ 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: branches:
- ^main$ - ^main$
- ^master$ - ^master$
- name: rust-test
source: "pipeline-rust-test.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: rust-foreign-document-test - name: rust-foreign-document-test
source: "pipeline-foreign-document-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: branches:
# We already run on every commit, so running when the semver tags get pushed is causing needless double-processing. - ^main$
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$" - ^master$
- name: rust-build - name: build-organic
source: "pipeline-rust-build.yaml" source: "pipeline-build-organic.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: branches:
# We already run on every commit, so running when the semver tags get pushed is causing needless double-processing. - ^main$
- "^v[0-9]+\\.[0-9]+\\.[0-9]+$" - ^master$
- name: clippy - name: clippy
source: "pipeline-clippy.yaml" source: "pipeline-rust-clippy.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: format
source: "pipeline-format.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:

View File

@ -22,55 +22,70 @@ ifeq ($(origin .RECIPEPREFIX), undefined)
endif endif
.RECIPEPREFIX = > .RECIPEPREFIX = >
.PHONY: help
help: ## List the available make targets.
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
.PHONY: build .PHONY: build
build: build: ## Make a debug build of the project.
> cargo build > cargo build
.PHONY: release .PHONY: release
release: release: ## Make an optimized build of the project.
> cargo build --release $(RELEASEFLAGS) > cargo build --release $(RELEASEFLAGS)
.PHONY: wasm .PHONY: wasm
wasm: wasm: ## Build the parser as wasm.
> cargo build --target=wasm32-unknown-unknown --profile wasm --bin wasm --features wasm > cargo build --target=wasm32-unknown-unknown --profile wasm --bin wasm --features wasm
> wasm-bindgen --target $(WASMTARGET) --out-dir target/wasm32-unknown-unknown/js target/wasm32-unknown-unknown/wasm/wasm.wasm > wasm-bindgen --target $(WASMTARGET) --out-dir target/wasm32-unknown-unknown/js target/wasm32-unknown-unknown/wasm/wasm.wasm
.PHONY: clean .PHONY: clean
clean: clean: ## Delete the built binaries.
> cargo clean > cargo clean
> $(MAKE) -C docker/organic_development TARGET=builder clean
> $(MAKE) -C docker/organic_development TARGET=format clean
> $(MAKE) -C docker/organic_development TARGET=clippy clean
> $(MAKE) -C docker/organic_development TARGET=wasm clean
> $(MAKE) -C docker/organic_test TARGET=tester build
.PHONY: format .PHONY: format
format: format: ## Format the code.
> $(MAKE) -C docker/cargo_fmt run > cargo fmt
.PHONY: dockerclippy .PHONY: docker_format
dockerclippy: docker_format: ## Format the code using docker.
> $(MAKE) -C docker/organic_clippy run > $(MAKE) -C docker/organic_development TARGET=format build
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "organic-cargo-registry:/usr/local/cargo/registry" organic-development-format cargo fmt
.PHONY: docker_clippy
docker_clippy: ## Lint the code using docker.
> $(MAKE) -C docker/organic_development TARGET=clippy build
> docker run --rm -i -t --mount type=tmpfs,destination=/tmp -v "$(shell readlink -f .):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "organic-cargo-registry:/usr/local/cargo/registry" organic-development-clippy cargo clippy --no-deps --all-targets --all-features -- -D warnings
.PHONY: clippy .PHONY: clippy
clippy: clippy: ## Lint the code.
> cargo clippy --no-deps --all-targets --all-features -- -D warnings > cargo clippy --no-deps --all-targets --all-features -- -D warnings
.PHONY: test .PHONY: test
test: test: ## Run the test suite.
> cargo test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS) > cargo test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS)
.PHONY: doc .PHONY: doc
doc: doc: ## Generate documentation.
> cargo doc --no-deps --open --lib --release --all-features > cargo doc --no-deps --open --lib --release --all-features
.PHONY: dockertest .PHONY: docker_test
dockertest: docker_test: ## Run the test suite using docker.
> $(MAKE) -C docker/organic_test > $(MAKE) -C docker/organic_test TARGET=tester build
> docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS) > docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare --no-fail-fast --lib --test test_loader -- --test-threads $(TESTJOBS)
.PHONY: dockerwasmtest .PHONY: docker_wasm_test
dockerwasmtest: docker_wasm_test: ## Run the test suite with wasm tests.
> $(MAKE) -C docker/organic_test > $(MAKE) -C docker/organic_test TARGET=tester build
> docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare,wasm_test --no-fail-fast --lib --test test_loader autogen_wasm_ -- --test-threads $(TESTJOBS) > docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test --no-default-features --features compare,wasm_test --no-fail-fast --lib --test test_loader autogen_wasm_ -- --test-threads $(TESTJOBS)
.PHONY: buildtest .PHONY: build_test
buildtest: build_test:
> cargo build --no-default-features > cargo build --no-default-features
> cargo build --no-default-features --features compare > cargo build --no-default-features --features compare
> cargo build --no-default-features --features tracing > cargo build --no-default-features --features tracing
@ -82,7 +97,8 @@ buildtest:
.PHONY: foreign_document_test .PHONY: foreign_document_test
foreign_document_test: foreign_document_test:
> $(MAKE) -C docker/organic_test run_foreign_document_test > $(MAKE) -C docker/organic_test TARGET=foreign-document build
> docker run --init --rm -i -t --read-only -v "$$(readlink -f ./):/source:ro" --mount type=tmpfs,destination=/tmp --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test-foreign-document
.PHONY: dockerclean .PHONY: dockerclean
dockerclean: dockerclean:

View File

@ -1,6 +0,0 @@
FROM rustlang/rust:nightly-alpine3.17
RUN apk add --no-cache musl-dev
RUN rustup component add rustfmt
ENTRYPOINT ["cargo", "fmt"]

View File

@ -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)

View File

@ -1,7 +0,0 @@
FROM rustlang/rust:nightly-alpine3.17
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"]

View File

@ -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)

View File

@ -1,5 +0,0 @@
FROM rustlang/rust:nightly-alpine3.17
RUN apk add --no-cache musl-dev
ENTRYPOINT ["cargo", "clippy", "--no-deps", "--all-targets", "--all-features", "--", "-D", "warnings"]

View File

@ -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)

View File

@ -0,0 +1,17 @@
FROM rustlang/rust:nightly-alpine3.19 AS builder
RUN apk add --no-cache musl-dev
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN rustup component add rustc-codegen-cranelift
FROM builder AS format
RUN rustup component add rustfmt
FROM builder AS clippy
RUN rustup component add clippy
FROM builder AS wasm
RUN rustup target add wasm32-unknown-unknown

View File

@ -0,0 +1,36 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
TARGET := builder
IMAGE_NAME := organic-development
ifneq ($(TARGET),builder)
IMAGE_NAME := $(IMAGE_NAME)-$(TARGET)
endif
.PHONY: help
help:
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
.PHONY: build
build: ## Build the docker image.
> docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile .
> docker volume create organic-cargo-registry
.PHONY: shell
shell: ## Launch an interactive shell inside the docker image with the source repository mounted at /source.
shell: build
> docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "organic-cargo-registry:/usr/local/cargo/registry" $(IMAGE_NAME)
.PHONY: clean
clean: ## Remove the docker image and volume.
> docker rmi $(IMAGE_NAME)
> docker volume rm organic-cargo-registry

View File

@ -1,4 +1,4 @@
FROM alpine:3.17 AS build FROM alpine:3.19 AS build
RUN apk add --no-cache build-base musl-dev git autoconf make texinfo gnutls-dev ncurses-dev gawk libgccjit-dev RUN apk add --no-cache build-base musl-dev git autoconf make texinfo gnutls-dev ncurses-dev gawk libgccjit-dev
@ -25,10 +25,11 @@ RUN make compile
RUN make DESTDIR="/root/dist" install RUN make DESTDIR="/root/dist" install
FROM rustlang/rust:nightly-alpine3.17 AS tester FROM rustlang/rust:nightly-alpine3.19 AS tester
ENV LANG=en_US.UTF-8 ENV LANG=en_US.UTF-8
RUN apk add --no-cache musl-dev ncurses gnutls libgccjit RUN apk add --no-cache musl-dev ncurses gnutls libgccjit
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN rustup component add rustc-codegen-cranelift
COPY --from=build-emacs /root/dist/ / COPY --from=build-emacs /root/dist/ /
COPY --from=build-org-mode /root/dist/ / COPY --from=build-org-mode /root/dist/ /
@ -100,7 +101,7 @@ RUN mkdir -p $LITERATE_BUILD_EMACS_PATH && git -C $LITERATE_BUILD_EMACS_PATH ini
# unused/aws.org contains invalid paths for setupfile which causes both upstream org-mode and Organic to error out. # unused/aws.org contains invalid paths for setupfile which causes both upstream org-mode and Organic to error out.
RUN rm $LITERATE_BUILD_EMACS_PATH/unused/aws.org RUN rm $LITERATE_BUILD_EMACS_PATH/unused/aws.org
FROM tester as foreign-document-test FROM tester as foreign-document
RUN apk add --no-cache bash coreutils RUN apk add --no-cache bash coreutils
RUN mkdir /foreign_documents RUN mkdir /foreign_documents
COPY --from=foreign-document-gather /foreign_documents/howardabrams /foreign_documents/howardabrams COPY --from=foreign-document-gather /foreign_documents/howardabrams /foreign_documents/howardabrams

View File

@ -1,44 +1,36 @@
IMAGE_NAME:=organic-test SHELL := bash
# REMOTE_REPO:=harbor.fizz.buzz/private .ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
.PHONY: all ifeq ($(origin .RECIPEPREFIX), undefined)
all: build push $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
TARGET := tester
IMAGE_NAME := organic-test
ifneq ($(TARGET),tester)
IMAGE_NAME := $(IMAGE_NAME)-$(TARGET)
endif
.PHONY: help
help:
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
.PHONY: build .PHONY: build
build: build: ## Build the docker image.
docker build -t $(IMAGE_NAME) -f Dockerfile --target tester . > docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile .
> docker volume create organic-cargo-registry
.PHONY: build_foreign_document_test
build_foreign_document_test:
docker build -t $(IMAGE_NAME)-foreign-document -f Dockerfile --target foreign-document-test .
.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
.PHONY: run
run: build
docker run --rm --init --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) --no-default-features --features compare --no-fail-fast --lib --test test_loader
.PHONY: shell .PHONY: shell
shell: ## Launch an interactive shell inside the docker image with the source repository mounted at /source.
shell: build 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) > docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --env CARGO_TARGET_DIR=/target -v "organic-cargo-registry:/usr/local/cargo/registry" $(IMAGE_NAME)
.PHONY: run_foreign_document_test .PHONY: clean
run_foreign_document_test: build_foreign_document_test clean: ## Remove the docker image and volume.
docker run --rm --init --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)-foreign-document > docker rmi $(IMAGE_NAME)
> docker volume rm organic-cargo-registry

View File

@ -71,7 +71,7 @@ pub struct EntityDefinition<'a> {
impl<'g, 's> GlobalSettings<'g, 's> { impl<'g, 's> GlobalSettings<'g, 's> {
fn new() -> GlobalSettings<'g, 's> { fn new() -> GlobalSettings<'g, 's> {
debug_assert!(DEFAULT_ORG_ENTITIES.is_sorted_by(|a, b| a.name.len() <= b.name.len())); debug_assert!(DEFAULT_ORG_ENTITIES.is_sorted_by(|a, b| a.name.len() >= b.name.len()));
GlobalSettings { GlobalSettings {
radio_targets: Vec::new(), radio_targets: Vec::new(),
file_access: &LocalFileAccessInterface { file_access: &LocalFileAccessInterface {