This commit is contained in:
@@ -1,62 +0,0 @@
|
|||||||
# Python CircleCI 2.0 configuration file
|
|
||||||
#
|
|
||||||
# Check https://circleci.com/docs/2.0/language-python/ for more details
|
|
||||||
#
|
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
# specify the version you desire here
|
|
||||||
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
|
|
||||||
- image: circleci/python:3.6.1
|
|
||||||
|
|
||||||
# Specify service dependencies here if necessary
|
|
||||||
# CircleCI maintains a library of pre-built images
|
|
||||||
# documented at https://circleci.com/docs/2.0/circleci-images/
|
|
||||||
# - image: circleci/postgres:9.4
|
|
||||||
|
|
||||||
working_directory: ~/repo
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
|
|
||||||
# Download and cache dependencies
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "requirements-ci.txt" }}
|
|
||||||
# fallback to using the latest cache if no exact match is found
|
|
||||||
- v1-dependencies-
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: install dependencies
|
|
||||||
command: |
|
|
||||||
python3 -m venv venv
|
|
||||||
. venv/bin/activate
|
|
||||||
pip install -r requirements-ci.txt
|
|
||||||
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- ./venv
|
|
||||||
key: v1-dependencies-{{ checksum "requirements-ci.txt" }}
|
|
||||||
|
|
||||||
# run tests!
|
|
||||||
# this example uses Django's built-in test-runner
|
|
||||||
# other common Python testing frameworks include pytest and nose
|
|
||||||
# https://pytest.org
|
|
||||||
# https://nose.readthedocs.io
|
|
||||||
- run:
|
|
||||||
name: run tests
|
|
||||||
command: |
|
|
||||||
. venv/bin/activate
|
|
||||||
coverage run --include=test.py,registry.py test.py
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: generate report
|
|
||||||
command: |
|
|
||||||
. venv/bin/activate
|
|
||||||
mkdir -p /tmp/coverage
|
|
||||||
coverage html -d /tmp/coverage
|
|
||||||
mv .coverage /tmp/coverage
|
|
||||||
|
|
||||||
- store_artifacts:
|
|
||||||
path: /tmp/coverage
|
|
||||||
38
.gitea/workflows/build.yaml
Normal file
38
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Build and Publish registry cleaner
|
||||||
|
run-name: ${{ gitea.actor }} is runs ci pipeline
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: unix:///var/run/docker.sock
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."docker.office.clintonambulance.com"]
|
||||||
|
- name: Log in to Docker Registry
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.office.clintonambulance.com
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: unix:///var/run/docker.sock
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: frontend/Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: linux/arm64
|
||||||
|
tags: |
|
||||||
|
docker.office.clintonambulance.com/registry-cli:${{ gitea.sha }}
|
||||||
|
docker.office.clintonambulance.com/registry-cli:latest
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:2.7-alpine
|
FROM python:alpine
|
||||||
|
|
||||||
ADD requirements-build.txt /
|
ADD requirements-build.txt /
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
######
|
######
|
||||||
# github repository: https://github.com/andrey-pohilko/registry-cli
|
# github repository: https://github.com/andrey-pohilko/registry-cli
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
import ast
|
import ast
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
import urllib3
|
||||||
|
from urllib3.exceptions import InsecureRequestWarning
|
||||||
import json
|
import json
|
||||||
import pprint
|
import pprint
|
||||||
import base64
|
import base64
|
||||||
@@ -148,7 +149,7 @@ def decode_base64(data):
|
|||||||
missing_padding = len(data) % 4
|
missing_padding = len(data) % 4
|
||||||
if missing_padding != 0:
|
if missing_padding != 0:
|
||||||
data += b'='* (4 - missing_padding)
|
data += b'='* (4 - missing_padding)
|
||||||
return base64.decodestring(data)
|
return base64.decodebytes(data.encode() if isinstance(data, str) else data)
|
||||||
|
|
||||||
|
|
||||||
def get_error_explanation(context, error_code):
|
def get_error_explanation(context, error_code):
|
||||||
@@ -753,7 +754,7 @@ def main_loop(args):
|
|||||||
keep_last_versions = int(args.num)
|
keep_last_versions = int(args.num)
|
||||||
|
|
||||||
if args.no_validate_ssl:
|
if args.no_validate_ssl:
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
if args.read_password:
|
if args.read_password:
|
||||||
if args.login is None:
|
if args.login is None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
certifi==2017.7.27.1
|
certifi>=2017.7.27.1
|
||||||
chardet==3.0.4
|
chardet>=3.0.4
|
||||||
idna>=2.5
|
idna>=2.5
|
||||||
python-dateutil==2.8.0
|
python-dateutil>=2.8.0
|
||||||
requests>=2.20.0
|
requests>=2.20.0
|
||||||
urllib3>=1.23
|
urllib3>=1.23
|
||||||
www-authenticate==0.9.2
|
www-authenticate>=0.9.2
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
mock
|
|
||||||
coverage
|
coverage
|
||||||
certifi
|
certifi
|
||||||
chardet
|
chardet
|
||||||
|
|||||||
2
test.py
2
test.py
@@ -7,7 +7,7 @@ from dateutil.tz import tzutc, tzoffset
|
|||||||
from registry import Registry, Requests, get_tags, parse_args, \
|
from registry import Registry, Requests, get_tags, parse_args, \
|
||||||
delete_tags, delete_tags_by_age, get_error_explanation, get_newer_tags, \
|
delete_tags, delete_tags_by_age, get_error_explanation, get_newer_tags, \
|
||||||
keep_images_like, main_loop, get_datetime_tags, get_ordered_tags
|
keep_images_like, main_loop, get_datetime_tags, get_ordered_tags
|
||||||
from mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user