Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image-pull-secret option #54

Merged
merged 14 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ Whether to always pull the latest image before running the command. Sets [imageP

Default: `false`

### ``image-pull-secret`` (optional, string)

The name of the secret that holds the credentials for a remote container registry.


### `command` (optional, array)

Sets the command for the container. Useful if the container image has an entrypoint, but requires extra arguments.
Expand Down
9 changes: 9 additions & 0 deletions lib/job.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function(jobName, agentEnv={}, stepEnvFile='', patchFunc=identity) patchFunc({
BUILDKITE_PLUGIN_K8S_AGENT_TOKEN_SECRET_KEY: 'buildkite-agent-token',
BUILDKITE_PLUGIN_K8S_INIT_IMAGE: 'embarkstudios/k8s-buildkite-agent@sha256:3c010d09915f3b39c2f8324af5f0aaf910a643e7d63607ee8d49653931b8b167',
BUILDKITE_PLUGIN_K8S_ALWAYS_PULL: false,
BUILDKITE_PLUGIN_K8S_IMAGE_PULL_SECRET: '',
BUILDKITE_PLUGIN_K8S_BUILD_PATH_HOST_PATH: '',
BUILDKITE_PLUGIN_K8S_BUILD_PATH_PVC: '',
BUILDKITE_PLUGIN_K8S_GIT_MIRRORS_HOST_PATH: '',
Expand Down Expand Up @@ -273,6 +274,12 @@ function(jobName, agentEnv={}, stepEnvFile='', patchFunc=identity) patchFunc({

local deadline = std.parseInt(env.BUILDKITE_TIMEOUT) * 60,

local imagePullSecrets =
if env.BUILDKITE_PLUGIN_K8S_IMAGE_PULL_SECRET == '' then []
else [
{name: env.BUILDKITE_PLUGIN_K8S_IMAGE_PULL_SECRET},
],

apiVersion: 'batch/v1',
kind: 'Job',
metadata: {
Expand All @@ -297,6 +304,8 @@ function(jobName, agentEnv={}, stepEnvFile='', patchFunc=identity) patchFunc({
restartPolicy: 'Never',
serviceAccountName: env.BUILDKITE_PLUGIN_K8S_SERVICE_ACCOUNT_NAME,
initContainers: initContainers,
imagePullSecrets: imagePullSecrets,

containers: [
{
name: 'step',
Expand Down
2 changes: 2 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ configuration:
properties:
image:
type: string
image-pull-secret:
type: string
always-pull:
type: boolean
command:
Expand Down