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

Do not require username/password with no_push: true #25

Merged
merged 3 commits into from Sep 1, 2021
Merged

Do not require username/password with no_push: true #25

merged 3 commits into from Sep 1, 2021

Conversation

colinhoglund
Copy link
Contributor

@colinhoglund colinhoglund commented Aug 28, 2021

This updates all binaries and the plugin to skip authentication mechanisms when no_push: true. This allows pipelines to perform builds without requiring secrets, which can be useful during pull_request events, for example.

This was tested with the following public image

---
kind: pipeline
name: default

steps:
  - name: publish
    image: colinhoglund/kaniko-ecr
    settings:
      no_push: true

There is also a commit with a bit of linting.

@colinhoglund
Copy link
Contributor Author

Hey @shubham149, looking for feedback on this PR when you get a chance.

@shubham149
Copy link
Contributor

There is one concern. If the dockerfile itself uses a private base image, then docker build will fail.

@colinhoglund
Copy link
Contributor Author

colinhoglund commented Aug 31, 2021

There is one concern. If the dockerfile itself uses a private base image, then docker build will fail.

Thanks @shubham149, good point. I updated the conditionals slightly to always setup auth when credentials are defined.

This pipeline will skip auth mechanisms altogether:

---
kind: pipeline
name: no-push

steps:
  - name: publish
    image: colinhoglund/kaniko
    settings:
      no_push: true

  - name: publish-gcr
    image: colinhoglund/kaniko-gcr
    settings:
      no_push: true

  - name: publish-ecr
    image: colinhoglund/kaniko-ecr
    settings:
      no_push: true

This pipeline will setup auth, but still pass the --no-push flag:

---
kind: pipeline
name: no-push-with-auth

steps:
  - name: publish
    image: colinhoglund/kaniko
    settings:
      no_push: true
      username: something
      password: something

  - name: publish-gcr
    image: colinhoglund/kaniko-gcr
    settings:
      no_push: true
      json_key: something

  - name: publish-ecr
    image: colinhoglund/kaniko-ecr
    settings:
      no_push: true
      registry: public.ecr.aws/my-registry
      access_key: something
      secret_key: something

@shubham149 shubham149 merged commit 6b4393a into drone:main Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants