ci: create pre-built tools image

This commit is contained in:
Khue Doan 2023-01-26 15:27:35 +07:00
parent bc8beffb73
commit c0d1620050
3 changed files with 61 additions and 7 deletions

View File

@ -24,7 +24,33 @@ spec:
value: $(params.git_url)
- name: revision
value: $(params.git_revision)
- name: tools
runAfter:
- clone
taskRef:
resolver: hub
params:
- name: kind
value: task
- name: name
value: kaniko
- name: version
value: "0.6"
params:
- name: DOCKERFILE
value: ./Dockerfile.tools
- name: IMAGE
value: &toolsImage registry.khuedoan.com/homelab-tools:$(params.git_revision)
- name: EXTRA_ARGS
value:
- --cache=true
workspaces:
- name: source
workspace: shared-data
- name: test
runAfter:
- clone
- tools
workspaces:
- name: source
workspace: shared-data
@ -32,14 +58,12 @@ spec:
workspaces:
- name: source
stepTemplate:
image: nixos/nix:latest
workingDir: /workspace/source
image: *toolsImage
workingDir: $(workspaces.source.path)
steps:
# TODO optimize Nix cache, this is too slow
- name: pre-commit
command:
- nix-shell
- --command
args:
- "pre-commit run --color=always"
# TODO run more tests here

View File

@ -24,7 +24,33 @@ spec:
value: $(params.git_url)
- name: revision
value: $(params.git_revision)
- name: tools
runAfter:
- clone
taskRef:
resolver: hub
params:
- name: kind
value: task
- name: name
value: kaniko
- name: version
value: "0.6"
params:
- name: DOCKERFILE
value: ./Dockerfile.tools
- name: IMAGE
value: &toolsImage registry.khuedoan.com/homelab-tools:$(params.git_revision)
- name: EXTRA_ARGS
value:
- --cache=true
workspaces:
- name: source
workspace: shared-data
- name: test
runAfter:
- clone
- tools
workspaces:
- name: source
workspace: shared-data
@ -32,10 +58,9 @@ spec:
workspaces:
- name: source
stepTemplate:
image: nixos/nix:latest
workingDir: /workspace/source
image: *toolsImage
workingDir: $(workspaces.source.path)
steps:
# TODO optimize Nix cache, this is too slow
- name: pre-commit
command:
- nix-shell

5
Dockerfile.tools Normal file
View File

@ -0,0 +1,5 @@
FROM nixos/nix
COPY shell.nix shell.nix
RUN nix-shell --command exit