Jack12816 / plankton

A commandline interface to private Docker Registries
MIT License
3 stars 0 forks source link

Gitlab CI token fails to cleanup #1

Open Jack12816 opened 7 years ago

Jack12816 commented 7 years ago

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 commented 7 years ago

On it: https://gitlab.com/gitlab-org/gitlab-ee/issues/3526

Jack12816 commented 7 years ago

Temporary workaround:

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.