-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2153 from pi-hole/development
Pi-hole FTL v6.0
- Loading branch information
Showing
400 changed files
with
150,869 additions
and
25,575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
{ | ||
"name": "FTL x86_64 Build Env", | ||
"image": "ghcr.io/pi-hole/ftl-build:x86_64", | ||
"extensions": [ | ||
"jetmartin.bats", | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cmake-tools", | ||
"eamodio.gitlens" | ||
], | ||
} | ||
"name": "FTL x86_64 Build Env", | ||
"image": "ghcr.io/pi-hole/ftl-build:nightly", | ||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"jetmartin.bats", | ||
"ms-vscode.cpptools-extension-pack", | ||
"eamodio.gitlens", | ||
"github.copilot", | ||
"ms-python.python" | ||
] | ||
} | ||
}, | ||
"mounts": [ | ||
"type=bind,source=${localEnv:HOME}/.ssh,target=/root/.ssh,readonly", | ||
"type=bind,source=/var/www/html/admin,target=/var/www/html/admin,readonly" | ||
] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
self.errors.append("Exception when GETing from FTL: " + str(e)) | ||
// sitten -> sittin (substitution of "i" for "e"), | ||
// sittin -> sitting (insertion of "g" at the end). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM ghcr.io/pi-hole/ftl-build:v2.11 AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
ARG CI_ARCH="linux/amd64" | ||
ENV CI_ARCH=${CI_ARCH} | ||
ARG GIT_BRANCH="test" | ||
ENV GIT_BRANCH=${GIT_BRANCH} | ||
ARG GIT_TAG="test" | ||
ENV GIT_TAG=${GIT_TAG} | ||
ARG BUILD_OPTS="" | ||
ENV BUILD_OPTS=${BUILD_OPTS} | ||
|
||
# Setting TERM is needed for pretty output in BATS tests | ||
ENV TERM=xterm | ||
|
||
# Monkeypatch BATS to remove duplicate output of starting and finished test | ||
# BATS uses ANSI escape codes to overwrite the line after the test has finished | ||
# This is not supported by Github Actions as it does not provide a TTY to the docker build container | ||
RUN sed -i '/buffer_with_truncation /d' /bats-core/libexec/bats-core/bats-format-pretty | ||
|
||
# Build FTL | ||
# Remove possible old build files | ||
RUN rm -rf cmake && \ | ||
# Build and test FTL | ||
bash build.sh "-DSTATIC=${STATIC}" test ${BUILD_OPTS} && \ | ||
# Move FTL binary to root directory | ||
cd / &&\ | ||
mv /app/pihole-FTL . && \ | ||
# Create tarball of API docs | ||
tar -C /app/src/api/docs/content/ -czvf /api-docs.tar.gz . | ||
|
||
# Create final image containing only the FTL binary and API docs | ||
FROM scratch AS result | ||
COPY --from=builder /pihole-FTL /pihole-FTL | ||
COPY --from=builder /api-docs.tar.gz /api-docs.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: Build and test | ||
description: Builds and tests FTL on all supported platforms | ||
|
||
inputs: | ||
platform: | ||
required: true | ||
description: The platform to build for | ||
build_opts: | ||
required: true | ||
description: Any extra build opts to use | ||
git_branch: | ||
required: true | ||
description: The branch to build from | ||
git_tag: | ||
required: true | ||
description: The tag to build from (if any) | ||
bin_name: | ||
required: true | ||
description: The name of the binary to build | ||
artifact_name: | ||
required: true | ||
description: The name of the artifact to upload | ||
event_name: | ||
required: true | ||
description: The name of the event that triggered the workflow run | ||
actor: | ||
required: true | ||
description: The name of the user or app that initiated the workflow run | ||
target_dir: | ||
required: true | ||
description: The directory to deploy the artifacts to | ||
# Secrets cannot be accessed in the action.yml file so we need to pass them as | ||
# inputs to the action. | ||
SSH_KEY: | ||
required: true | ||
description: The SSH private key to use for authentication | ||
KNOWN_HOSTS: | ||
required: true | ||
description: The SSH known hosts file | ||
SSH_USER: | ||
required: true | ||
description: The SSH user to use for authentication | ||
SSH_HOST: | ||
required: true | ||
description: The SSH host to connect to | ||
|
||
# Both the definition of environment variables and checking out the code | ||
# needs to be done outside of the composite action as | ||
# - environment variables cannot be defined using inputs | ||
# - the checkout action needs to be the first step in the workflow, otherwise we | ||
# cannot use the composite action as the corresponding "action.yml" isn't | ||
# there yet | ||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
- | ||
name: Print directory contents | ||
shell: bash | ||
run: ls -l | ||
- | ||
name: Build and test FTL in ftl-build container (QEMU) | ||
uses: Wandalen/[email protected] | ||
with: | ||
attempt_limit: 3 | ||
action: docker/[email protected] | ||
with: | | ||
platforms: ${{ inputs.platform }} | ||
pull: true | ||
push: false | ||
context: . | ||
target: result | ||
file: .github/Dockerfile | ||
outputs: | | ||
type=tar,dest=build.tar | ||
build-args: | | ||
"CI_ARCH=${{ inputs.platform }}" | ||
"GIT_BRANCH=${{ inputs.git_branch }}" | ||
"GIT_TAG=${{ inputs.git_tag }}" | ||
"BUILD_OPTS=${{ inputs.build_opts }}" | ||
- | ||
name: List files in current directory | ||
shell: bash | ||
run: ls -l | ||
- | ||
name: Extract FTL binary from container | ||
shell: bash | ||
run: | | ||
tar -xf build.tar pihole-FTL | ||
- | ||
name: "Generate checksum file" | ||
shell: bash | ||
run: | | ||
mv pihole-FTL "${{ inputs.bin_name }}" | ||
sha1sum pihole-FTL-* > ${{ inputs.bin_name }}.sha1 | ||
- | ||
name: Store binary artifacts for later deployoment | ||
if: inputs.event_name != 'pull_request' | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: '${{ inputs.bin_name }}*' | ||
- | ||
name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
# Skip attestation if ACTIONS_ID_TOKEN_REQUEST_URL env variable is not | ||
# available (e.g., PR originating from a fork) | ||
if: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }} | ||
with: | ||
subject-path: ${{ inputs.bin_name }} | ||
- | ||
name: Extract documentation files from container | ||
if: inputs.event_name != 'pull_request' && inputs.platform == 'linux/amd64' && inputs.build_opts == '' | ||
shell: bash | ||
run: | | ||
tar -xf build.tar api-docs.tar.gz | ||
- | ||
name: Upload documentation artifacts for deployoment | ||
if: inputs.event_name != 'pull_request' && inputs.platform == 'linux/amd64' && inputs.build_opts == '' | ||
uses: actions/[email protected] | ||
with: | ||
name: pihole-api-docs | ||
path: 'api-docs.tar.gz' | ||
- | ||
name: Deploy | ||
# Skip deployment step if: | ||
# - this is a triggered by a PR event (we only push on commit to branch | ||
# events) | ||
# - no SSH key is provided (this is a PR from a fork) | ||
if: inputs.event_name != 'pull_request' && inputs.SSH_KEY != '' | ||
uses: ./.github/actions/deploy | ||
with: | ||
pattern: ${{ inputs.bin_name }}-binary | ||
target_dir: ${{ inputs.target_dir }} | ||
event_name: ${{ inputs.event_name }} | ||
actor: ${{ inputs.actor }} | ||
SSH_KEY: ${{ inputs.SSH_KEY }} | ||
KNOWN_HOSTS: ${{ inputs.KNOWN_HOSTS }} | ||
SSH_USER: ${{ inputs.SSH_USER }} | ||
SSH_HOST: ${{ inputs.SSH_HOST }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Deploy | ||
description: Deploy the FTL binary and documentation | ||
|
||
inputs: | ||
pattern: | ||
required: true | ||
description: The pattern to match the artifacts to download | ||
target_dir: | ||
required: true | ||
description: The directory to deploy the artifacts to | ||
event_name: | ||
required: true | ||
description: The name of the event that triggered the workflow run | ||
actor: | ||
required: true | ||
description: The name of the user or app that initiated the workflow run | ||
# Secrets cannot be accessed in the action.yml file so we need to pass them as | ||
# inputs to the action. | ||
SSH_KEY: | ||
required: true | ||
description: The SSH private key to use for authentication | ||
KNOWN_HOSTS: | ||
required: true | ||
description: The SSH known hosts file | ||
SSH_USER: | ||
required: true | ||
description: The SSH user to use for authentication | ||
SSH_HOST: | ||
required: true | ||
description: The SSH host to connect to | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- | ||
name: Get binaries built in previous jobs | ||
uses: actions/[email protected] | ||
id: download | ||
with: | ||
path: ftl_builds/ | ||
pattern: ${{ inputs.pattern }} | ||
merge-multiple: true | ||
- | ||
name: Get documentation files built in previous jobs | ||
if: inputs.pattern == 'pihole-FTL-amd64-binary' | ||
uses: actions/[email protected] | ||
with: | ||
path: ftl_builds/ | ||
name: pihole-api-docs | ||
- | ||
name: Display structure of downloaded files | ||
shell: bash | ||
run: ls -R | ||
working-directory: ${{steps.download.outputs.download-path}} | ||
- | ||
name: Install SSH Key | ||
uses: benoitchantre/[email protected] | ||
with: | ||
private-key: ${{ inputs.SSH_KEY }} | ||
private-key-name: id_rsa | ||
known-hosts: ${{ inputs.KNOWN_HOSTS }} | ||
- | ||
name: Set private key permissions | ||
shell: bash | ||
run: chmod 600 ~/.ssh/id_rsa | ||
- | ||
name: Untar documentation files | ||
if: inputs.pattern == 'pihole-FTL-amd64-binary' | ||
working-directory: ftl_builds/ | ||
shell: bash | ||
run: | | ||
mkdir docs/ | ||
tar xzvf api-docs.tar.gz -C docs/ | ||
- | ||
name: Display structure of files ready for upload | ||
working-directory: ftl_builds/ | ||
shell: bash | ||
run: ls -R | ||
- | ||
name: Transfer Builds to Pi-hole server for pihole checkout | ||
if: inputs.actor != 'dependabot[bot]' | ||
env: | ||
USER: ${{ inputs.SSH_USER }} | ||
HOST: ${{ inputs.SSH_HOST }} | ||
TARGET_DIR: ${{ inputs.target_dir }} | ||
SOURCE_DIR: ftl_builds/ | ||
shell: bash | ||
run: | | ||
bash ./deploy.sh | ||
- | ||
name: Attach binaries to release | ||
if: inputs.event_name == 'release' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
ftl_builds/* |
Oops, something went wrong.