diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5cfeb9e5..e6fa9b9e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,135 +1,135 @@ -'name': 'build' +"name": "build" # Permissions are disabled for all the jobs by default, and then overridden for # specific jobs if needed. This is a recommended practice for security reasons, # and also allows to avoid mistakes with permissions when creating new jobs. # # See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. -'permissions': {} -'env': - 'GO_VERSION': '1.26.2' - 'NODE_VERSION': '20' -'on': - 'push': - 'branches': - - '*' - 'tags': - - 'v*' - 'pull_request': -'jobs': - 'test': - 'runs-on': '${{ matrix.os }}' - 'permissions': - 'contents': 'read' - 'env': - 'GO111MODULE': 'on' - 'GOPROXY': 'https://goproxy.cn' - 'strategy': - 'fail-fast': false - 'matrix': - 'os': - - 'ubuntu-latest' - - 'macOS-latest' - - 'windows-latest' - 'steps': - - 'name': 'Checkout' - 'uses': 'actions/checkout@v2' - 'with': - 'fetch-depth': 0 +"permissions": {} +"env": + "GO_VERSION": "1.26.4" + "NODE_VERSION": "20" +"on": + "push": + "branches": + - "*" + "tags": + - "v*" + "pull_request": +"jobs": + "test": + "runs-on": "${{ matrix.os }}" + "permissions": + "contents": "read" + "env": + "GO111MODULE": "on" + "GOPROXY": "https://goproxy.cn" + "strategy": + "fail-fast": false + "matrix": + "os": + - "ubuntu-latest" + - "macOS-latest" + - "windows-latest" + "steps": + - "name": "Checkout" + "uses": "actions/checkout@v2" + "with": + "fetch-depth": 0 # Set to false to avoid GITHUB_TOKEN leaking. # # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Set up Go' - 'uses': 'actions/setup-go@v3' - 'with': - 'go-version': '${{ env.GO_VERSION }}' - - 'name': 'Set up Node' - 'uses': 'actions/setup-node@v1' - 'with': - 'node-version': '${{ env.NODE_VERSION }}' - - 'name': 'Set up Go modules cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '~/go/pkg/mod' - 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" - 'restore-keys': '${{ runner.os }}-go-' - - 'name': 'Get npm cache directory' - 'id': 'npm-cache' - 'run': 'echo "::set-output name=dir::$( npm config get cache )"' - - 'name': 'Set up npm cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '${{ steps.npm-cache.outputs.dir }}' - 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" - 'restore-keys': '${{ runner.os }}-node-' - - 'name': 'Run tests' - 'shell': 'bash' - 'run': 'make VERBOSE=1 deps test go-bench go-fuzz' - - 'name': 'Upload coverage' - 'uses': 'codecov/codecov-action@v1' - 'if': "success() && matrix.os == 'ubuntu-latest'" - 'with': - 'token': '${{ secrets.CODECOV_TOKEN }}' - 'file': './coverage.txt' - 'build-release': - 'runs-on': 'ubuntu-latest' - 'needs': 'test' - 'permissions': - 'contents': 'read' - 'steps': - - 'name': 'Checkout' - 'uses': 'actions/checkout@v2' - 'with': - 'fetch-depth': 0 + "persist-credentials": false + - "name": "Set up Go" + "uses": "actions/setup-go@v3" + "with": + "go-version": "${{ env.GO_VERSION }}" + - "name": "Set up Node" + "uses": "actions/setup-node@v1" + "with": + "node-version": "${{ env.NODE_VERSION }}" + - "name": "Set up Go modules cache" + "uses": "actions/cache@v4" + "with": + "path": "~/go/pkg/mod" + "key": "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" + "restore-keys": "${{ runner.os }}-go-" + - "name": "Get npm cache directory" + "id": "npm-cache" + "run": 'echo "::set-output name=dir::$( npm config get cache )"' + - "name": "Set up npm cache" + "uses": "actions/cache@v4" + "with": + "path": "${{ steps.npm-cache.outputs.dir }}" + "key": "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" + "restore-keys": "${{ runner.os }}-node-" + - "name": "Run tests" + "shell": "bash" + "run": "make VERBOSE=1 deps test go-bench go-fuzz" + - "name": "Upload coverage" + "uses": "codecov/codecov-action@v1" + "if": "success() && matrix.os == 'ubuntu-latest'" + "with": + "token": "${{ secrets.CODECOV_TOKEN }}" + "file": "./coverage.txt" + "build-release": + "runs-on": "ubuntu-latest" + "needs": "test" + "permissions": + "contents": "read" + "steps": + - "name": "Checkout" + "uses": "actions/checkout@v2" + "with": + "fetch-depth": 0 # Set to false to avoid GITHUB_TOKEN leaking. # # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Set up Go' - 'uses': 'actions/setup-go@v3' - 'with': - 'go-version': '${{ env.GO_VERSION }}' - - 'name': 'Set up Node' - 'uses': 'actions/setup-node@v1' - 'with': - 'node-version': '${{ env.NODE_VERSION }}' - - 'name': 'Set up Go modules cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '~/go/pkg/mod' - 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" - 'restore-keys': '${{ runner.os }}-go-' - - 'name': 'Get npm cache directory' - 'id': 'npm-cache' - 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - - 'name': 'Set up npm cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '${{ steps.npm-cache.outputs.dir }}' - 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" - 'restore-keys': '${{ runner.os }}-node-' - - 'name': 'Set up Snapcraft' - 'run': 'sudo snap install snapcraft --classic' - - 'name': 'Set up QEMU' - 'uses': 'docker/setup-qemu-action@v3' - - 'name': 'Set up Docker Buildx' - 'uses': 'docker/setup-buildx-action@v3' - 'with': - 'install': true - - 'name': 'Run snapshot build' + "persist-credentials": false + - "name": "Set up Go" + "uses": "actions/setup-go@v3" + "with": + "go-version": "${{ env.GO_VERSION }}" + - "name": "Set up Node" + "uses": "actions/setup-node@v1" + "with": + "node-version": "${{ env.NODE_VERSION }}" + - "name": "Set up Go modules cache" + "uses": "actions/cache@v4" + "with": + "path": "~/go/pkg/mod" + "key": "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" + "restore-keys": "${{ runner.os }}-go-" + - "name": "Get npm cache directory" + "id": "npm-cache" + "run": 'echo "::set-output name=dir::$(npm config get cache)"' + - "name": "Set up npm cache" + "uses": "actions/cache@v4" + "with": + "path": "${{ steps.npm-cache.outputs.dir }}" + "key": "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" + "restore-keys": "${{ runner.os }}-node-" + - "name": "Set up Snapcraft" + "run": "sudo snap install snapcraft --classic" + - "name": "Set up QEMU" + "uses": "docker/setup-qemu-action@v3" + - "name": "Set up Docker Buildx" + "uses": "docker/setup-buildx-action@v3" + "with": + "install": true + - "name": "Run snapshot build" # Set a custom version string, since the checkout@v2 action does not seem # to know about the master branch, while the version script uses it to # count the number of commits within the branch. - 'run': 'make SIGN=0 VERBOSE=1 VERSION="v0.0.0-github" build-release build-docker' - 'notify': - 'needs': - - 'build-release' + "run": 'make SIGN=0 VERBOSE=1 VERSION="v0.0.0-github" build-release build-docker' + "notify": + "needs": + - "build-release" # Secrets are not passed to workflows that are triggered by a pull request # from a fork. # # Use always() to signal to the runner that this job must run even if the # previous ones failed. - 'if': | + "if": | ${{ always() && github.repository_owner == 'AdguardTeam' && @@ -138,19 +138,19 @@ github.event.pull_request.head.repo.full_name == github.repository ) }} - 'runs-on': 'ubuntu-latest' - 'permissions': + "runs-on": "ubuntu-latest" + "permissions": # Required by workflow-conclusion-action to check workflow status. - 'actions': 'read' - 'contents': 'read' - 'steps': - - 'name': 'Conclusion' - 'uses': 'technote-space/workflow-conclusion-action@v1' - - 'name': 'Send Slack notif' - 'uses': '8398a7/action-slack@v3' - 'with': - 'status': '${{ env.WORKFLOW_CONCLUSION }}' - 'fields': 'repo, message, commit, author, workflow' - 'env': - 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' - 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' + "actions": "read" + "contents": "read" + "steps": + - "name": "Conclusion" + "uses": "technote-space/workflow-conclusion-action@v1" + - "name": "Send Slack notif" + "uses": "8398a7/action-slack@v3" + "with": + "status": "${{ env.WORKFLOW_CONCLUSION }}" + "fields": "repo, message, commit, author, workflow" + "env": + "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}" + "SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7353f08e1..a6c93fb04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,35 @@ See also the [v0.107.78 GitHub milestone][ms-v0.107.78]. NOTE: Add new changes BELOW THIS COMMENT. --> +### Added + +- Improved updater logging to give users more insight into the problem with version updating ([#8410]). + +[#8410]: https://github.com/AdguardTeam/AdGuardHome/issues/8410 + +### Security + +- Go version has been updated to prevent the possibility of exploiting the Go vulnerabilities fixed in [1.26.4][go-1.26.4]. + +- The H2C connection establishment via HTTP/1.1 request upgrade is no longer supported. See [RFC 9113][rfc9113]. + +- The size of rulelists is limited. This is necessary to prevent a user's machine from becoming overloaded if the filter source misbehaves. + +### Changed + +- The interval of filter updates can now be set to any number of ours between 0 and 365 days in the configuration file. + +#### Configuration changes + +- The `filtering` object of the YAML configuration now includes a new property, `max_http_size`, which defines the maximum size of the HTTP request for rulelists. To disable the limitation, set a large size, such as `1 TB`. + ### Fixed - Blocked services check on the Custom filtering rules page does not work properly without specifying of a client. +[rfc9113]: https://datatracker.ietf.org/doc/html/rfc9113 +[go-1.26.4]: https://groups.google.com/g/golang-announce/c/tKs3rmcBcKw + diff --git a/Makefile b/Makefile index 4abd0ff0b..da06918a7 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ DIST_DIR = dist GOAMD64 = v1 GOPROXY = https://proxy.golang.org|direct GOTELEMETRY = off -GOTOOLCHAIN = go1.26.3 +GOTOOLCHAIN = go1.26.4 GPG_KEY = devteam@adguard.com GPG_KEY_PASSPHRASE = not-a-real-password NPM = npm diff --git a/bamboo-specs/release.yaml b/bamboo-specs/release.yaml index 948900d53..3aab6b4ba 100644 --- a/bamboo-specs/release.yaml +++ b/bamboo-specs/release.yaml @@ -1,299 +1,298 @@ --- -'version': 2 -'plan': - 'project-key': 'AGH' - 'key': 'AGHBSNAPSPECS' - 'name': 'AdGuard Home - Build and publish release' +"version": 2 +"plan": + "project-key": "AGH" + "key": "AGHBSNAPSPECS" + "name": "AdGuard Home - Build and publish release" # Make sure to sync any changes with the branch overrides below. -'variables': - # This variable is used to override Docker caching, for example to rerun a - # flaky test suite. - 'cacheBuster': '0' - 'channel': 'edge' - 'dockerFrontend': 'adguard/home-js-builder:4.0' - 'dockerGo': 'adguard/go-builder:1.26.2--1' +"variables": + # This variable is used to override Docker caching, for example to rerun a + # flaky test suite. + "cacheBuster": "0" + "channel": "edge" + "dockerFrontend": "adguard/home-js-builder:4.0" + "dockerGo": "adguard/go-builder:1.26.4--1" -'stages': - - 'Build frontend': - 'manual': false - 'final': false - 'jobs': - - 'Build frontend' +"stages": + - "Build frontend": + "manual": false + "final": false + "jobs": + - "Build frontend" - - 'Make release': - 'manual': false - 'final': false - 'jobs': - - 'Make release' + - "Make release": + "manual": false + "final": false + "jobs": + - "Make release" - - 'Make and publish docker': - 'manual': false - 'final': false - 'jobs': - - 'Make and publish docker' + - "Make and publish docker": + "manual": false + "final": false + "jobs": + - "Make and publish docker" - - 'Publish to static storage': - 'manual': false - 'final': false - 'jobs': - - 'Publish to static storage' + - "Publish to static storage": + "manual": false + "final": false + "jobs": + - "Publish to static storage" - - 'Publish to GitHub Releases': - 'manual': false - 'final': false - 'jobs': - - 'Publish to GitHub Releases' + - "Publish to GitHub Releases": + "manual": false + "final": false + "jobs": + - "Publish to GitHub Releases" -'Build frontend': - 'artifacts': - - 'name': 'AdGuardHome frontend' - 'pattern': 'build/**' - 'shared': true - 'required': true - 'key': 'BF' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - |- - #!/bin/sh +"Build frontend": + "artifacts": + - "name": "AdGuardHome frontend" + "pattern": "build/**" + "shared": true + "required": true + "key": "BF" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - |- + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --output '.' \ - --progress 'plain' \ - --target 'builder-exporter' \ - -f ./docker/frontend.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --output '.' \ + --progress 'plain' \ + --target 'builder-exporter' \ + -f ./docker/frontend.Dockerfile \ + . -'Make release': - 'artifact-subscriptions': - - 'artifact': 'AdGuardHome frontend' - # TODO(a.garipov): Use more fine-grained artifact rules. - 'artifacts': - - 'name': 'AdGuardHome dists' - 'pattern': 'dist/**' - 'shared': true - 'required': true - 'key': 'MR' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'checkout': - 'repository': 'bamboo-deploy-publisher' - # The paths are always relative to the working directory. - 'path': 'bamboo-deploy-publisher' - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Make release": + "artifact-subscriptions": + - "artifact": "AdGuardHome frontend" + # TODO(a.garipov): Use more fine-grained artifact rules. + "artifacts": + - "name": "AdGuardHome dists" + "pattern": "dist/**" + "shared": true + "required": true + "key": "MR" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "checkout": + "repository": "bamboo-deploy-publisher" + # The paths are always relative to the working directory. + "path": "bamboo-deploy-publisher" + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - # Explicitly checkout the revision that we need. - git checkout "${bamboo.repository.revision.number}" + # Explicitly checkout the revision that we need. + git checkout "${bamboo.repository.revision.number}" - version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)" - readonly version + version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)" + readonly version - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ - --build-arg "BRANCH=${bamboo_planRepository_branchName}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --build-arg "CHANNEL=${bamboo_channel}" \ - --build-arg "DEPLOY_SCRIPT_PATH=./bamboo-deploy-publisher/deploy.sh" \ - --build-arg "GPG_SECRET_KEY=${bamboo_gpgSecretKeyPart1}${bamboo_gpgSecretKeyPart2}" \ - --build-arg "GPG_KEY_PASSPHRASE=${bamboo_gpgPassword}" \ - --build-arg "REVISION=${bamboo_repository_revision_number}" \ - --build-arg "SIGN=1" \ - --build-arg "SIGNER_API_KEY=${bamboo_adguardHomeWinSignerSecretApiKey}" \ - --build-arg "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" \ - --build-arg "VERSION=$version" \ - --output '.' \ - --progress 'plain' \ - --target 'builder-exporter' \ - -f ./docker/ci.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ + --build-arg "BRANCH=${bamboo_planRepository_branchName}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --build-arg "CHANNEL=${bamboo_channel}" \ + --build-arg "DEPLOY_SCRIPT_PATH=./bamboo-deploy-publisher/deploy.sh" \ + --build-arg "GPG_SECRET_KEY=${bamboo_gpgSecretKeyPart1}${bamboo_gpgSecretKeyPart2}" \ + --build-arg "GPG_KEY_PASSPHRASE=${bamboo_gpgPassword}" \ + --build-arg "REVISION=${bamboo_repository_revision_number}" \ + --build-arg "SIGN=1" \ + --build-arg "SIGNER_API_KEY=${bamboo_adguardHomeWinSignerSecretApiKey}" \ + --build-arg "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" \ + --build-arg "VERSION=$version" \ + --output '.' \ + --progress 'plain' \ + --target 'builder-exporter' \ + -f ./docker/ci.Dockerfile \ + . -'Make and publish docker': - 'key': 'MPD' - 'other': - 'clean-working-dir': true - 'final-tasks': - - 'clean' - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'environment': - DOCKER_CLI_EXPERIMENTAL=enabled - 'scripts': - - | - #!/bin/sh +"Make and publish docker": + "key": "MPD" + "other": + "clean-working-dir": true + "final-tasks": + - "clean" + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "environment": DOCKER_CLI_EXPERIMENTAL=enabled + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - # Install Qemu, create builder. - docker version -f '{{ .Server.Experimental }}' - docker buildx rm buildx-builder || : - docker buildx create \ - --name buildx-builder \ - --driver docker-container \ - --use - docker buildx inspect --bootstrap + # Install Qemu, create builder. + docker version -f '{{ .Server.Experimental }}' + docker buildx rm buildx-builder || : + docker buildx create \ + --name buildx-builder \ + --driver docker-container \ + --use + docker buildx inspect --bootstrap - # Login to DockerHub. - docker login \ - -u="${bamboo.dockerHubUsername}" \ - -p="${bamboo.dockerHubPassword}" + # Login to DockerHub. + docker login \ + -u="${bamboo.dockerHubUsername}" \ + -p="${bamboo.dockerHubPassword}" - # Boot the builder. - docker buildx inspect --bootstrap + # Boot the builder. + docker buildx inspect --bootstrap - # Print Docker info. - docker info - docker buildx version + # Print Docker info. + docker info + docker buildx version - # Prepare and push the build. - env \ - CHANNEL="${bamboo.channel}" \ - REVISION="${bamboo.repository.revision.number}" \ - DIST_DIR='dist' \ - DOCKER_IMAGE_NAME='adguard/adguardhome' \ - DOCKER_PUSH='1' \ - VERBOSE='1' \ - sh ./scripts/make/build-docker.sh + # Prepare and push the build. + env \ + CHANNEL="${bamboo.channel}" \ + REVISION="${bamboo.repository.revision.number}" \ + DIST_DIR='dist' \ + DOCKER_IMAGE_NAME='adguard/adguardhome' \ + DOCKER_PUSH='1' \ + VERBOSE='1' \ + sh ./scripts/make/build-docker.sh -'Publish to static storage': - 'key': 'PUB' - 'other': - 'clean-working-dir': true - 'final-tasks': - - 'clean' - 'tasks': - - 'clean' - - 'checkout': - 'repository': 'bamboo-deploy-publisher' - 'path': 'bamboo-deploy-publisher' - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Publish to static storage": + "key": "PUB" + "other": + "clean-working-dir": true + "final-tasks": + - "clean" + "tasks": + - "clean" + - "checkout": + "repository": "bamboo-deploy-publisher" + "path": "bamboo-deploy-publisher" + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - cd ./dist/ + cd ./dist/ - CHANNEL="${bamboo.channel}" - export CHANNEL + CHANNEL="${bamboo.channel}" + export CHANNEL - ../bamboo-deploy-publisher/deploy.sh adguard-home-"$CHANNEL" + ../bamboo-deploy-publisher/deploy.sh adguard-home-"$CHANNEL" -'Publish to GitHub Releases': - 'key': 'PTGR' - 'other': - 'clean-working-dir': true - 'final-tasks': - - 'clean' - 'tasks': - - 'clean' - - 'checkout': - 'repository': 'bamboo-deploy-publisher' - 'path': 'bamboo-deploy-publisher' - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Publish to GitHub Releases": + "key": "PTGR" + "other": + "clean-working-dir": true + "final-tasks": + - "clean" + "tasks": + - "clean" + - "checkout": + "repository": "bamboo-deploy-publisher" + "path": "bamboo-deploy-publisher" + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - channel="${bamboo.channel}" - readonly channel + channel="${bamboo.channel}" + readonly channel - if [ "$channel" != 'release' ] && [ "${channel}" != 'beta' ] - then - echo "don't publish to GitHub Releases for this channel" + if [ "$channel" != 'release' ] && [ "${channel}" != 'beta' ] + then + echo "don't publish to GitHub Releases for this channel" - exit 0 - fi + exit 0 + fi - cd ./dist/ + cd ./dist/ - env\ - GITHUB_TOKEN="${bamboo.githubPublicRepoPassword}"\ - ../bamboo-deploy-publisher/deploy.sh adguard-home-github + env\ + GITHUB_TOKEN="${bamboo.githubPublicRepoPassword}"\ + ../bamboo-deploy-publisher/deploy.sh adguard-home-github -'triggers': - # Don't use minute values that end with a zero or a five as these are often - # used in CI and so resources during these minutes can be quite busy. - - 'cron': '0 42 13 ? * MON-FRI *' -'branches': - 'create': 'manually' - 'delete': - 'after-deleted-days': 1 - 'after-inactive-days': 30 - 'integration': - 'push-on-success': false - 'merge-from': 'AdGuard Home - Build and publish release' - 'link-to-jira': true +"triggers": + # Don't use minute values that end with a zero or a five as these are often + # used in CI and so resources during these minutes can be quite busy. + - "cron": "0 42 13 ? * MON-FRI *" +"branches": + "create": "manually" + "delete": + "after-deleted-days": 1 + "after-inactive-days": 30 + "integration": + "push-on-success": false + "merge-from": "AdGuard Home - Build and publish release" + "link-to-jira": true -'notifications': - - 'events': - - 'plan-completed' - 'recipients': - - 'webhook': - 'name': 'Build webhook' - 'url': 'http://prod.jirahub.service.eu.consul/v1/webhook/bamboo?channel=adguard-qa-dns-builds' +"notifications": + - "events": + - "plan-completed" + "recipients": + - "webhook": + "name": "Build webhook" + "url": "http://prod.jirahub.service.eu.consul/v1/webhook/bamboo?channel=adguard-qa-dns-builds" -'labels': [] -'other': - 'concurrent-build-plugin': 'system-default' +"labels": [] +"other": + "concurrent-build-plugin": "system-default" -'branch-overrides': - # beta-vX.Y branches are the branches into which the commits that are needed - # to release a new patch version are initially cherry-picked. +"branch-overrides": + # beta-vX.Y branches are the branches into which the commits that are needed + # to release a new patch version are initially cherry-picked. - '^beta-v[0-9]+\.[0-9]+': - # Build betas on release branches manually. - 'triggers': [] - # Set the default release channel on the release branch to beta, as we may - # need to build a few of these. - 'variables': - 'channel': 'beta' - 'dockerFrontend': 'adguard/home-js-builder:4.0' - 'dockerGo': 'adguard/go-builder:1.26.2--1' + # Build betas on release branches manually. + "triggers": [] + # Set the default release channel on the release branch to beta, as we may + # need to build a few of these. + "variables": + "channel": "beta" + "dockerFrontend": "adguard/home-js-builder:4.0" + "dockerGo": "adguard/go-builder:1.26.4--1" # release-vX.Y.Z branches are the branches from which the actual final # release is built. - '^release-v[0-9]+\.[0-9]+\.[0-9]+': - # Disable integration branches for release branches. - 'branch-config': - 'integration': - 'push-on-success': false - 'merge-from': 'beta-v0.107' - # Build final releases on release branches manually. - 'triggers': [] - # Set the default release channel on the final branch to release, as these - # are the ones that actually get released. - 'variables': - 'channel': 'release' - 'dockerFrontend': 'adguard/home-js-builder:4.0' - 'dockerGo': 'adguard/go-builder:1.26.2--1' + # Disable integration branches for release branches. + "branch-config": + "integration": + "push-on-success": false + "merge-from": "beta-v0.107" + # Build final releases on release branches manually. + "triggers": [] + # Set the default release channel on the final branch to release, as these + # are the ones that actually get released. + "variables": + "channel": "release" + "dockerFrontend": "adguard/home-js-builder:4.0" + "dockerGo": "adguard/go-builder:1.26.4--1" diff --git a/bamboo-specs/test.yaml b/bamboo-specs/test.yaml index c53dfd0e8..e011c51d4 100644 --- a/bamboo-specs/test.yaml +++ b/bamboo-specs/test.yaml @@ -1,259 +1,259 @@ --- -'version': 2 -'plan': - 'project-key': 'AGH' - 'key': 'AHBRTSPECS' - 'name': 'AdGuard Home - Build and run tests' -'variables': - # This variable is used to override Docker caching, for example to rerun a - # flaky test suite. - 'cacheBuster': '0' - 'channel': 'development' - 'dockerFrontend': 'adguard/home-js-builder:4.0' - 'dockerGo': 'adguard/go-builder:1.26.2--1' +"version": 2 +"plan": + "project-key": "AGH" + "key": "AHBRTSPECS" + "name": "AdGuard Home - Build and run tests" +"variables": + # This variable is used to override Docker caching, for example to rerun a + # flaky test suite. + "cacheBuster": "0" + "channel": "development" + "dockerFrontend": "adguard/home-js-builder:4.0" + "dockerGo": "adguard/go-builder:1.26.4--1" -'stages': - - 'Tests': - 'manual': false - 'final': false - 'jobs': - - 'Test frontend' - - 'Test backend' +"stages": + - "Tests": + "manual": false + "final": false + "jobs": + - "Test frontend" + - "Test backend" - - 'Frontend': - manual: false - final: false - jobs: - - 'Build frontend' + - "Frontend": + manual: false + final: false + jobs: + - "Build frontend" - - 'Artifact': - manual: false - final: false - jobs: - - 'Artifact' + - "Artifact": + manual: false + final: false + jobs: + - "Artifact" - - 'E2E': + - "E2E": manual: true final: false jobs: - - 'Test e2e' + - "Test e2e" -'Test frontend': - 'final-tasks': - - 'clean' - 'key': 'JSTEST' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Test frontend": + "final-tasks": + - "clean" + "key": "JSTEST" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --output '.' \ - --progress 'plain' \ - --target 'tester' \ - -f ./docker/frontend.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --output '.' \ + --progress 'plain' \ + --target 'tester' \ + -f ./docker/frontend.Dockerfile \ + . -'Test backend': - 'final-tasks': - - 'test-parser': - # The default pattern, '**/test-reports/*.xml', works, so don't set - # the test-results property. - 'type': 'junit' - 'ignore-time': true - - 'clean' - 'key': 'GOTEST' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Test backend": + "final-tasks": + - "test-parser": + # The default pattern, '**/test-reports/*.xml', works, so don't set + # the test-results property. + "type": "junit" + "ignore-time": true + - "clean" + "key": "GOTEST" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --output '.' \ - --progress 'plain' \ - --target 'tester-exporter' \ - -f ./docker/ci.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --output '.' \ + --progress 'plain' \ + --target 'tester-exporter' \ + -f ./docker/ci.Dockerfile \ + . - exit_code="$(cat ./test-reports/test-exit-code.txt)" - readonly exit_code + exit_code="$(cat ./test-reports/test-exit-code.txt)" + readonly exit_code - exit "$exit_code" + exit "$exit_code" -'Build frontend': - 'artifacts': - - 'name': 'AdGuardHome frontend' - 'pattern': 'build/**' - 'shared': true - 'required': true - 'key': 'BF' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - |- - #!/bin/sh +"Build frontend": + "artifacts": + - "name": "AdGuardHome frontend" + "pattern": "build/**" + "shared": true + "required": true + "key": "BF" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - |- + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --output '.' \ - --progress 'plain' \ - --target 'builder-exporter' \ - -f ./docker/frontend.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --output '.' \ + --progress 'plain' \ + --target 'builder-exporter' \ + -f ./docker/frontend.Dockerfile \ + . -'Artifact': - 'artifact-subscriptions': - - 'artifact': 'AdGuardHome frontend' - 'artifacts': - - 'name': 'AdGuardHome_windows_amd64' - 'pattern': 'dist/AdGuardHome_windows_amd64.zip' - 'shared': true - 'required': true - - 'name': 'AdGuardHome_darwin_amd64' - 'pattern': 'dist/AdGuardHome_darwin_amd64.zip' - 'shared': true - 'required': true - - 'name': 'AdGuardHome_darwin_arm64' - 'pattern': 'dist/AdGuardHome_darwin_arm64.zip' - 'shared': true - 'required': true - - 'name': 'AdGuardHome_linux_amd64' - 'pattern': 'dist/AdGuardHome_linux_amd64.tar.gz' - 'shared': true - 'required': true - 'key': 'ART' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - |- - #!/bin/sh +"Artifact": + "artifact-subscriptions": + - "artifact": "AdGuardHome frontend" + "artifacts": + - "name": "AdGuardHome_windows_amd64" + "pattern": "dist/AdGuardHome_windows_amd64.zip" + "shared": true + "required": true + - "name": "AdGuardHome_darwin_amd64" + "pattern": "dist/AdGuardHome_darwin_amd64.zip" + "shared": true + "required": true + - "name": "AdGuardHome_darwin_arm64" + "pattern": "dist/AdGuardHome_darwin_arm64.zip" + "shared": true + "required": true + - "name": "AdGuardHome_linux_amd64" + "pattern": "dist/AdGuardHome_linux_amd64.tar.gz" + "shared": true + "required": true + "key": "ART" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - |- + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)" - readonly version + version="$(env CHANNEL=${bamboo_channel} sh ./scripts/make/version.sh)" + readonly version - docker info + docker info - docker build \ - --build-arg "ARCH=amd64 arm64" \ - --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ - --build-arg "BRANCH=${bamboo_planRepository_branchName}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --build-arg "CHANNEL=${bamboo_channel}" \ - --build-arg "OS=windows darwin linux" \ - --build-arg "REVISION=${bamboo_repository_revision_number}" \ - --build-arg "SIGN=0" \ - --build-arg "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" \ - --build-arg "VERSION=$version" \ - --output '.' \ - --progress 'plain' \ - --target 'builder-exporter' \ - -f ./docker/ci.Dockerfile \ - . + docker build \ + --build-arg "ARCH=amd64 arm64" \ + --build-arg "BASE_IMAGE=${bamboo_dockerGo}" \ + --build-arg "BRANCH=${bamboo_planRepository_branchName}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --build-arg "CHANNEL=${bamboo_channel}" \ + --build-arg "OS=windows darwin linux" \ + --build-arg "REVISION=${bamboo_repository_revision_number}" \ + --build-arg "SIGN=0" \ + --build-arg "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" \ + --build-arg "VERSION=$version" \ + --output '.' \ + --progress 'plain' \ + --target 'builder-exporter' \ + -f ./docker/ci.Dockerfile \ + . -'Test e2e': - 'artifact-subscriptions': - - 'artifact': 'AdGuardHome_linux_amd64' - - 'artifact': 'AdGuardHome frontend' - 'key': 'E2ETEST' - 'other': - 'clean-working-dir': true - 'tasks': - - 'checkout': - 'force-clean-build': true - - 'script': - 'interpreter': 'SHELL' - 'scripts': - - | - #!/bin/sh +"Test e2e": + "artifact-subscriptions": + - "artifact": "AdGuardHome_linux_amd64" + - "artifact": "AdGuardHome frontend" + "key": "E2ETEST" + "other": + "clean-working-dir": true + "tasks": + - "checkout": + "force-clean-build": true + - "script": + "interpreter": "SHELL" + "scripts": + - | + #!/bin/sh - set -e -f -u -x + set -e -f -u -x - tar -xzf dist/AdGuardHome_linux_amd64.tar.gz -C /tmp + tar -xzf dist/AdGuardHome_linux_amd64.tar.gz -C /tmp - mv /tmp/AdGuardHome/AdGuardHome ./AdGuardHome + mv /tmp/AdGuardHome/AdGuardHome ./AdGuardHome - docker info + docker info - docker build \ - --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ - --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ - --output '.' \ - --progress 'plain' \ - --target 'e2etester' \ - -f ./docker/frontend.Dockerfile \ - . + docker build \ + --build-arg "BASE_IMAGE=${bamboo.dockerFrontend}" \ + --build-arg "CACHE_BUSTER=${bamboo_cacheBuster}" \ + --output '.' \ + --progress 'plain' \ + --target 'e2etester' \ + -f ./docker/frontend.Dockerfile \ + . -'branches': - 'create': 'for-pull-request' - 'delete': - 'after-deleted-days': 1 - 'after-inactive-days': 5 - 'integration': - 'push-on-success': false - 'merge-from': 'AdGuard Home - Build and run tests' - 'link-to-jira': true +"branches": + "create": "for-pull-request" + "delete": + "after-deleted-days": 1 + "after-inactive-days": 5 + "integration": + "push-on-success": false + "merge-from": "AdGuard Home - Build and run tests" + "link-to-jira": true -'notifications': - - 'events': - - 'plan-status-changed' - 'recipients': - - 'webhook': - 'name': 'Build webhook' - 'url': 'http://prod.jirahub.service.eu.consul/v1/webhook/bamboo' +"notifications": + - "events": + - "plan-status-changed" + "recipients": + - "webhook": + "name": "Build webhook" + "url": "http://prod.jirahub.service.eu.consul/v1/webhook/bamboo" -'labels': [] -'other': - 'concurrent-build-plugin': 'system-default' +"labels": [] +"other": + "concurrent-build-plugin": "system-default" -'branch-overrides': - # rc-vX.Y.Z branches are the release candidate branches. They are created - # from the release branch and are used to build the release candidate - # images. +"branch-overrides": + # rc-vX.Y.Z branches are the release candidate branches. They are created + # from the release branch and are used to build the release candidate + # images. - '^rc-v[0-9]+\.[0-9]+\.[0-9]+': - # Set the default release channel on the release branch to beta, as we - # may need to build a few of these. - 'variables': - 'dockerFrontend': 'adguard/home-js-builder:4.0' - 'dockerGo': 'adguard/go-builder:1.26.2--1' - 'channel': 'candidate' + # Set the default release channel on the release branch to beta, as we + # may need to build a few of these. + "variables": + "dockerFrontend": "adguard/home-js-builder:4.0" + "dockerGo": "adguard/go-builder:1.26.4--1" + "channel": "candidate" diff --git a/client/src/components/Settings/FiltersConfig/index.tsx b/client/src/components/Settings/FiltersConfig/index.tsx index 944a6f9d4..a5bfc18ef 100644 --- a/client/src/components/Settings/FiltersConfig/index.tsx +++ b/client/src/components/Settings/FiltersConfig/index.tsx @@ -4,20 +4,17 @@ import { Trans, useTranslation } from 'react-i18next'; import i18next from 'i18next'; import { toNumber } from '../../../helpers/form'; -import { DAY, FILTERS_INTERVALS_HOURS, FILTERS_RELATIVE_LINK } from '../../../helpers/constants'; +import { DAY_HOURS, FILTERS_INTERVALS_HOURS, FILTERS_RELATIVE_LINK } from '../../../helpers/constants'; import { Checkbox } from '../../ui/Controls/Checkbox'; import { Select } from '../../ui/Controls/Select'; -const THREE_DAYS_INTERVAL = DAY * 3; -const SEVEN_DAYS_INTERVAL = DAY * 7; - const getTitleForInterval = (interval: number) => { if (interval === 0) { return i18next.t('disabled'); } - if (interval === THREE_DAYS_INTERVAL || interval === SEVEN_DAYS_INTERVAL) { - return i18next.t('interval_days', { count: interval / DAY }); + if (interval % DAY_HOURS === 0) { + return i18next.t('interval_days', { count: interval / DAY_HOURS }); } return i18next.t('interval_hours', { count: interval }); @@ -58,6 +55,10 @@ export const FiltersConfig = ({ initialValues, setFiltersConfig, processing }: P a: , }; + const options = FILTERS_INTERVALS_HOURS.includes(initialValues.interval) + ? FILTERS_INTERVALS_HOURS + : [...FILTERS_INTERVALS_HOURS, initialValues.interval]; + return ( <>