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

Remove creds-init image from build and deploy #3665

Merged
merged 1 commit into from Jan 8, 2021
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
1 change: 0 additions & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defaultBaseImage: gcr.io/distroless/static:nonroot
baseImageOverrides:
# These base images run as root, which is needed for how they handle SSH credentials.
# They are produced from ./images/Dockerfile
github.com/tektoncd/pipeline/cmd/creds-init: gcr.io/tekton-nightly/github.com/tektoncd/pipeline/build-base:latest
github.com/tektoncd/pipeline/cmd/git-init: gcr.io/tekton-nightly/github.com/tektoncd/pipeline/build-base:latest

# GCS fetcher needs root due to workspace permissions
Expand Down
2 changes: 0 additions & 2 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ var (
entrypointImage = flag.String("entrypoint-image", "", "The container image containing our entrypoint binary.")
nopImage = flag.String("nop-image", "", "The container image used to stop sidecars")
gitImage = flag.String("git-image", "", "The container image containing our Git binary.")
credsImage = flag.String("creds-image", "", "The container image for preparing our Build's credentials.")
kubeconfigWriterImage = flag.String("kubeconfig-writer-image", "", "The container image containing our kubeconfig writer binary.")
shellImage = flag.String("shell-image", "", "The container image containing a shell")
gsutilImage = flag.String("gsutil-image", "", "The container image containing gsutil")
Expand All @@ -67,7 +66,6 @@ func main() {
EntrypointImage: *entrypointImage,
NopImage: *nopImage,
GitImage: *gitImage,
CredsImage: *credsImage,
KubeconfigWriterImage: *kubeconfigWriterImage,
ShellImage: *shellImage,
GsutilImage: *gsutilImage,
Expand Down
151 changes: 0 additions & 151 deletions cmd/creds-init/README.md

This file was deleted.

1 change: 0 additions & 1 deletion cmd/creds-init/kodata/HEAD

This file was deleted.

1 change: 0 additions & 1 deletion cmd/creds-init/kodata/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion cmd/creds-init/kodata/refs

This file was deleted.

1 change: 0 additions & 1 deletion cmd/creds-init/kodata/third_party

This file was deleted.

46 changes: 0 additions & 46 deletions cmd/creds-init/main.go

This file was deleted.

10 changes: 6 additions & 4 deletions cmd/entrypoint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func cp(src, dst string) error {
}

func main() {
// Add credential flags originally used in creds-init.
// Add credential flags originally introduced with our legacy credentials helper
// image (creds-init).
gitcreds.AddFlags(flag.CommandLine)
dockercreds.AddFlags(flag.CommandLine)

Expand All @@ -83,9 +84,10 @@ func main() {
return
}

// Copy creds-init credentials from secret volume mounts to /tekton/creds
// This is done to support the expansion of a variable, $(credentials.path), that
// resolves to a single place with all the stored credentials.
// Copy credentials we're expecting from the legacy credentials helper (creds-init)
// from secret volume mounts to /tekton/creds. This is done to support the expansion
// of a variable, $(credentials.path), that resolves to a single place with all the
// stored credentials.
builders := []credentials.Builder{dockercreds.NewBuilder(), gitcreds.NewBuilder()}
for _, c := range builders {
if err := c.Write("/tekton/creds"); err != nil {
Expand Down
1 change: 0 additions & 1 deletion config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ spec:
# These images are built on-demand by `ko resolve` and are replaced
# by image references by digest.
"-kubeconfig-writer-image", "ko://github.com/tektoncd/pipeline/cmd/kubeconfigwriter",
"-creds-image", "ko://github.com/tektoncd/pipeline/cmd/creds-init",
"-git-image", "ko://github.com/tektoncd/pipeline/cmd/git-init",
"-entrypoint-image", "ko://github.com/tektoncd/pipeline/cmd/entrypoint",
"-nop-image", "ko://github.com/tektoncd/pipeline/cmd/nop",
Expand Down
3 changes: 2 additions & 1 deletion examples/v1beta1/taskruns/authenticating-git-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# - Starts sshd and tails its log, waiting for the git commands to come in over SSH
#
# Two separate Steps then perform authenticated git actions against the sidecar
# git server using the credentials mounted by creds-init:
# git server using the credentials mounted by Tekton's credential helper
# (aka "creds-init"):

# The first step makes a git clone of the bare repository and populates it
# with a file.
Expand Down
2 changes: 1 addition & 1 deletion hack/nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ set -o nounset
set -o pipefail

export KO_DOCKER_REPO="gcr.io/tekton-nightly"
# Build the base image for creds-init and git images.
# Build the base image for git images.
docker build -t "${KO_DOCKER_REPO}/github.com/tektoncd/pipeline/base" -f images/Dockerfile images/
docker push "${KO_DOCKER_REPO}/github.com/tektoncd/pipeline/base"
3 changes: 0 additions & 3 deletions pkg/apis/pipeline/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ type Images struct {
NopImage string
// GitImage is the container image with Git that we use to implement the Git source step.
GitImage string
// CredsImage is the container image used to initialize credentials before the build runs.
CredsImage string
// KubeconfigWriterImage is the container image containing our kubeconfig writer binary.
KubeconfigWriterImage string
// ShellImage is the container image containing bash shell.
Expand All @@ -57,7 +55,6 @@ func (i Images) Validate() error {
{i.EntrypointImage, "entrypoint"},
{i.NopImage, "nop"},
{i.GitImage, "git"},
{i.CredsImage, "creds"},
{i.KubeconfigWriterImage, "kubeconfig-writer"},
{i.ShellImage, "shell"},
{i.GsutilImage, "gsutil"},
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/pipeline/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ func TestValidate(t *testing.T) {
EntrypointImage: "set",
NopImage: "set",
GitImage: "set",
CredsImage: "set",
KubeconfigWriterImage: "set",
ShellImage: "set",
GsutilImage: "set",
Expand All @@ -27,7 +26,6 @@ func TestValidate(t *testing.T) {
EntrypointImage: "set",
NopImage: "set",
GitImage: "", // unset!
CredsImage: "set",
KubeconfigWriterImage: "set",
ShellImage: "", // unset!
GsutilImage: "set",
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
DefaultResultPath = "/tekton/results"
// HomeDir is the HOME directory of PipelineResources
HomeDir = "/tekton/home"
// CredsDir is the directory where credentials are placed to meet the creds-init contract
// CredsDir is the directory where credentials are placed to meet the legacy credentials
// helpers image (aka "creds-init") contract
CredsDir = "/tekton/creds"
)
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1alpha1/task_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestTaskSpecValidate(t *testing.T) {
}}},
},
}, {
name: "valid creds-init path variable",
name: "valid legacy credential helper (creds-init) path variable",
fields: fields{
Steps: []v1alpha1.Step{{Container: corev1.Container{
Name: "mystep",
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1beta1/task_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestTaskSpecValidate(t *testing.T) {
}}},
},
}, {
name: "valid creds-init path variable",
name: "valid path variable for legacy credential helper (aka creds-init)",
fields: fields{
Steps: []v1beta1.Step{{Container: corev1.Container{
Name: "mystep",
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/resource/v1alpha1/storage/build_gcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var images = pipeline.Images{
EntrypointImage: "override-with-entrypoint:latest",
NopImage: "override-with-nop:latest",
GitImage: "override-with-git:latest",
CredsImage: "override-with-creds:latest",
KubeconfigWriterImage: "override-with-kubeconfig-writer:latest",
ShellImage: "busybox",
GsutilImage: "gcr.io/google.com/cloudsdktool/cloud-sdk",
Expand Down
1 change: 0 additions & 1 deletion pkg/artifacts/artifact_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var (
EntrypointImage: "override-with-entrypoint:latest",
NopImage: "override-with-nop:latest",
GitImage: "override-with-git:latest",
CredsImage: "override-with-creds:latest",
KubeconfigWriterImage: "override-with-kubeconfig-writer:latest",
ShellImage: "busybox",
GsutilImage: "gcr.io/google.com/cloudsdktool/cloud-sdk",
Expand Down
3 changes: 2 additions & 1 deletion pkg/credentials/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const (
credsFilePermissions = 0600
)

// CredsInitCredentials is the complete list of credentials that creds-init can write to /tekton/creds.
// CredsInitCredentials is the complete list of credentials that the legacy credentials
// helper (aka "creds-init") can write to /tekton/creds.
var CredsInitCredentials = []string{".docker", ".gitconfig", ".git-credentials", ".ssh"}

// VolumePath is the path where build secrets are written.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pod/creds_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestCredsInit(t *testing.T) {
}},
ctx: context.Background(),
}, {
desc: "disabling creds-init via feature-flag results in no args or volumes",
desc: "disabling legacy credential helper (creds-init) via feature-flag results in no args or volumes",
objs: []runtime.Object{
&corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{Name: serviceAccountName, Namespace: namespace},
Expand Down
6 changes: 3 additions & 3 deletions pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec
for i, s := range stepContainers {
// Mount /tekton/creds with a fresh volume for each Step. It needs to
// be world-writeable and empty so creds can be initialized in there. Cant
// guarantee what UID container runs with. If creds-init is disabled via
// feature flag then these can be nil since we don't want to mount the
// automatic credential volume.
// guarantee what UID container runs with. If legacy credential helper (creds-init)
// is disabled via feature flag then these can be nil since we don't want to mount
// the automatic credential volume.
v, vm := getCredsInitVolume(ctx)
if v != nil && vm != nil {
volumes = append(volumes, *v)
Expand Down
Loading