From bef460dc75d77044f46ecc1746855a762c0ce1c1 Mon Sep 17 00:00:00 2001 From: Jun Lin Chen Date: Wed, 9 Nov 2022 23:13:36 -0500 Subject: [PATCH] fix: CICD pipeline --- .github/.helper/.dockerignore | 2 -- .github/.helper/.gitignore | 2 -- .github/.helper/Dockerfile | 13 ------------- .github/.helper/app.py | 20 -------------------- .github/.helper/requirements.txt | 1 - .github/workflows/debian-package.yml | 3 +-- Makefile | 9 ++++++--- demo/deb-package/Dockerfile | 2 +- 8 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 .github/.helper/.dockerignore delete mode 100644 .github/.helper/.gitignore delete mode 100644 .github/.helper/Dockerfile delete mode 100644 .github/.helper/app.py delete mode 100644 .github/.helper/requirements.txt diff --git a/.github/.helper/.dockerignore b/.github/.helper/.dockerignore deleted file mode 100644 index 0e5ac79..0000000 --- a/.github/.helper/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.venv -__pycache__ \ No newline at end of file diff --git a/.github/.helper/.gitignore b/.github/.helper/.gitignore deleted file mode 100644 index 0e5ac79..0000000 --- a/.github/.helper/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.venv -__pycache__ \ No newline at end of file diff --git a/.github/.helper/Dockerfile b/.github/.helper/Dockerfile deleted file mode 100644 index 5de7afa..0000000 --- a/.github/.helper/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM python:3.8-slim-buster - -WORKDIR /app - -COPY requirements.txt requirements.txt -RUN pip3 install -r requirements.txt - -COPY . . - -VOLUME /app/upload -EXPOSE 8080 - -CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0", "--port=8080"] \ No newline at end of file diff --git a/.github/.helper/app.py b/.github/.helper/app.py deleted file mode 100644 index 9be6475..0000000 --- a/.github/.helper/app.py +++ /dev/null @@ -1,20 +0,0 @@ -import os -from flask import Flask, request - -os.makedirs('./upload', exist_ok=True) - -app = Flask(__name__) - -@app.route('/', methods=['GET', 'POST']) -def index(): - if request.method == 'POST': - print("received") - print(request.files) - for _, data in request.files.items(): - print('filename:', data.filename) - if data.filename: - data.save(os.path.join('./upload', data.filename)) - return "OK!" - -if __name__ == '__main__': - app.run(host='0.0.0.0', port=8080) \ No newline at end of file diff --git a/.github/.helper/requirements.txt b/.github/.helper/requirements.txt deleted file mode 100644 index 83f2939..0000000 --- a/.github/.helper/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Flask==2.1.3 diff --git a/.github/workflows/debian-package.yml b/.github/workflows/debian-package.yml index dc34211..20da994 100644 --- a/.github/workflows/debian-package.yml +++ b/.github/workflows/debian-package.yml @@ -21,8 +21,7 @@ jobs: curl -fsSL https://get.docker.com -o /tmp/get-docker.sh sh /tmp/get-docker.sh docker run --privileged --rm tonistiigi/binfmt --install all - docker build -t helper:latest -f ./.github/.helper/Dockerfile ./.github/.helper/ - docker run -d --hostname helper --expose 8080 --name helper -v "$(pwd)"/sandbox:/app/upload:rw helper:latest + docker run -d --hostname helper --expose 8080 --name helper -v "$(pwd)"/sandbox:/app/upload:rw harbor.yuri.moe/public/helper:latest export UPLOAD_URL=http://`docker inspect helper | grep "IPAddress" | grep -o -E '[0-9.]+' | head -n 1`:8080/ make docker-buildx-multi-arch - name: Release diff --git a/Makefile b/Makefile index 6429adb..286d05f 100644 --- a/Makefile +++ b/Makefile @@ -131,17 +131,17 @@ create-deb-package.arm64: change-version-number set-production build-starlight-d .PHONY: upload-deb-package.amd64 upload-deb-package.amd64: curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb' $(UPLOAD_URL) - curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter + #curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_amd64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter .PHONY: upload-deb-package.armv6l upload-deb-package.armv6l: curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb' $(UPLOAD_URL) - curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb' https://repo.yuri.moe/api/files/starlight-snapshotter + #curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_armhf.deb' https://repo.yuri.moe/api/files/starlight-snapshotter .PHONY: upload-deb-package.amd64 upload-deb-package.arm64: curl --form uploadfile='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb' $(UPLOAD_URL) - curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter + #curl -X POST -u $(APT_UPLOAD_AUTH) -F starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb='@./sandbox/starlight-snapshotter_$(VERSIONNUMBER)_arm64.deb' https://repo.yuri.moe/api/files/starlight-snapshotter ###################################################################### .PHONY: docker-buildx-multi-arch @@ -151,18 +151,21 @@ docker-buildx-multi-arch: --build-arg ARCH=amd64 \ --build-arg UPLOAD_URL=$(UPLOAD_URL) \ --build-arg APT_UPLOAD_AUTH=$(APT_UPLOAD_AUTH) \ + --network=host \ -f ./demo/deb-package/Dockerfile . docker buildx build \ --platform linux/arm/v7 \ --build-arg ARCH=armv6l \ --build-arg UPLOAD_URL=$(UPLOAD_URL) \ --build-arg APT_UPLOAD_AUTH=$(APT_UPLOAD_AUTH) \ + --network=host \ -f ./demo/deb-package/Dockerfile . docker buildx build \ --platform linux/arm64/v8 \ --build-arg ARCH=arm64 \ --build-arg UPLOAD_URL=$(UPLOAD_URL) \ --build-arg APT_UPLOAD_AUTH=$(APT_UPLOAD_AUTH) \ + --network=host \ -f ./demo/deb-package/Dockerfile . ###################################################################### diff --git a/demo/deb-package/Dockerfile b/demo/deb-package/Dockerfile index 61787e2..0040153 100644 --- a/demo/deb-package/Dockerfile +++ b/demo/deb-package/Dockerfile @@ -15,7 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Etc/UTC RUN apt update -y && apt upgrade -y -RUN apt install -y tzdata curl wget git dpkg-dev gpg build-essential debhelper +RUN apt install -y tzdata curl wget git dpkg-dev gpg build-essential debhelper bind9-utils RUN wget -q https://go.dev/dl/go1.18.4.linux-$ARCH.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.4.linux-$ARCH.tar.gz COPY . . RUN ARCH=$ARCH && make create-deb-package.$ARCH upload-deb-package.$ARCH