switch to ghcr, major updates to workflows

This commit is contained in:
Devin Buhl 2021-03-13 11:11:41 -05:00
parent 68c264e33c
commit a2f7ccd772
No known key found for this signature in database
GPG Key ID: 77149AC618D714D6
14 changed files with 302 additions and 71 deletions

26
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: kind:bug
assignees: ''
---
# Details
**What steps did you take and what happened:**
<!-- Note: This should be a clear and concise description of what the bug is. -->
**What did you expect to happen:**
<!-- Note: This should be a clear and concise description of what you expected to happen. -->
**Anything else you would like to add:**
<!-- Note: Miscellaneous information that will assist in solving the issue. -->
**Additional Information:**
<!-- Note: Anything to give further context to the bug report. -->

10
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,10 @@
---
blank_issues_enabled: false
contact_links:
- name: Discuss on GitHub
url: https://github.com/k8s-at-home/organization/discussions
about: Ask and answer questions here
- name: Discuss on Discord
url: https://discord.com/invite/sTMX7Vh
about: Join our Discord community

22
.github/ISSUE_TEMPLATE/enhancement.md vendored Normal file
View File

@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: kind:enhancement
assignees: ''
---
# Details
**Describe the solution you'd like:**
<!-- Note: A clear and concise description of what you want to happen. -->
**Anything else you would like to add:**
<!-- Note: Miscellaneous information that will assist in solving the issue. -->
**Additional Information:**
<!-- Note: Anything to give further context to the requested new feature. -->

15
.github/PAUL.yaml vendored Normal file
View File

@ -0,0 +1,15 @@
maintainers:
- onedr0p
labels: true
empty_description_check:
enabled: true
enforced: false
branch_destroyer:
enabled: true
protected_branches:
- master
pull_requests:
automated_merge: false
cats_enabled: true
dogs_enabled: true
allow_approval: true

32
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,32 @@
<!--
Before you open the request please review the following guidelines and tips to help it be more easily integrated:
- Describe the scope of your change - i.e. what the change does.
- Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.
Thank you for contributing! We will try to test and integrate the change as soon as we can. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated sometimes our priorities might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.
-->
**Description of the change**
<!-- Describe the scope of your change - i.e. what the change does. -->
**Benefits**
<!-- What benefits will be realized by the code change? -->
**Possible drawbacks**
<!-- Describe any known limitations with your change -->
**Applicable issues**
<!-- Enter any applicable Issues here (You can reference an issue using #) -->
- fixes #
**Additional information**
<!-- If there's anything else that's important and relevant to your pull request, mention that information here.-->

32
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 45
# Number of days of inactivity before a stale Issue or Pull Request is closed.
daysUntilClose: 5
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- on-hold
- pinned
# Label to use when marking as stale
staleLabel: stale
issues:
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This Issue has been automatically marked as "stale" because it has not had recent activity (for 45 days). It will be closed if no further activity occurs. Thanks for the feedback.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
pulls:
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 45 days). It will be closed if no further activity occurs. Thank you for your contribution.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30

