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

Implement working kaniko build Task #62

Closed
bobcatfish opened this issue Sep 21, 2018 · 3 comments
Closed

Implement working kaniko build Task #62

bobcatfish opened this issue Sep 21, 2018 · 3 comments

Comments

@bobcatfish
Copy link
Collaborator

bobcatfish commented Sep 21, 2018

Expected Behavior

Once we have implemented a simple hellworld Task (#59) a user should be able to define a Task that can build and push an image to a registry using Kaniko. This would mean that:

  • Templating is in place that allows for the Task to use the image and registry values specified in the output image resource in the steps of the Task
  • The kaniko image can be used
  • Any required service account needed for pushing to the registry is available to the Task
  • The source to build from is available via the GitHub resource input (Implement the github Resource type #58)

Should include:

Actual Behavior

Once #59 is complete, it will be possible to run simple helloworld Task, but it won't be possible to use inputs or outputs.

Steps to Reproduce the Problem

  1. Deploy the Pipeline CRD + related CRDs to your cluster (note: should be docs on how to do this post kubebuilder)
  2. Create a Resource like this (where gcr.io/some-registry is a registry that you/your service account can push to):
apiVersion: pipeline.knative.dev/v1beta1
kind: Resource
metadata:
  name: kaniko-resources
  namespace: default
spec:
  resources:
    - name: guestbook
      type: git
      params:
      - name: url
        value: github.com/kubernetes/examples
      - name: revision
        value: HEAD      
      - name: serviceAccount
        value: githubServiceAccount
    - name: guestbook-image
      type: image
      params:
        - name: url
          value: gcr.io/some-registry
  1. Create a Task like this:
apiVersion: pipeline.knative.dev/v1beta1
kind: Task
metadata:
  name: build-push
  namespace: default
spec:
    inputs:
        resources:
        - name: workspace
          type: github
        params:
            - name: pathToDockerFile
              value: string
    outputs:
        resources:
        - name: imageToBuild
          type: image
    buildSpec:
      steps:
         - name: build-and-push
           image: gcr.io/kaniko-project/executor
      args:
         - --dockerfile=${DOCKERFILE}
         - --destination=${IMAGE}

(Or alternatively you can use the kaniko build template, but that would mean adding support for build templates:

    buildSpec:
        template:
            name: kaniko
            arguments:
                - name: DOCKERFILE
                  value: ${pathToDockerFile}
                - name: REGISTRY
                  value: ${registry}
  1. Create a TaskRun like this:
apiVersion: pipeline.knative.dev/v1beta1
kind: TaskRun
metadata:
  name: kaniko-run-0
spec:
    taskRef:
        name: build-push
    resourceRef:
       name: kaniko-resources
    trigger:
        triggerRef:
            type: manual
  1. Look at the logs from the running container (Note the best docs we have on this at the moment are some of the steps in the Build quick start) to see that the build and push was completed
  2. Observe that the status of the TaskRun has been updated appropriately, e.g. see this example which contains:
  • Outcomes of individual steps
  • Started, Completed, and Successful conditions
  1. Look at the image itself in the registry and verify that it was built and pushed

Additional Info

Blocked by #59 (helloworld task), #58 (GitHub resource)

@nader-ziada
Copy link
Member

is the plan to delegate the execution of buildSpec to the already existing knative build controller? or how are we thinking about executing the buildSpec part?

@bobcatfish
Copy link
Collaborator Author

is the plan to delegate the execution of buildSpec to the already existing knative build controller? or how are we thinking about executing the buildSpec part?

That's a great question: + @aaron-prindle @imjasonh if you have any thoughts

I'm not sure myself. What I don't want to do is duplicate what knative/build is already doing - if we wrap knative/build, I hope we will use the Build CRD and controller however possible, otherwise I hope we will import from knative/build as needed, which might mean refactoring knative/build a bit.

@imjasonh do you have any vision for how we can morph Build to Task? Or should we start adding Task features into Build right away and deal with renaming later?

@nader-ziada
Copy link
Member

/assign @pivotal-nader-ziada

@bobcatfish bobcatfish moved this from Blocked to In progress in Pipeline CRD Oct 4, 2018
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 9, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 10, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 11, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 11, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
nader-ziada added a commit to nader-ziada/pipeline that referenced this issue Oct 11, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
Pipeline CRD automation moved this from In progress to Done Oct 12, 2018
knative-prow-robot pushed a commit that referenced this issue Oct 12, 2018
 - Change the CRD of PipelineResource to make the kind with the same
 name, the word resource makes the cluster roles rbac not work
 - add resource Lister in taskrun controller
 - move tracking of build after its created,
 - update build obejct with input git resources
 - add PipelineResource to webhook validation
 - add integration test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Pipeline CRD
  
Done
Development

No branches or pull requests

2 participants