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

Gitlab CI token fails to cleanup #1

Open
Jack12816 opened this issue Sep 24, 2017 · 2 comments
Open

Gitlab CI token fails to cleanup #1

Jack12816 opened this issue Sep 24, 2017 · 2 comments
Assignees

Comments

@Jack12816
Copy link
Owner

Looks like the Gitlab CI token is not permitted to delete images.

$ plankton cleanup --keep 1 --no-confirm fancy/app

 Tags to keep: 1 (377.26 MiB)
Image tag                                Created at                Size      
6af2cdb9de85733d8169f84f68020e472bfed9d5 2017-09-24T20:13:44+00:00 377.26 MiB

 Tags to delete: 5 (1.64 GiB)
Image tag                                Created at                Size      
542f39e834da997f7c5a67123edb116e737729c2 2017-09-24T19:58:43+00:00 377.57 MiB
361ea2a2a69a701e406f912ea3d3923b07bf76bd 2017-09-24T19:35:30+00:00 377.56 MiB
fe6ea4720f41e1970641bc7d79f12ef640cdcdd6 2017-09-24T19:22:38+00:00 377.55 MiB
1f4c65c0b5025da0927fbee7bca09b67cf5c13b2 2017-09-24T16:36:00+00:00 273.27 MiB
e0e19e81f15d03775e1b01bdd1eb753a275d386e 2017-09-24T16:32:56+00:00 273.27 MiB

bundler: failed to load command: exe/plankton (exe/plankton)
DockerRegistry2::RegistryAuthenticationException: DockerRegistry2::RegistryAuthenticationException
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:179:in `rescue in do_bearer_req'
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:169:in `do_bearer_req'
  /app/lib/plankton/monkey_patches.rb:50:in `do_bearer_req'
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:141:in `rescue in doreq'
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:125:in `doreq'
  /app/lib/plankton/monkey_patches.rb:63:in `rescue in doreq'
  /app/lib/plankton/monkey_patches.rb:58:in `doreq'
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:24:in `dodelete'
  /usr/lib/ruby/gems/2.4.0/gems/docker_registry2-1.0.0/lib/registry/registry.rb:82:in `rmtag'
  /app/lib/plankton/monkey_patches.rb:130:in `rmtag'
  /app/lib/plankton/commands/cleanup.rb:47:in `block in cleanup'
  /app/lib/plankton/commands/cleanup.rb:46:in `each'
  /app/lib/plankton/commands/cleanup.rb:46:in `cleanup'
  /usr/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
  /usr/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
  /usr/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
  exe/plankton:70:in `<top (required)>'
The latest bundler is 1.16.0.pre.2, but you are currently running 1.15.0.
To update, run `gem install bundler --pre`
ERROR: Job failed: exit code 1
@Jack12816 Jack12816 self-assigned this Sep 24, 2017
@Jack12816
Copy link
Owner Author

@Jack12816
Copy link
Owner Author

Jack12816 commented Oct 3, 2017

Temporary workaround:

  • Create a new user (eg. project-ci) with a secure password
    • Set it external and add it to the project members as a master user
  • Add REGISTRY_CLI_USERNAME and REGISTRY_CLI_PASSWORD with the user credentials to the CI/CD secret variables of the project
  • Use the customized job defintion:
cleanup:
  image:
    name: jack12816/plankton
    entrypoint: ["/bin/sh", "-c"]
  stage: cleanup
  variables:
    REGISTRY_CLI_HOSTNAME: your.registry.tld
  script: plankton cleanup --keep 3 --no-confirm apps/fancy

Mind the missing user credential variables on the job definiton.

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

No branches or pull requests

1 participant