Skip to content

Commit b3dd2bf

Browse files
committed
Merge remote-tracking branch 'pi-hole/development-v6'
Signed-off-by: alexis-opolka <[email protected]>
2 parents 523be0c + 80c8299 commit b3dd2bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+869
-2483
lines changed

.github/actions/login-repo/action.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Login to container registries
2+
description: Login to container registries Docker Hub and GitHub Container Registry
3+
4+
inputs:
5+
# Actions cannot access secrets so pass them in as inputs
6+
docker_username:
7+
required: true
8+
description: The username to use to login to Docker Hub
9+
docker_password:
10+
required: true
11+
description: The password to use to login to Docker Hub
12+
ghcr_username:
13+
required: true
14+
description: The username to use to login to GitHub Container Registry
15+
ghcr_password:
16+
required: true
17+
description: The password to use to login to GitHub Container Registry
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
-
23+
name: Login to Docker Hub
24+
uses: docker/login-action@v2
25+
with:
26+
registry: docker.io
27+
username: ${{ inputs.docker_username }}
28+
password: ${{ inputs.docker_password }}
29+
-
30+
name: Login to GitHub Container Registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ghcr.io
34+
username: ${{ inputs.ghcr_username }}
35+
password: ${{ inputs.ghcr_password }}
+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Build and Publish (development-v6)
2+
on:
3+
schedule:
4+
- cron: "0 5 * * *"
5+
push:
6+
branches:
7+
- development-v6
8+
9+
env:
10+
dockerhub: ${{ secrets.DOCKERHUB_NAMESPACE }}/pihole
11+
ghcr: ghcr.io/${{ github.repository_owner }}/pihole
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
platform: [linux/amd64, linux/386, linux/arm/v6, linux/arm/v7, linux/arm64]
20+
alpine_version: [3.19]
21+
include:
22+
- platform: linux/riscv64
23+
alpine_version: edge
24+
25+
steps:
26+
- name: Prepare name for digest up/download
27+
run: |
28+
platform=${{ matrix.platform }}
29+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
30+
31+
- name: Checkout Repo
32+
uses: actions/checkout@v4
33+
34+
- name: Docker meta
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
images: |
40+
${{ env.dockerhub }}
41+
${{ env.ghcr }}
42+
flavor: |
43+
latest=false
44+
tags: |
45+
development-v6
46+
47+
- name: Login to DockerHub and GitHub Container Registry
48+
uses: ./.github/actions/login-repo
49+
with:
50+
docker_username: ${{ secrets.DOCKERHUB_USER }}
51+
docker_password: ${{ secrets.DOCKERHUB_PASS }}
52+
ghcr_username: ${{ github.repository_owner }}
53+
ghcr_password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Set up QEMU
56+
uses: docker/setup-qemu-action@v3
57+
with:
58+
platforms: ${{ matrix.platform}}
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Build container and push by digest
64+
id: build
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: ./src/
68+
platforms: ${{ matrix.platform }}
69+
build-args: |
70+
PIHOLE_DOCKER_TAG=${{ steps.meta.outputs.version }}
71+
alpine_version=${{ matrix.alpine_version }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
outputs: |
74+
type=image,name=${{ env.dockerhub }},push-by-digest=true,name-canonical=true,push=true
75+
76+
- name: Export digests
77+
run: |
78+
mkdir -p /tmp/digests
79+
digest_docker="${{ steps.build.outputs.digest }}"
80+
touch "/tmp/digests/${digest_docker#sha256:}"
81+
82+
- name: Upload digest
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: digests-${{ env.PLATFORM_PAIR }}
86+
path: /tmp/digests/*
87+
if-no-files-found: error
88+
retention-days: 1
89+
90+
# Merge all the digests into a single file
91+
# If we would push immediately above, the individual runners would overwrite each other's images
92+
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
93+
merge-and-deploy:
94+
runs-on: ubuntu-latest
95+
needs:
96+
- build
97+
steps:
98+
- name: Checkout Repo
99+
uses: actions/checkout@v4
100+
101+
- name: Download digests
102+
uses: actions/download-artifact@v4
103+
with:
104+
path: /tmp/digests
105+
pattern: digests-*
106+
merge-multiple: true
107+
108+
- name: Set up Docker Buildx
109+
uses: docker/setup-buildx-action@v3
110+
111+
- name: Docker meta
112+
id: meta
113+
uses: docker/metadata-action@v5
114+
with:
115+
github-token: ${{ secrets.GITHUB_TOKEN }}
116+
images: |
117+
${{ env.dockerhub }}
118+
${{ env.ghcr }}
119+
flavor: |
120+
latest=false
121+
tags: |
122+
development-v6
123+
124+
- name: Login to DockerHub and GitHub Container Registry
125+
uses: ./.github/actions/login-repo
126+
with:
127+
docker_username: ${{ secrets.DOCKERHUB_USER }}
128+
docker_password: ${{ secrets.DOCKERHUB_PASS }}
129+
ghcr_username: ${{ github.repository_owner }}
130+
ghcr_password: ${{ secrets.GITHUB_TOKEN }}
131+
132+
- name: Create manifest list and push (DockerHub and GitHub Container Registry)
133+
working-directory: /tmp/digests
134+
run: |
135+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
136+
$(printf '${{ env.dockerhub }}@sha256:%s ' *)
137+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
138+
$(printf '${{ env.ghcr }}@sha256:%s ' *)
139+
140+
- name: Inspect images
141+
run: |
142+
docker buildx imagetools inspect ${{ env.dockerhub }}:${{ steps.meta.outputs.version }}
143+
docker buildx imagetools inspect ${{ env.ghcr }}:${{ steps.meta.outputs.version }}

.github/workflows/build-and-test.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build and Test (development-v6)
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
# Official docker images for docker are only available for amd64 and arm64
12+
# TODO: Look at: https://github.com/docker-library/official-images#architectures-other-than-amd64
13+
# Is testing on all platforms really necessary?
14+
platform: [linux/amd64, linux/arm64]
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
with:
22+
platforms: ${{ matrix.platform}}
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Run Tests
28+
run: |
29+
echo "Building image to test"
30+
PLATFORM=${{ matrix.platform}} ./build-and-test.sh

.github/workflows/merge-conflict.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Check if PRs are have merge conflicts
16-
uses: eps1lon/[email protected].1
16+
uses: eps1lon/[email protected].2
1717
with:
1818
dirtyLabel: "Merge Conflict"
1919
repoToken: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/test-and-build.yaml

-84
This file was deleted.

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github-actions.workflows.pinned.workflows": [
3+
".github/workflows/v6-alpine-play.yml"
4+
]
5+
}

0 commit comments

Comments
 (0)