Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Try to bring kaniko implementation up-to-date with the latest lifecycle #19

Closed

Conversation

natalieparellano
Copy link

I can confirm that this builds, but not sure if it runs :)

Comment on lines -72 to -77
logrus.Debug("Check if DOCKER_FILE_NAME env is defined...")
b.DockerFileName = util.GetValFromEnVar(DOCKER_FILE_NAME_ENV_NAME)
if b.DockerFileName == "" {
b.DockerFileName = defaultDockerFileName
}
logrus.Debugf("DockerfileName is: %s", b.DockerFileName)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as this information will be supplied from /layers/config/metadata.toml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. So we have to review the README.md file to be sure that we do not support/use anymore a dockerfile but instead a TOML file containing the Dockerfile(s)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. As the "spec requirements" for the extender are still very much in flux I wonder if it makes sense to have another place where we could iterate on it more easily - I started a document here to try to start to formalize this. When it's a little more solidified we could put it in the repo, what do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(note that the code will still need to be updated further ...forthcoming... to reflect what's in the document, but I think this is closer to where we want to land WRT variable names, etc.)

Comment on lines -95 to -107
logrus.Debug("Checking if CNB_* env var have been declared ...")
b.CnbEnvVars = util.GetCNBEnvVar()
logrus.Debugf("CNB ENV var is: %s", b.CnbEnvVars)

// Convert the CNB ENV vars to Kaniko BuildArgs
for k, v := range b.CnbEnvVars {
logrus.Debugf("CNB env key: %s, value: %s", k, v)
arg := k + "=" + v
b.BuildArgs = append(b.BuildArgs, arg)
}

// setup the path to access the Dockerfile within the workspace dir
dockerFilePath := b.WorkspaceDir + "/" + b.DockerFileName
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README should also remove this section explaining how to pass parameters using TOML Dockerfiles and not ENV Vars ;-)

…s of the lifecycle

This change also loops over all Dockerfiles found in /layers/config/metadata.toml
Copy link
Contributor

@cmoulliard cmoulliard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. I have some questions and remarks ;-)

)

const (
homeDir = "/"
kanikoDir = "/kaniko"
cacheDir = "/cache"
cacheDir = "/layers/kaniko"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this path customizable using Lifecycle ? If yes, then we should define an ENV var and externalize it

Comment on lines -72 to -77
logrus.Debug("Check if DOCKER_FILE_NAME env is defined...")
b.DockerFileName = util.GetValFromEnVar(DOCKER_FILE_NAME_ENV_NAME)
if b.DockerFileName == "" {
b.DockerFileName = defaultDockerFileName
}
logrus.Debugf("DockerfileName is: %s", b.DockerFileName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. So we have to review the README.md file to be sure that we do not support/use anymore a dockerfile but instead a TOML file containing the Dockerfile(s)

Comment on lines -95 to -107
logrus.Debug("Checking if CNB_* env var have been declared ...")
b.CnbEnvVars = util.GetCNBEnvVar()
logrus.Debugf("CNB ENV var is: %s", b.CnbEnvVars)

// Convert the CNB ENV vars to Kaniko BuildArgs
for k, v := range b.CnbEnvVars {
logrus.Debugf("CNB env key: %s, value: %s", k, v)
arg := k + "=" + v
b.BuildArgs = append(b.BuildArgs, arg)
}

// setup the path to access the Dockerfile within the workspace dir
dockerFilePath := b.WorkspaceDir + "/" + b.DockerFileName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README should also remove this section explaining how to pass parameters using TOML Dockerfiles and not ENV Vars ;-)

err = reapChildProcesses()

logrus.Info("Finding base image to provide ...")
baseimage := os.Getenv("CNB_BASE_IMAGE")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it documented how to pass such ENV var part of the README ? Have you reviewed the Job.yaml definition to align it with your PR - https://github.com/redhat-buildpacks/poc/blob/main/helm/templates/job.yaml#L20-L49 ?

// Define opts
opts := b.Opts
opts.DockerfilePath = d.Path
opts.BuildArgs = toMultiArg(d.Args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So finally we will only parse the Build atgs and not the run args here as I see that you changed the model ?

@natalieparellano
Copy link
Author

The POC on buildpacks/lifecycle#802 has changed enough that this PR is no longer useful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants