GithubHelp home page GithubHelp logo

notionev / clean-harbor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fish2018/clean-harbor

0.0 0.0 0.0 13 KB

清理harbor镜像,只保留最新的n个。使用go和python各实现了一版

Python 50.24% Go 49.76%

clean-harbor's Introduction

clean-harbor

清理harbor镜像,只保留最新的n个。使用go和python各实现了一版,python版中有详尽注释及物理清理方法,golang版中不再赘述。

克隆代码

git clone https://github.com/fish2018/clean-harbor.git
# python版
cd clean-harbor/python/
# golang版
cd clean-harbor/golang/

python版使用方法:

修改配置

修改脚本harborgc.py,根据自己情况设置harbor地址、用户名、密码和要保留的最近的镜像数量

harbor_domain="harbor.test.com",
                        username="username",
                        password="password",
                        num=10)

安装依赖

pip install requests

执行程序

python3 harborgc.py

golang版使用方法

修改配置

修改config.yaml文件,根据自己情况设置harbor地址、用户名、密码和要保留的最近的镜像数量

num: 10 # 需要保留最新的tag数
harbor:
  url: "https://harbor.test.com"
  username: "username"
  password: "password"

编译二进制

export GOPROXY=https://goproxy.cn
go build

执行程序

./harbor-clean

clean-harbor's People

Contributors

fish2018 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.