From b5a83f0d348acb8e2177950d8544e9ea8ec014bb Mon Sep 17 00:00:00 2001 From: d-mcknight <47727384+d-mcknight@users.noreply.github.com> Date: Wed, 21 Jun 2023 20:11:36 -0700 Subject: [PATCH] Update automation --- .github/FUNDING.yml | 1 - .github/ISSUE_TEMPLATE/bug_report.md | 31 ----- .github/ISSUE_TEMPLATE/feature_request.md | 20 --- .../docker-multi-login-action/action.yml | 23 ---- .../action.yml | 46 ------- .github/workflows/docker.yaml | 116 ------------------ .github/workflows/docker.yml | 41 +++++++ .github/workflows/invalid_template.yml | 19 --- .github/workflows/support.yml | 25 ---- Dockerfile | 6 +- 10 files changed, 44 insertions(+), 284 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/actions/docker-multi-login-action/action.yml delete mode 100644 .github/actions/docker-target-image-list-action/action.yml delete mode 100644 .github/workflows/docker.yaml create mode 100644 .github/workflows/docker.yml delete mode 100644 .github/workflows/invalid_template.yml delete mode 100644 .github/workflows/support.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index b23a4f6..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -ko_fi: varken diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index a2b1f91..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG]" -labels: awaiting-triage -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. ... -2. ... -3. ... -4. ... - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Environment (please complete the following information):** - - OS: [e.g. Ubuntu 18.04.1 or Docker:Tag] - - Version [e.g. v1.1] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 6bdd151..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "[Feature Request]" -labels: awaiting-triage -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/actions/docker-multi-login-action/action.yml b/.github/actions/docker-multi-login-action/action.yml deleted file mode 100644 index aab3f20..0000000 --- a/.github/actions/docker-multi-login-action/action.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: 'Docker Multi Login Action' -description: 'Log in to dockerhub, quay, and github container registry' -runs: - using: "composite" - steps: - - shell: bash - run: | - echo "🔑 Logging into dockerhub..." - if docker login --username ${{ fromJSON(env.secrets).DOCKERHUB_USERNAME }} --password ${{ fromJSON(env.secrets).DOCKERHUB_PASSWORD }} > /dev/null 2>&1; then - echo "🎉 Login Succeeded!" - fi - - shell: bash - run: | - echo "🔑 Logging into quay.io..." - if docker login quay.io --username ${{ fromJSON(env.secrets).QUAY_USERNAME }} --password ${{ fromJSON(env.secrets).QUAY_PASSWORD }} > /dev/null 2>&1; then - echo "🎉 Login Succeeded!" - fi - - shell: bash - run: | - echo "🔑 Logging into ghcr.io..." - if docker login ghcr.io --username ${{ fromJSON(env.secrets).GHCR_USERNAME }} --password ${{ fromJSON(env.secrets).GHCR_PASSWORD }} > /dev/null 2>&1; then - echo "🎉 Login Succeeded!" - fi diff --git a/.github/actions/docker-target-image-list-action/action.yml b/.github/actions/docker-target-image-list-action/action.yml deleted file mode 100644 index dc08c89..0000000 --- a/.github/actions/docker-target-image-list-action/action.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: 'Docker Target Image List Generator' -description: 'A Github Action to generate a list of fully qualified target images for docker related steps' -inputs: - registries: - description: "Comma separated list of docker registries" - required: false - default: "docker.io,quay.io,ghcr.io" - images: - description: "Comma separated list of images" - required: true - tags: - description: "Comma separated list of image tags" - required: false - default: "edge" -outputs: - fully-qualified-target-images: - description: "List of fully qualified docker target images" - value: ${{ steps.gen-fqti.outputs.fully-qualified-target-images }} -runs: - using: "composite" - steps: - - name: Generate fully qualified docker target images - id: gen-fqti - shell: bash - run: | - IFS=',' read -r -a registries <<< "${{ inputs.registries }}" - IFS=',' read -r -a images <<< "${{ inputs.images }}" - IFS=',' read -r -a tags <<< "${{ inputs.tags }}" - FQTI="" - echo "Generating fully qualified docker target images for:" - echo "🐋 Registries: ${#registries[@]}" - echo "📷 Images: ${#images[@]}" - echo "🏷️ Tags: ${#tags[@]}" - echo "🧮 Total: $((${#registries[@]}*${#images[@]}*${#tags[@]}))" - for registry in "${registries[@]}"; do - for image in "${images[@]}"; do - for tag in "${tags[@]}"; do - if [ -z "$FQTI" ]; then - FQTI="${registry}/${image}:${tag}" - else - FQTI="$FQTI,${registry}/${image}:${tag}" - fi - done - done - done - echo ::set-output name=fully-qualified-target-images::${FQTI} diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index 8818fcb..0000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,116 +0,0 @@ -name: varken -on: - schedule: - - cron: '0 10 * * *' - push: - branches: - - master - - develop - tags: - - 'v*.*.*' - paths: - - '.github/workflows/docker.yaml' - - 'varken/**' - - 'Varken.py' - - 'Dockerfile' - pull_request: - branches: - - master - - develop - paths: - - '.github/workflows/docker.yaml' - - 'varken/**' - - 'Varken.py' - - 'Dockerfile' - workflow_dispatch: - inputs: - tag: - description: 'Use this tag instead of most recent' - required: false - ignore-existing-tag: - description: 'Ignore existing tag if "true"' - required: false -env: - IMAGES: boerderij/varken - PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" -jobs: - lint-and-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Lint - run: pip install flake8 && flake8 --max-line-length 120 Varken.py varken/*.py - build: - runs-on: ubuntu-latest - needs: lint-and-test - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Prepare - id: prep - run: | - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} - fi - if [ "${{ github.event_name }}" = "schedule" ]; then - VERSION=nightly - fi - if [[ ${GITHUB_REF##*/} == "develop" ]]; then - VERSION=develop - fi - TAGS="${VERSION}" - if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - TAGS="$TAGS,latest" - fi - echo ::set-output name=version::${VERSION} - echo ::set-output name=tags::${TAGS} - echo ::set-output name=branch::${GITHUB_REF##*/} - echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo ::set-output name=vcs_ref::${GITHUB_SHA::8} - - uses: ./.github/actions/docker-target-image-list-action - name: Generate Target Images - id: gen-tags - with: - images: ${{ env.IMAGES }} - tags: ${{ steps.prep.outputs.tags }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: ${{ env.PLATFORMS }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - with: - install: true - version: latest - driver-opts: image=moby/buildkit:master - - name: Docker Multi Login - uses: ./.github/actions/docker-multi-login-action - env: - secrets: ${{ toJSON(secrets) }} - - name: Build and Push - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - platforms: ${{ env.PLATFORMS }} - pull: true - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.gen-tags.outputs.fully-qualified-target-images }} - build-args: | - VERSION=${{ steps.prep.outputs.version }} - BRANCH=${{ steps.prep.outputs.branch }} - BUILD_DATE=${{ steps.prep.outputs.build_date }} - VCS_REF=${{ steps.prep.outputs.vcs_ref }} - - name: Inspect - if: ${{ github.event_name != 'pull_request' }} - run: | - IFS=',' read -r -a images <<< "${{ steps.gen-tags.outputs.fully-qualified-target-images }}" - for image in "${images[@]}"; do - docker buildx imagetools inspect ${image} - done diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c51db79 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,41 @@ +name: Publish Docker Containers +on: + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build_and_publish_docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for base Docker + id: base_meta + uses: docker/metadata-action@v2 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.base_meta.outputs.tags }} + labels: ${{ steps.base_meta.outputs.labels }} diff --git a/.github/workflows/invalid_template.yml b/.github/workflows/invalid_template.yml deleted file mode 100644 index 647cdec..0000000 --- a/.github/workflows/invalid_template.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Invalid Template' - -on: - issues: - types: [labeled, unlabeled, reopened] - -jobs: - support: - runs-on: ubuntu-latest - steps: - - uses: dessant/support-requests@v2 - with: - github-token: ${{ github.token }} - support-label: 'invalid:template-incomplete' - issue-comment: > - :wave: @{issue-author}, please edit your issue and follow the template provided. - close-issue: false - lock-issue: false - issue-lock-reason: 'resolved' diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml deleted file mode 100644 index df74c10..0000000 --- a/.github/workflows/support.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: 'Support Request' - -on: - issues: - types: [labeled, unlabeled, reopened] - -jobs: - support: - runs-on: ubuntu-latest - steps: - - uses: dessant/support-requests@v2 - with: - github-token: ${{ github.token }} - support-label: 'support' - issue-comment: > - :wave: @{issue-author}, we use the issue tracker exclusively - for bug reports and feature requests. However, this issue appears - to be a support request. Please use our support channels - to get help with Varken! - - - [Discord](https://discord.gg/VjZ6qSM) - - [Discord Quick Access](http://cyborg.decreator.dev/channels/518970285773422592/530424560504537105/) - close-issue: true - lock-issue: false - issue-lock-reason: 'off-topic' diff --git a/Dockerfile b/Dockerfile index c5c41fa..f19ca2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,11 @@ ENV DEBUG="True" \ LABEL maintainer="dirtycajunrice,samwiseg0" \ org.opencontainers.image.created=$BUILD_DATE \ - org.opencontainers.image.url="https://github.com/Boerderij/Varken" \ - org.opencontainers.image.source="https://github.com/Boerderij/Varken" \ + org.opencontainers.image.url="https://github.com/d-mcknight/Varken" \ + org.opencontainers.image.source="https://github.com/d-mcknight/Varken" \ org.opencontainers.image.version=$VERSION \ org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.vendor="boerderij" \ + org.opencontainers.image.vendor="d-mcknight" \ org.opencontainers.image.title="varken" \ org.opencontainers.image.description="Varken is a standalone application to aggregate data from the Plex ecosystem into InfluxDB using Grafana for a frontend" \ org.opencontainers.image.licenses="MIT"