64
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: ci
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
env:
REGISTRY_IMAGE: ghcr.io/onedr0p/exportarr
jobs:
build:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and Push (PR)
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v2
with:
context: .
file: ./build/package/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: false # GitHub secrets not available in PRs
tags: |
ghcr.io/${{ github.repository_owner }}/pull-request:${{github.event.number}}
- name: Build and Push (master branch)
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v2
with:
context: .
file: ./build/package/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:${GITHUB_REF##*/}

View File

@ -1,34 +0,0 @@
name: main
on:
push:
branches:
- master
tags:
- v*
jobs:
master:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Login to GitHub Docker Registry
run: echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Container Image
run: |
docker buildx build \
-t onedr0p/exportarr:${GITHUB_REF##*/} \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
-f ./build/package/Dockerfile \
--push .

50
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: release
on:
push:
tags:
- v*.*.*
env:
REGISTRY_IMAGE: ghcr.io/onedr0p/exportarr
jobs:
build:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and Push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v2
with:
context: .
file: ./build/package/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:latest
${{ env.REGISTRY_IMAGE }}:${GITHUB_REF##*/}

View File

@ -2,7 +2,6 @@
AIO Prometheus Exporter for Sonarr, Radarr or Lidarr(TBD)
[![Docker Pulls](https://img.shields.io/docker/pulls/onedr0p/exportarr)](https://hub.docker.com/r/onedr0p/exportarr)
[![Go Report Card](https://goreportcard.com/badge/github.com/onedr0p/exportarr)](https://goreportcard.com/report/github.com/onedr0p/exportarr)
This is Prometheus Exporter will export metrics gathered from Sonarr or Radarr. This only supports v3 APIs for Sonarr and Radarr. It will not gather metrics from all 3 at once, and instead you need to tell the exporter what metrics you want. Be sure to see the examples below for more information.
@ -15,13 +14,13 @@ See examples in the [examples/compose](./examples/compose/) directory
### Run with Kubernetes
See examples in the [examples/kubernetes](./examples/kubernetes/) directory, or use the [billimek-charts/sonarr](https://github.com/billimek/billimek-charts/tree/master/charts/sonarr) or [billimek-charts/radarr](https://github.com/billimek/billimek-charts/tree/master/charts/radarr) Helm charts.
See examples in the [examples/kubernetes](./examples/kubernetes/) directory.
### Run with Docker CLI
#### Sonarr
```bash
sudo docker run --name exportarr_sonarr \
docker run --name exportarr_sonarr \
--entrypoint "exportarr" \
-e port=9707 \
-e URL="http://192.168.1.1:8989" \
@ -29,7 +28,7 @@ sudo docker run --name exportarr_sonarr \
-e ENABLE_EPISODE_QUALITY_METRICS="false" \
--restart unless-stopped \
-p 9707:9707 \
-d onedr0p/exportarr:master sonarr
-d ghcr.io/onedr0p/exportarr:latest sonarr
```
Visit http://127.0.0.1:9707/metrics to see Sonarr metrics
@ -37,29 +36,29 @@ Visit http://127.0.0.1:9707/metrics to see Sonarr metrics
#### Radarr
```bash
sudo docker run --name exportarr_radarr \
docker run --name exportarr_radarr \
--entrypoint "exportarr" \
-e port=9708 \
-e URL="http://192.168.1.1:7878" \
-e APIKEY="amlmndfb503rfqaa5ln5hj5qkmu3hy18" \
-e APIKEY="zmlmndfb503rfqaa5ln5hj5qkmu3hy19" \
--restart unless-stopped \
-p 9708:9708 \
-d onedr0p/exportarr:master sonarr
-d ghcr.io/onedr0p/exportarr:latest sonarr
```
Visit http://127.0.0.1:9708/metrics to see Radarr metrics
### Run from the CLI
```cmd
```sh
./exportarr --help
./exportarr sonarr --help
./exportarr radarr --help
```
#### Sonarr
```cmd
```sh
./exportarr sonarr --help
./exportarr sonarr \
--port 9707 \
--url http://127.0.0.1:8989 \
@ -71,7 +70,9 @@ Visit http://127.0.0.1:9707/metrics to see Sonarr metrics
#### Radarr
```cmd
```sh
./exportarr radarr --help
./exportarr radarr \
--port 9708 \
--url http://127.0.0.1:7878 \

View File

@ -1,4 +1,4 @@
FROM golang:1.14-alpine as build
FROM golang:1.16-alpine as build
ENV GO111MODULE=on \
CGO_ENABLED=0
@ -7,19 +7,32 @@ WORKDIR /build
COPY . .
RUN apk --no-cache add ca-certificates \
&& export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) \
&& export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3); export GOARM=${GOARM:1} \
&& go mod download \
&& go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o exportarr /build/cmd/exportarr/. \
&& chmod +x exportarr
RUN \
export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) \
&& \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& \
GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3); export GOARM=${GOARM:1} \
&& \
go mod download \
&& \
go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o exportarr /build/cmd/exportarr/. \
&& \
chmod +x exportarr
FROM gcr.io/distroless/static:nonroot
FROM apline:3.13
ENV PORT="9707"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
RUN \
apk add --no-cache \
ca-certificates \
tzdata \
tini \
&& \
addgroup -S exportarr && adduser -S exportarr -G exportarr
COPY --from=build /build/exportarr /usr/local/bin/exportarr
USER nonroot:nonroot
ENTRYPOINT ["exportarr"]
USER exportarr:exportarr
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "exportarr" ]

View File

@ -2,9 +2,8 @@
version: "3.7"
services:
sonarr-exporter:
image: onedr0p/exportarr:master
entrypoint: ["exportarr"]
command: ["sonarr"]
image: ghcr.io/onedr0p/exportarr:latest
command: ["exportarr", "sonarr"]
environment:
PORT: 9707
URL: "http://192.168.1.100:8989"
@ -13,12 +12,11 @@ services:
ports:
- "9707:9707"
radarr-exporter:
image: onedr0p/exportarr:master
entrypoint: ["exportarr"]
command: ["radarr"]
image: ghcr.io/onedr0p/exportarr:latest
command: ["exportarr", "radarr"]
environment:
PORT: 9708
URL: "http://192.168.1.100:7878"
APIKEY: "amlmndfb503rfqaa5ln5hj5qkmu3hy18"
APIKEY: "zmlmndfb503rfqaa5ln5hj5qkmu3hy19"
ports:
- "9708:9708"

View File

@ -61,10 +61,11 @@ spec:
spec:
containers:
- name: radarr-exporter
image: onedr0p/exportarr:master
image: ghcr.io/onedr0p/exportarr:latest
imagePullPolicy: Always
command: ["exportarr"]
args: ["radarr"]
args:
- exportarr
- radarr
env:
- name: PORT
value: "9708"

View File

@ -65,10 +65,11 @@ spec:
spec:
containers:
- name: sonarr-exporter
image: onedr0p/exportarr:master
image: ghcr.io/onedr0p/exportarr:latest
imagePullPolicy: Always
command: ["exportarr"]
args: ["sonarr"]
args:
- exportarr
- sonarr
env:
- name: PORT
value: "9707"