diff --git a/.drone.star b/.drone.star deleted file mode 100644 index a563ee0682a..00000000000 --- a/.drone.star +++ /dev/null @@ -1,38 +0,0 @@ -# To generate the .drone.yml file: -# 1. Modify the *.star definitions -# 2. Login to drone and export the env variables (token and server) shown here: https://drone.grafana.net/account -# 3. Run `make drone` -# More information about this process here: https://github.com/grafana/deployment_tools/blob/master/docs/infrastructure/drone/signing.md -""" -This module returns a Drone configuration including pipelines and secrets. -""" - -load("scripts/drone/events/main.star", "main_pipelines") -load( - "scripts/drone/events/release.star", - "publish_artifacts_pipelines", - "publish_npm_pipelines", - "publish_packages_pipeline", -) -load("scripts/drone/events/rrc-patch.star", "rrc_patch_pipelines") -load( - "scripts/drone/pipelines/publish_images.star", - "publish_image_pipelines_public", -) -load( - "scripts/drone/rgm.star", - "rgm", -) -load("scripts/drone/vault.star", "secrets") - -def main(_ctx): - return ( - main_pipelines() + - rrc_patch_pipelines() + - publish_image_pipelines_public() + - publish_artifacts_pipelines("public") + - publish_npm_pipelines() + - publish_packages_pipeline() + - rgm() + - secrets() - ) diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index bbd3e820619..00000000000 --- a/.drone.yml +++ /dev/null @@ -1,1880 +0,0 @@ ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-docs -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - yarn run prettier:checkDocs - depends_on: - - yarn-install - environment: - NODE_OPTIONS: --max_old_space_size=8192 - image: node:22.16.0-alpine - name: lint-docs -- commands: - - mkdir -p /hugo/content/docs/grafana/latest - - 'echo -e ''---\nredirectURL: /docs/grafana/latest/\ntype: redirect\nversioned: - true\n---\n'' > /hugo/content/docs/grafana/_index.md' - - cp -r docs/sources/* /hugo/content/docs/grafana/latest/ - - cd /hugo && make prod - image: grafana/docs-base:latest - name: build-docs-website - pull: always -- commands: - - '# It is required that code generated from Thema/CUE be committed and in sync - with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.6-alpine - name: verify-gen-cue -trigger: - branch: main - event: - - push - paths: - include: - - '*.md' - - docs/** - - packages/**/*.md - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-build-e2e-publish -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - '# It is required that code generated from Thema/CUE be committed and in sync - with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.6-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.6-alpine - name: verify-gen-jsonnet -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - apk add --update jq - - new_version=$(cat package.json | jq -r .version | sed s/pre/${DRONE_BUILD_NUMBER}/g) - - 'echo "New version: $new_version"' - - yarn run lerna version $new_version --exact --no-git-tag-version --no-push --force-publish - -y - - yarn install --mode=update-lockfile - depends_on: - - yarn-install - image: node:22.16.0-alpine - name: update-package-json-version -- commands: - - apk add --update jq bash - - yarn packages:build - - yarn packages:pack - - ./scripts/validate-npm-packages.sh - depends_on: - - yarn-install - - update-package-json-version - environment: - NODE_OPTIONS: --max_old_space_size=8192 - image: node:22.16.0-alpine - name: build-frontend-packages -- commands: - - wget -qO- https://github.com/dagger/dagger/releases/download/v0.18.8/dagger_v0.18.8_linux_amd64.tar.gz - | tar zx -C /bin - - apk add docker - - docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --version - - docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' - - docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - - go run ./pkg/build/cmd artifacts -a targz:grafana:linux/amd64 -a targz:grafana:linux/arm64 - -a targz:grafana:linux/arm/v7 -a docker:grafana:linux/amd64 -a docker:grafana:linux/amd64:ubuntu - -a docker:grafana:linux/arm64 -a docker:grafana:linux/arm64:ubuntu -a docker:grafana:linux/arm/v7 - -a docker:grafana:linux/arm/v7:ubuntu --yarn-cache=$$YARN_CACHE_FOLDER --build-id=$$DRONE_BUILD_NUMBER - --ubuntu-base=ubuntu-base --alpine-base=alpine-base --tag-format='{{ .version_base - }}-{{ .buildID }}-{{ .arch }}' --ubuntu-tag-format='{{ .version_base }}-{{ .buildID - }}-ubuntu-{{ .arch }}' --verify='false' --grafana-dir=$$PWD > packages.txt - - find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i - depends_on: - - update-package-json-version - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - image: golang:1.24.6-alpine - name: rgm-package - pull: always - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - ./bin/grabpl artifacts docker publish --dockerhub-repo grafana/grafana - depends_on: - - rgm-package - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_grafanauploads - GITHUB_APP_ID: "329617" - GITHUB_APP_INSTALLATION_ID: "37346161" - GITHUB_APP_PRIVATE_KEY: - from_secret: delivery-bot-app-private-key - image: google/cloud-sdk:431.0.0 - name: publish-images-grafana - volumes: - - name: docker - path: /var/run/docker.sock - when: - repo: - - grafana/grafana -- commands: - - yarn e2e:plugin:build - depends_on: - - yarn-install - environment: - NODE_OPTIONS: --max_old_space_size=8192 - image: node:22.16.0-alpine - name: build-test-plugins -- commands: - - apk add --update tar bash - - mkdir grafana - - tar --strip-components=1 -xvf ./dist/*amd64.tar.gz -C grafana - - cp -r devenv scripts tools grafana && cd grafana && ./scripts/grafana-server/start-server - depends_on: - - rgm-package - detach: true - environment: - GF_APP_MODE: development - GF_SERVER_HTTP_PORT: "3001" - GF_SERVER_ROUTER_LOGGING: "1" - image: alpine:3.21.3 - name: grafana-server -- commands: - - GITHUB_TOKEN=$(cat /github-app/token) - - cd / - - ./cpp-e2e/scripts/ci-run.sh azure ${DRONE_SOURCE_BRANCH} - depends_on: - - grafana-server - - github-app-generate-token - environment: - AZURE_SP_APP_ID: - from_secret: azure_sp_app_id - AZURE_SP_PASSWORD: - from_secret: azure_sp_app_pw - AZURE_TENANT: - from_secret: azure_tenant - CYPRESS_CI: "true" - HOST: grafana-server - image: us-docker.pkg.dev/grafanalabs-dev/docker-oss-plugin-partnerships-dev/e2e-14.3.2:1.0.0 - name: end-to-end-tests-cloud-plugins-suite-azure - volumes: - - name: github-app - path: /github-app - when: - paths: - include: - - pkg/tsdb/azuremonitor/** - - public/app/plugins/datasource/azuremonitor/** - - e2e/cloud-plugins-suite/azure-monitor.spec.ts - repo: - - grafana/grafana -- commands: - - npx wait-on@7.0.1 http://$HOST:$PORT - - yarn playwright install --with-deps chromium - - GRAFANA_URL=http://$HOST:$PORT yarn e2e:playwright --grep @plugins - depends_on: - - grafana-server - - build-test-plugins - environment: - HOST: grafana-server - PORT: "3001" - PROV_DIR: /grafana/scripts/grafana-server/tmp/conf/provisioning - image: node:22-bookworm - name: playwright-plugin-e2e -- commands: - - apt-get update - - apt-get install -yq zip - - printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json - - gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json - - gsutil cp -r ./playwright-report/. gs://releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report - - export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html - - "echo \"E2E Playwright report uploaded to: \n $${E2E_PLAYWRIGHT_REPORT_URL}\"" - depends_on: - - playwright-plugin-e2e - environment: - GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY: - from_secret: gcp_upload_artifacts_key - failure: ignore - image: google/cloud-sdk:431.0.0 - name: playwright-e2e-report-upload - when: - status: - - success - - failure -- commands: - - GITHUB_TOKEN=$(cat /github-app/token) - - if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi - - export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html - - 'curl -L -X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments - -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${GITHUB_TOKEN}" - -H "X-GitHub-Api-Version: 2022-11-28" -d "{\"body\":\"❌ Failed to run Playwright - plugin e2e tests.

Click [here]($${E2E_PLAYWRIGHT_REPORT_URL}) to - browse the Playwright report and trace viewer.
For information on how to - run Playwright tests locally, refer to the [Developer guide](https://github.com/grafana/grafana/blob/main/contribute/developer-guide.md#to-run-the-playwright-tests). - \"}"' - depends_on: - - playwright-e2e-report-upload - - github-app-generate-token - failure: ignore - image: byrnedo/alpine-curl:0.1.8 - name: playwright-e2e-report-post-link - volumes: - - name: github-app - path: /github-app - when: - status: - - success - - failure -- commands: - - export GITHUB_TOKEN=$(cat /github-app/token) - - if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'no e2e videos found - from remaining tests'; exit 0; fi - - apt-get update - - apt-get install -yq zip - - printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json - - gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json - - find ./e2e -type f -name "*spec.ts.mp4" | zip e2e/videos.zip -@ - - gsutil cp e2e/videos.zip gs://$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip - - export E2E_ARTIFACTS_VIDEO_ZIP=https://storage.googleapis.com/$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip - - 'echo "E2E Test artifacts uploaded to: $${E2E_ARTIFACTS_VIDEO_ZIP}"' - - 'curl -X POST https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA} - -H "Authorization: token $${GITHUB_TOKEN}" -d "{\"state\":\"success\",\"target_url\":\"$${E2E_ARTIFACTS_VIDEO_ZIP}\", - \"description\": \"Click on the details to download e2e recording videos\", \"context\": - \"e2e_artifacts\"}"' - depends_on: - - end-to-end-tests-cloud-plugins-suite-azure - - playwright-plugin-e2e - - github-app-generate-token - environment: - E2E_TEST_ARTIFACTS_BUCKET: releng-pipeline-artifacts-dev - GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY: - from_secret: gcp_upload_artifacts_key - failure: ignore - image: google/cloud-sdk:431.0.0 - name: e2e-tests-artifacts-upload - volumes: - - name: github-app - path: /github-app - when: - status: - - success - - failure -- commands: - - yarn storybook:build - - ./bin/build verify-storybook - depends_on: - - rgm-package - - build-frontend-packages - environment: - NODE_OPTIONS: --max_old_space_size=4096 - image: node:22.16.0-alpine - name: build-storybook - when: - paths: - include: - - packages/grafana-ui/** -- commands: - - npx wait-on@7.0.1 http://$HOST:$PORT - - pa11y-ci --config e2e/pa11yci.conf.js - depends_on: - - grafana-server - environment: - GRAFANA_MISC_STATS_API_KEY: - from_secret: grafana_misc_stats_api_key - HOST: grafana-server - NO_THRESHOLDS: "true" - PORT: 3001 - failure: ignore - image: grafana/docker-puppeteer:1.1.0 - name: test-a11y-frontend -- commands: - - ./bin/build store-storybook --deployment canary - depends_on: - - build-storybook - - end-to-end-tests-cloud-plugins-suite-azure - - playwright-plugin-e2e - environment: - GCP_KEY: - from_secret: gcp_grafanauploads - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: store-storybook - when: - paths: - include: - - packages/grafana-ui/** - repo: - - grafana/grafana -- commands: - - apk add --update bash grep git - - ./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics - $$GRAFANA_MISC_STATS_API_KEY - depends_on: - - test-a11y-frontend - environment: - GRAFANA_MISC_STATS_API_KEY: - from_secret: grafana_misc_stats_api_key - failure: ignore - image: node:22.16.0-alpine - name: publish-frontend-metrics - when: - repo: - - grafana/grafana -- commands: - - ./bin/grabpl artifacts docker publish --dockerhub-repo grafana/grafana-oss - depends_on: - - rgm-package - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_grafanauploads - GITHUB_APP_ID: "329617" - GITHUB_APP_INSTALLATION_ID: "37346161" - GITHUB_APP_PRIVATE_KEY: - from_secret: delivery-bot-app-private-key - image: google/cloud-sdk:431.0.0 - name: publish-images-grafana-oss - volumes: - - name: docker - path: /var/run/docker.sock - when: - repo: - - grafana/grafana -- commands: - - apk add --update bash git - - ./scripts/publish-npm-packages.sh --dist-tag 'canary' --registry 'https://registry.npmjs.org' - depends_on: - - end-to-end-tests-cloud-plugins-suite-azure - - playwright-plugin-e2e - - build-frontend-packages - environment: - NPM_TOKEN: - from_secret: npm_token - image: node:22.16.0-alpine - name: release-canary-npm-packages - when: - paths: - include: - - packages/** - repo: - - grafana/grafana -- commands: - - ./bin/build upload-packages --edition oss - depends_on: - - rgm-package - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: upload-packages - when: - repo: - - grafana/grafana -- commands: - - ./bin/build upload-cdn --edition oss - depends_on: - - rgm-package - environment: - GCP_KEY: - from_secret: gcp_grafanauploads - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: upload-cdn-assets - when: - repo: - - grafana/grafana -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: -- main-build-e2e-publish -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-trigger-downstream -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- image: grafana/drone-downstream - name: trigger-enterprise-downstream - settings: - params: - - SOURCE_BUILD_NUMBER=${DRONE_COMMIT} - - SOURCE_COMMIT=${DRONE_COMMIT} - repositories: - - grafana/grafana-enterprise@main - server: https://drone.grafana.net - token: - from_secret: drone_token -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: -- main-build-e2e-publish -kind: pipeline -name: main-notify -platform: - arch: amd64 - os: linux -steps: -- image: plugins/slack - name: slack - settings: - channel: grafana-ci-notifications - template: |- - Build {{build.number}} failed for commit: : {{build.link}} - Branch: - Author: {{build.author}} - webhook: - from_secret: slack_webhook -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana - status: - - failure -type: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rrc-trigger-downstream -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- image: grafana/drone-downstream - name: trigger-enterprise-downstream - settings: - params: - - SOURCE_BUILD_NUMBER=${DRONE_COMMIT} - - SOURCE_COMMIT=${DRONE_COMMIT} - - SOURCE_TAG=${DRONE_TAG} - repositories: - - grafana/grafana-enterprise@${DRONE_SOURCE_BRANCH} - server: https://drone.grafana.net - token: - from_secret: drone_token -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: publish-docker-public -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - ./bin/build artifacts docker fetch --edition oss - depends_on: - - compile-build-cmd - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_grafanauploads - image: google/cloud-sdk:431.0.0 - name: fetch-images - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - apk add bash - - |2- - - bash -c ' - IMAGE_TAG=$(echo "$${TAG}" | sed -e "s/+/-/g") - debug= - if [[ -n $${DRY_RUN} ]]; then debug=echo; fi - docker login -u $${DOCKER_USER} -p $${DOCKER_PASSWORD} - - # Push the grafana-image-tags images - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Create the grafana manifests - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG} grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG}-ubuntu grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Push the grafana manifests - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG} - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG}-ubuntu - - # if LATEST is set, then also create & push latest - if [[ -n $${LATEST} ]]; then - $$debug docker manifest create grafana/grafana:latest grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker manifest create grafana/grafana:latest-ubuntu grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - $$debug docker manifest push grafana/grafana:latest - $$debug docker manifest push grafana/grafana:latest-ubuntu - - fi' - depends_on: - - fetch-images - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - image: docker:27-cli - name: publish-images-grafana - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - ./bin/grabpl artifacts docker publish --dockerhub-repo grafana/grafana-oss --version-tag - ${DRONE_TAG} - depends_on: - - fetch-images - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_grafanauploads - GITHUB_APP_ID: "329617" - GITHUB_APP_INSTALLATION_ID: "37346161" - GITHUB_APP_PRIVATE_KEY: - from_secret: delivery-bot-app-private-key - image: google/cloud-sdk:431.0.0 - name: publish-images-grafana-oss - volumes: - - name: docker - path: /var/run/docker.sock -trigger: - event: - - promote - target: - - public -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: manually-publish-docker-public -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - ./bin/build artifacts docker fetch --edition oss - depends_on: - - compile-build-cmd - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - GCP_KEY: - from_secret: gcp_grafanauploads - image: google/cloud-sdk:431.0.0 - name: fetch-images - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - apk add bash - - |2- - - bash -c ' - IMAGE_TAG=$(echo "$${TAG}" | sed -e "s/+/-/g") - debug= - if [[ -n $${DRY_RUN} ]]; then debug=echo; fi - docker login -u $${DOCKER_USER} -p $${DOCKER_PASSWORD} - - # Push the grafana-image-tags images - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Create the grafana manifests - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG} grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG}-ubuntu grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Push the grafana manifests - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG} - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG}-ubuntu - - # if LATEST is set, then also create & push latest - if [[ -n $${LATEST} ]]; then - $$debug docker manifest create grafana/grafana:latest grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker manifest create grafana/grafana:latest-ubuntu grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - $$debug docker manifest push grafana/grafana:latest - $$debug docker manifest push grafana/grafana:latest-ubuntu - - fi' - depends_on: - - fetch-images - environment: - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USER: - from_secret: docker_username - image: docker:27-cli - name: publish-images-grafana - volumes: - - name: docker - path: /var/run/docker.sock -trigger: - event: - - promote - target: - - publish-docker-public -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: create-release-pr -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - export GITHUB_TOKEN=$(cat /github-app/token) - - apk add perl - - v_target=`echo $${TAG} | perl -pe 's/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/v\1.\2.x/'` - - curl -L $${GH_CLI_URL} | tar -xz --strip-components=1 -C /usr - - gh workflow run -f dry_run=$${DRY_RUN} -f version=$${TAG} -f target=$${v_target} - -f latest=$${LATEST} --repo=grafana/grafana release-pr.yml - depends_on: [] - environment: - GH_CLI_URL: https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_linux_amd64.tar.gz - image: byrnedo/alpine-curl:0.1.8 - name: create-release-pr - volumes: - - name: github-app - path: /github-app -trigger: - event: - - promote - target: release-pr -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: publish-artifacts-public -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - ./bin/build artifacts packages --artifacts-editions=oss --tag $${DRONE_TAG} --src-bucket - $${PRERELEASE_BUCKET} - depends_on: - - compile-build-cmd - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: publish-artifacts -- commands: - - ./bin/build artifacts storybook --tag ${DRONE_TAG} - depends_on: - - compile-build-cmd - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - image: grafana/grafana-ci-deploy:1.3.3 - name: publish-storybook -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - export GITHUB_TOKEN=$(cat /github-app/token) - - apk add perl - - v_target=`echo $${TAG} | perl -pe 's/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/v\1.\2.x/'` - - curl -L $${GH_CLI_URL} | tar -xz --strip-components=1 -C /usr - - gh workflow run -f dry_run=$${DRY_RUN} -f version=$${TAG} -f target=$${v_target} - -f latest=$${LATEST} --repo=grafana/grafana release-pr.yml - depends_on: - - publish-artifacts - - github-app-generate-token - environment: - GH_CLI_URL: https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_linux_amd64.tar.gz - image: byrnedo/alpine-curl:0.1.8 - name: create-release-pr - volumes: - - name: github-app - path: /github-app -trigger: - event: - - promote - target: - - public -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: publish-npm-packages-public -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - ./bin/build artifacts npm retrieve --tag ${DRONE_TAG} - depends_on: - - compile-build-cmd - - yarn-install - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - PRERELEASE_BUCKET: - from_secret: prerelease_bucket - failure: ignore - image: grafana/grafana-ci-deploy:1.3.3 - name: retrieve-npm-packages -- commands: - - ./bin/build artifacts npm release --tag ${DRONE_TAG} - depends_on: - - compile-build-cmd - - retrieve-npm-packages - environment: - NPM_TOKEN: - from_secret: npm_token - failure: ignore - image: node:22.16.0-alpine - name: release-npm-packages -trigger: - event: - - promote - target: - - public -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: verify-grafanacom-artifacts -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - apk add curl bash - - "\n for i in {1..5}; do\n if ./scripts/drone/verify-grafanacom.sh; - then\n exit 0\n elif [ $i -eq 5 ]; then\n exit - 1\n else\n sleep 60\n fi\n done\n - \ " - depends_on: [] - image: node:22.16.0-alpine - name: verify-grafanacom -trigger: - event: - - promote - target: verify-grafanacom-artifacts -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: -- publish-artifacts-public -- publish-docker-public -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: publish-packages -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- depends_on: - - compile-build-cmd - image: us.gcr.io/kubernetes-dev/package-publish:latest - name: publish-linux-packages-deb - privileged: true - settings: - access_key_id: - from_secret: packages_access_key_id - deb_distribution: auto - gpg_passphrase: - from_secret: packages_gpg_passphrase - gpg_private_key: - from_secret: packages_gpg_private_key - gpg_public_key: - from_secret: packages_gpg_public_key - package_path: gs://grafana-prerelease/artifacts/downloads/*${DRONE_TAG}/oss/**.deb - secret_access_key: - from_secret: packages_secret_access_key - service_account_json: - from_secret: packages_service_account - target_bucket: grafana-packages -- depends_on: - - compile-build-cmd - image: us.gcr.io/kubernetes-dev/package-publish:latest - name: publish-linux-packages-rpm - privileged: true - settings: - access_key_id: - from_secret: packages_access_key_id - deb_distribution: auto - gpg_passphrase: - from_secret: packages_gpg_passphrase - gpg_private_key: - from_secret: packages_gpg_private_key - gpg_public_key: - from_secret: packages_gpg_public_key - package_path: gs://grafana-prerelease/artifacts/downloads/*${DRONE_TAG}/oss/**.rpm - secret_access_key: - from_secret: packages_secret_access_key - service_account_json: - from_secret: packages_service_account - target_bucket: grafana-packages -- commands: - - ./bin/build publish grafana-com --edition oss ${DRONE_TAG} - depends_on: - - publish-linux-packages-deb - - publish-linux-packages-rpm - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - GRAFANA_COM_API_KEY: - from_secret: grafana_api_key - image: grafana/grafana-ci-deploy:1.3.3 - name: publish-grafanacom -- commands: - - apk add curl bash - - "\n for i in {1..5}; do\n if ./scripts/drone/verify-grafanacom.sh; - then\n exit 0\n elif [ $i -eq 5 ]; then\n exit - 1\n else\n sleep 60\n fi\n done\n - \ " - depends_on: - - publish-grafanacom - image: node:22.16.0-alpine - name: verify-grafanacom -trigger: - event: - - promote - target: - - public -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: publish-grafanacom -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.6-alpine - name: compile-build-cmd -- commands: - - ./bin/build publish grafana-com --edition oss ${DRONE_TAG} - depends_on: - - compile-build-cmd - environment: - GCP_KEY: - from_secret: gcp_grafanauploads_base64 - GRAFANA_COM_API_KEY: - from_secret: grafana_api_key - image: grafana/grafana-ci-deploy:1.3.3 - name: publish-grafanacom -trigger: - event: - - promote - target: publish-grafanacom -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-main-prerelease -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - wget -qO- https://github.com/dagger/dagger/releases/download/v0.18.8/dagger_v0.18.8_linux_amd64.tar.gz - | tar zx -C /bin - - apk add docker - - export GRAFANA_DIR=$$(pwd) - - export GITHUB_TOKEN=$(cat /github-app/token) - - ./pkg/build/daggerbuild/scripts/drone_build_main.sh - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - ALPINE_BASE: alpine:3.21.3 - CDN_DESTINATION: - from_secret: rgm_cdn_destination - DESTINATION: - from_secret: destination - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - DOWNLOADS_DESTINATION: - from_secret: rgm_downloads_destination - GCOM_API_KEY: - from_secret: grafana_api_key - GCP_KEY_BASE64: - from_secret: gcp_key_base64 - GPG_PASSPHRASE: - from_secret: packages_gpg_passphrase - GPG_PRIVATE_KEY: - from_secret: packages_gpg_private_key - GPG_PUBLIC_KEY: - from_secret: packages_gpg_public_key - NPM_TOKEN: - from_secret: npm_token - STORYBOOK_DESTINATION: - from_secret: rgm_storybook_destination - UBUNTU_BASE: ubuntu:22.04 - image: golang:1.24.6-alpine - name: rgm-build - pull: always - volumes: - - name: docker - path: /var/run/docker.sock - - name: github-app - path: /github-app -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - packages/**/*.md - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-tag-prerelease -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - wget -qO- https://github.com/dagger/dagger/releases/download/v0.18.8/dagger_v0.18.8_linux_amd64.tar.gz - | tar zx -C /bin - - apk add docker - - export GRAFANA_DIR=$$(pwd) - - export GITHUB_TOKEN=$(cat /github-app/token) - - ./pkg/build/daggerbuild/scripts/drone_build_tag_grafana.sh - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - ALPINE_BASE: alpine:3.21.3 - CDN_DESTINATION: - from_secret: rgm_cdn_destination - DESTINATION: - from_secret: destination - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - DOWNLOADS_DESTINATION: - from_secret: rgm_downloads_destination - GCOM_API_KEY: - from_secret: grafana_api_key - GCP_KEY_BASE64: - from_secret: gcp_key_base64 - GPG_PASSPHRASE: - from_secret: packages_gpg_passphrase - GPG_PRIVATE_KEY: - from_secret: packages_gpg_private_key - GPG_PUBLIC_KEY: - from_secret: packages_gpg_public_key - NPM_TOKEN: - from_secret: npm_token - STORYBOOK_DESTINATION: - from_secret: rgm_storybook_destination - UBUNTU_BASE: ubuntu:22.04 - image: golang:1.24.6-alpine - name: rgm-build - pull: always - volumes: - - name: docker - path: /var/run/docker.sock - - name: github-app - path: /github-app -trigger: - event: - exclude: - - promote - ref: - exclude: - - refs/tags/*-cloud* - include: - - refs/tags/v* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: -- rgm-tag-prerelease -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-tag-verify-prerelease-assets -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - apt-get update && apt-get install -yq gettext - - printenv GCP_KEY | base64 -d > /tmp/key.json - - gcloud auth activate-service-account --key-file=/tmp/key.json - - ./scripts/list-release-artifacts.sh ${DRONE_TAG} | xargs -n1 gsutil stat >> /tmp/stat.log - - '! cat /tmp/stat.log | grep "No URLs matched"' - depends_on: - - clone - environment: - BUCKET: grafana-prerelease - GCP_KEY: - from_secret: gcp_key_base64 - image: google/cloud-sdk:431.0.0 - name: gsutil-stat -trigger: - event: - exclude: - - promote - ref: - exclude: - - refs/tags/*-cloud* - include: - - refs/tags/v* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-version-branch-prerelease -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - wget -qO- https://github.com/dagger/dagger/releases/download/v0.18.8/dagger_v0.18.8_linux_amd64.tar.gz - | tar zx -C /bin - - apk add docker - - export GRAFANA_DIR=$$(pwd) - - export GITHUB_TOKEN=$(cat /github-app/token) - - ./pkg/build/daggerbuild/scripts/drone_build_tag_grafana.sh - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - ALPINE_BASE: alpine:3.21.3 - CDN_DESTINATION: - from_secret: rgm_cdn_destination - DESTINATION: - from_secret: destination - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - DOWNLOADS_DESTINATION: - from_secret: rgm_downloads_destination - GCOM_API_KEY: - from_secret: grafana_api_key - GCP_KEY_BASE64: - from_secret: gcp_key_base64 - GPG_PASSPHRASE: - from_secret: packages_gpg_passphrase - GPG_PRIVATE_KEY: - from_secret: packages_gpg_private_key - GPG_PUBLIC_KEY: - from_secret: packages_gpg_public_key - NPM_TOKEN: - from_secret: npm_token - STORYBOOK_DESTINATION: - from_secret: rgm_storybook_destination - UBUNTU_BASE: ubuntu:22.04 - image: golang:1.24.6-alpine - name: rgm-build - pull: always - volumes: - - name: docker - path: /var/run/docker.sock - - name: github-app - path: /github-app -trigger: - ref: - - refs/heads/v[0-9]* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: -- rgm-version-branch-prerelease -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-prerelease-verify-prerelease-assets -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - apt-get update && apt-get install -yq gettext - - printenv GCP_KEY | base64 -d > /tmp/key.json - - gcloud auth activate-service-account --key-file=/tmp/key.json - - ./scripts/list-release-artifacts.sh ${DRONE_TAG} | xargs -n1 gsutil stat >> /tmp/stat.log - - '! cat /tmp/stat.log | grep "No URLs matched"' - depends_on: - - clone - environment: - BUCKET: grafana-prerelease - GCP_KEY: - from_secret: gcp_key_base64 - image: google/cloud-sdk:431.0.0 - name: gsutil-stat -trigger: - ref: - - refs/heads/v[0-9]* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rgm-promotion -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - wget -qO- https://github.com/dagger/dagger/releases/download/v0.18.8/dagger_v0.18.8_linux_amd64.tar.gz - | tar zx -C /bin - - apk add docker - - export GITHUB_TOKEN=$(cat /github-app/token) - - dagger run --silent go run ./pkg/build/cmd artifacts -a $${ARTIFACTS} --grafana-ref=$${GRAFANA_REF} - --enterprise-ref=$${ENTERPRISE_REF} --grafana-repo=$${GRAFANA_REPO} --build-id=$${DRONE_BUILD_NUMBER} - --version=$${VERSION} - depends_on: - - github-app-generate-token - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - ALPINE_BASE: alpine:3.21.3 - CDN_DESTINATION: - from_secret: rgm_cdn_destination - DESTINATION: - from_secret: destination - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - DOWNLOADS_DESTINATION: - from_secret: rgm_downloads_destination - GCOM_API_KEY: - from_secret: grafana_api_key - GCP_KEY_BASE64: - from_secret: gcp_key_base64 - GPG_PASSPHRASE: - from_secret: packages_gpg_passphrase - GPG_PRIVATE_KEY: - from_secret: packages_gpg_private_key - GPG_PUBLIC_KEY: - from_secret: packages_gpg_public_key - NPM_TOKEN: - from_secret: npm_token - STORYBOOK_DESTINATION: - from_secret: rgm_storybook_destination - UBUNTU_BASE: ubuntu:22.04 - image: golang:1.24.6-alpine - name: rgm-build - pull: always - volumes: - - name: docker - path: /var/run/docker.sock - - name: github-app - path: /github-app -- commands: - - printenv GCP_KEY_BASE64 | base64 -d > /tmp/key.json - - gcloud auth activate-service-account --key-file=/tmp/key.json - - gcloud storage cp -r dist/* $${UPLOAD_TO} - depends_on: - - rgm-build - environment: - _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: - from_secret: dagger_token - CDN_DESTINATION: - from_secret: rgm_cdn_destination - DESTINATION: - from_secret: destination - DOCKER_PASSWORD: - from_secret: docker_password - DOCKER_USERNAME: - from_secret: docker_username - DOWNLOADS_DESTINATION: - from_secret: rgm_downloads_destination - GCOM_API_KEY: - from_secret: grafana_api_key - GCP_KEY_BASE64: - from_secret: gcp_key_base64 - GPG_PASSPHRASE: - from_secret: packages_gpg_passphrase - GPG_PRIVATE_KEY: - from_secret: packages_gpg_private_key - GPG_PUBLIC_KEY: - from_secret: packages_gpg_public_key - NPM_TOKEN: - from_secret: npm_token - STORYBOOK_DESTINATION: - from_secret: rgm_storybook_destination - image: google/cloud-sdk:alpine - name: rgm-copy -trigger: - event: - - promote - target: upload-packages -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - path: /github-app -- name: github-app - temp: {} ---- -get: - name: app-id - path: ci/data/repo/grafana/grafana/github-app -kind: secret -name: github-app-app-id ---- -get: - name: app-installation-id - path: ci/data/repo/grafana/grafana/github-app -kind: secret -name: github-app-installation-id ---- -get: - name: private-key - path: ci/data/repo/grafana/grafana/github-app -kind: secret -name: github-app-private-key ---- -get: - name: credentials.json - path: infra/data/ci/grafana-release-eng/grafanauploads -kind: secret -name: gcp_grafanauploads ---- -get: - name: credentials_base64 - path: infra/data/ci/grafana-release-eng/grafanauploads -kind: secret -name: gcp_grafanauploads_base64 ---- -get: - name: api_key - path: infra/data/ci/grafana-release-eng/grafanacom -kind: secret -name: grafana_api_key ---- -get: - name: .dockerconfigjson - path: secret/data/common/gcr -kind: secret -name: gcr ---- -get: - name: .dockerconfigjson - path: secret/data/common/gar -kind: secret -name: gar ---- -get: - name: machine-user-token - path: infra/data/ci/drone -kind: secret -name: drone_token ---- -get: - name: bucket - path: infra/data/ci/grafana/prerelease -kind: secret -name: prerelease_bucket ---- -get: - name: username - path: ci/data/common/dockerhub -kind: secret -name: docker_username ---- -get: - name: password - path: ci/data/common/dockerhub -kind: secret -name: docker_password ---- -get: - name: credentials.json - path: infra/data/ci/grafana/releng/artifacts-uploader-service-account -kind: secret -name: gcp_upload_artifacts_key ---- -get: - name: credentials.json - path: infra/data/ci/grafana/assets-downloader-build-container-service-account -kind: secret -name: gcp_download_build_container_assets_key ---- -get: - name: application_id - path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials -kind: secret -name: azure_sp_app_id ---- -get: - name: application_secret - path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials -kind: secret -name: azure_sp_app_pw ---- -get: - name: tenant_id - path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials -kind: secret -name: azure_tenant ---- -get: - name: token - path: infra/data/ci/grafana-release-eng/npm -kind: secret -name: npm_token ---- -get: - name: public-key-b64 - path: infra/data/ci/packages-publish/gpg -kind: secret -name: packages_gpg_public_key ---- -get: - name: private-key-b64 - path: infra/data/ci/packages-publish/gpg -kind: secret -name: packages_gpg_private_key ---- -get: - name: passphrase - path: infra/data/ci/packages-publish/gpg -kind: secret -name: packages_gpg_passphrase ---- -get: - name: credentials.json - path: infra/data/ci/packages-publish/service-account -kind: secret -name: packages_service_account ---- -get: - name: AccessID - path: infra/data/ci/packages-publish/bucket-credentials -kind: secret -name: packages_access_key_id ---- -get: - name: Secret - path: infra/data/ci/packages-publish/bucket-credentials -kind: secret -name: packages_secret_access_key ---- -get: - name: static_asset_editions - path: infra/data/ci/grafana-release-eng/artifact-publishing -kind: secret -name: static_asset_editions ---- -get: - name: gcp_service_account_prod_base64 - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: gcp_key_base64 ---- -get: - name: destination_prod - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: destination ---- -get: - name: storybook_destination - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: rgm_storybook_destination ---- -get: - name: cdn_destination - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: rgm_cdn_destination ---- -get: - name: downloads_destination - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: rgm_downloads_destination ---- -get: - name: dagger_token - path: infra/data/ci/grafana-release-eng/rgm -kind: secret -name: dagger_token ---- -get: - name: PRIVATE_KEY - path: ci/data/repo/grafana/grafana/delivery-bot-app -kind: secret -name: delivery-bot-app-private-key ---- -get: - name: service-account - path: secret/data/common/gcr -kind: secret -name: gcr_credentials ---- -kind: signature -hmac: 70171a24c7e9ab7af105bd39d02f9aa6d28a4505963dfc9140f53cdfe4965ef8 - -... diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 52c4a32d02c..61419166386 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -328,9 +328,6 @@ # Continuous Integration -.drone.yml @grafana/grafana-developer-enablement-squad -.drone.star @grafana/grafana-developer-enablement-squad -/scripts/drone/ @grafana/grafana-developer-enablement-squad /pkg/build/ @grafana/grafana-developer-enablement-squad /.dockerignore @grafana/grafana-developer-enablement-squad /Dockerfile @grafana/grafana-developer-enablement-squad diff --git a/Makefile b/Makefile index 5652c157b2d..ab99a49fc24 100644 --- a/Makefile +++ b/Makefile @@ -524,25 +524,6 @@ gen-ts: tscriptify -interface -package=github.com/grafana/grafana/pkg/services/live/pipeline -import="import { FieldConfig } from '@grafana/data'" -target=public/app/features/live/pipeline/models.gen.ts pkg/services/live/pipeline/config.go go mod tidy -# This repository's configuration is protected (https://readme.drone.io/signature/). -# Use this make target to regenerate the configuration YAML files when -# you modify starlark files. -.PHONY: drone -drone: $(DRONE) - bash scripts/drone/env-var-check.sh - $(DRONE) starlark --format - $(DRONE) lint .drone.yml --trusted - $(DRONE) --server https://drone.grafana.net sign --save grafana/grafana - -# Generate an Emacs tags table (https://www.gnu.org/software/emacs/manual/html_node/emacs/Tags-Tables.html) for Starlark files. -.PHONY: scripts/drone/TAGS -scripts/drone/TAGS: $(shell find scripts/drone -name '*.star') - etags --lang none --regex="/def \(\w+\)[^:]+:/\1/" --regex="/\s*\(\w+\) =/\1/" $^ -o $@ - -.PHONY: format-drone -format-drone: - buildifier --lint=fix -r scripts/drone - .PHONY: go-race-is-enabled go-race-is-enabled: @if [ -n "$(GO_RACE)" ]; then \ diff --git a/apps/alerting/notifications/go.mod b/apps/alerting/notifications/go.mod index 9a620ce12ad..9e1d9886718 100644 --- a/apps/alerting/notifications/go.mod +++ b/apps/alerting/notifications/go.mod @@ -82,13 +82,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/alerting/notifications/go.sum b/apps/alerting/notifications/go.sum index 30aa1308939..7abf0ddda54 100644 --- a/apps/alerting/notifications/go.sum +++ b/apps/alerting/notifications/go.sum @@ -252,8 +252,8 @@ go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -270,8 +270,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= @@ -288,14 +288,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -308,8 +308,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/dashboard/go.mod b/apps/dashboard/go.mod index ed72fa1aa90..296f0d6981e 100644 --- a/apps/dashboard/go.mod +++ b/apps/dashboard/go.mod @@ -110,15 +110,15 @@ require ( go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/dashboard/go.sum b/apps/dashboard/go.sum index 855fbd17a00..cb04c2614e6 100644 --- a/apps/dashboard/go.sum +++ b/apps/dashboard/go.sum @@ -314,15 +314,13 @@ golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -341,14 +339,11 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -356,8 +351,7 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/folder/go.mod b/apps/folder/go.mod index 30bcc4d5a99..effa747e628 100644 --- a/apps/folder/go.mod +++ b/apps/folder/go.mod @@ -47,11 +47,11 @@ require ( go.opentelemetry.io/otel v1.37.0 // indirect go.opentelemetry.io/otel/trace v1.37.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/apps/folder/go.sum b/apps/folder/go.sum index efbd47987b9..12336f31c0f 100644 --- a/apps/folder/go.sum +++ b/apps/folder/go.sum @@ -122,8 +122,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -132,14 +132,14 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/apps/iam/go.mod b/apps/iam/go.mod index e1471435644..b792e14b6ad 100644 --- a/apps/iam/go.mod +++ b/apps/iam/go.mod @@ -309,17 +309,17 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.40.0 // indirect + golang.org/x/crypto v0.41.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect gonum.org/v1/gonum v0.16.0 // indirect diff --git a/apps/iam/go.sum b/apps/iam/go.sum index 9663139fe40..ce4aafb9a4d 100644 --- a/apps/iam/go.sum +++ b/apps/iam/go.sum @@ -1367,8 +1367,8 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1410,8 +1410,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1470,8 +1470,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1609,8 +1609,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -1618,8 +1618,8 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1633,8 +1633,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1703,8 +1703,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/investigations/go.mod b/apps/investigations/go.mod index f94e2710e12..ab3de62ade8 100644 --- a/apps/investigations/go.mod +++ b/apps/investigations/go.mod @@ -65,13 +65,14 @@ require ( go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/investigations/go.sum b/apps/investigations/go.sum index c586ffa88d2..2ba66fa1434 100644 --- a/apps/investigations/go.sum +++ b/apps/investigations/go.sum @@ -159,8 +159,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -171,22 +171,22 @@ golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/playlist/go.mod b/apps/playlist/go.mod index 8e1ae857041..5be8ea92b75 100644 --- a/apps/playlist/go.mod +++ b/apps/playlist/go.mod @@ -65,13 +65,14 @@ require ( go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/playlist/go.sum b/apps/playlist/go.sum index c586ffa88d2..2ba66fa1434 100644 --- a/apps/playlist/go.sum +++ b/apps/playlist/go.sum @@ -159,8 +159,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -171,22 +171,22 @@ golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/plugins/go.mod b/apps/plugins/go.mod index 45c31ca73c5..79a53eaca86 100644 --- a/apps/plugins/go.mod +++ b/apps/plugins/go.mod @@ -71,14 +71,15 @@ require ( go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/plugins/go.sum b/apps/plugins/go.sum index 4e9f056ba68..0bf5302edb2 100644 --- a/apps/plugins/go.sum +++ b/apps/plugins/go.sum @@ -171,8 +171,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -185,8 +185,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -206,23 +206,23 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -231,8 +231,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/provisioning/go.mod b/apps/provisioning/go.mod index 58b0f331981..31a9edf0440 100644 --- a/apps/provisioning/go.mod +++ b/apps/provisioning/go.mod @@ -55,12 +55,13 @@ require ( go.opentelemetry.io/otel v1.37.0 // indirect go.opentelemetry.io/otel/trace v1.37.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/apps/provisioning/go.sum b/apps/provisioning/go.sum index 60de9834b49..a560728dc69 100644 --- a/apps/provisioning/go.sum +++ b/apps/provisioning/go.sum @@ -130,8 +130,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -140,22 +140,22 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/apps/secret/go.mod b/apps/secret/go.mod index f153f3be5a5..bd3d4f3542b 100644 --- a/apps/secret/go.mod +++ b/apps/secret/go.mod @@ -52,11 +52,11 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect go.opentelemetry.io/otel/trace v1.37.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/apps/secret/go.sum b/apps/secret/go.sum index 9482a6103bf..f98c5385f61 100644 --- a/apps/secret/go.sum +++ b/apps/secret/go.sum @@ -134,8 +134,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -144,14 +144,14 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/apps/shorturl/go.mod b/apps/shorturl/go.mod index d3f050f910c..37c9d61621c 100644 --- a/apps/shorturl/go.mod +++ b/apps/shorturl/go.mod @@ -66,13 +66,14 @@ require ( go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.36.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/apps/shorturl/go.sum b/apps/shorturl/go.sum index c586ffa88d2..2ba66fa1434 100644 --- a/apps/shorturl/go.sum +++ b/apps/shorturl/go.sum @@ -159,8 +159,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -171,22 +171,22 @@ golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/contribute/drone-pipeline.md b/contribute/drone-pipeline.md deleted file mode 100644 index 0e743aa5b11..00000000000 --- a/contribute/drone-pipeline.md +++ /dev/null @@ -1,17 +0,0 @@ -# Making changes to the Drone pipeline - -> Only members of the Grafana organization can make changes to the Drone pipeline. - -The Drone pipelines are built with [Starlark](https://github.com/bazelbuild/starlark), a similar language to Python. The Starlark files are located in [`scripts/drone`](https://github.com/grafana/grafana/tree/main/scripts/drone). - -## Drone setup - -1. Set environment variables `DRONE_SERVER` and `DRONE_TOKEN` found in your [Drone account](https://drone.grafana.net/account). These environment variables are used to verify that only Grafana employees can make changes to the pipelines. -1. Install [buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md), and use it to format the Starlark files you want to edit. - -## Drone development - -1. Open a pull request where you can do test runs for your changes. If you need to experiment with secrets, create a pull request in the [`grafana-ci-sandbox repo`](https://github.com/grafana/grafana-ci-sandbox) before opening a pull request in the main repo. -1. Run `make drone` after making changes to the Starlark files. This builds the `.drone.yml` file. - -For further questions, reach out to the `grafana-release-guild` squad. diff --git a/go.mod b/go.mod index 821527e863d..82fe2410738 100644 --- a/go.mod +++ b/go.mod @@ -197,15 +197,15 @@ require ( go.uber.org/zap v1.27.0 // @grafana/identity-access-team gocloud.dev v0.42.0 // @grafana/grafana-app-platform-squad gocloud.dev/secrets/hashivault v0.42.0 // @grafana/grafana-operator-experience-squad - golang.org/x/crypto v0.40.0 // @grafana/grafana-backend-group + golang.org/x/crypto v0.41.0 // @grafana/grafana-backend-group golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // @grafana/alerting-backend - golang.org/x/mod v0.26.0 // indirect; @grafana/grafana-backend-group - golang.org/x/net v0.42.0 // @grafana/oss-big-tent @grafana/partner-datasources + golang.org/x/mod v0.27.0 // indirect; @grafana/grafana-backend-group + golang.org/x/net v0.43.0 // @grafana/oss-big-tent @grafana/partner-datasources golang.org/x/oauth2 v0.30.0 // @grafana/identity-access-team golang.org/x/sync v0.16.0 // @grafana/alerting-backend - golang.org/x/text v0.27.0 // @grafana/grafana-backend-group + golang.org/x/text v0.28.0 // @grafana/grafana-backend-group golang.org/x/time v0.11.0 // @grafana/grafana-backend-group - golang.org/x/tools v0.35.0 // indirect; @grafana/grafana-as-code + golang.org/x/tools v0.36.0 // indirect; @grafana/grafana-as-code gonum.org/v1/gonum v0.16.0 // @grafana/oss-big-tent google.golang.org/api v0.235.0 // @grafana/grafana-backend-group google.golang.org/grpc v1.74.2 // @grafana/plugins-platform-backend @@ -603,8 +603,8 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect diff --git a/go.sum b/go.sum index 45bec762338..ff8580c9d8d 100644 --- a/go.sum +++ b/go.sum @@ -2687,8 +2687,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2752,8 +2752,8 @@ golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2839,8 +2839,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -3036,8 +3036,8 @@ golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -3057,8 +3057,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -3081,8 +3081,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -3168,8 +3168,8 @@ golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.work.sum b/go.work.sum index 33af2c19359..cf499b0b363 100644 --- a/go.work.sum +++ b/go.work.sum @@ -529,6 +529,8 @@ github.com/Azure/go-amqp v1.0.5 h1:po5+ljlcNSU8xtapHTe8gIc8yHxCzC03E8afH2g1ftU= github.com/Azure/go-amqp v1.0.5/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE= github.com/Azure/go-amqp v1.4.0 h1:Xj3caqi4comOF/L1Uc5iuBxR/pB6KumejC01YQOqOR4= github.com/Azure/go-amqp v1.4.0/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 h1:Ov8avRZi2vmrE2JcXw+tu5K/yB41r7xK9GZDiBF7NdM= github.com/Azure/go-autorest/autorest/azure/auth v0.5.13/go.mod h1:5BAVfWLWXihP47vYrPuBKKf4cS0bXI+KM9Qx6ETDJYo= github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 h1:w77/uPk80ZET2F+AfQExZyEWtn+0Rk/uw17m9fv5Ajc= @@ -629,8 +631,6 @@ github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhi github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/atc0005/go-teams-notify/v2 v2.13.0 h1:nbDeHy89NjYlF/PEfLVF6lsserY9O5SnN1iOIw3AxXw= github.com/atc0005/go-teams-notify/v2 v2.13.0/go.mod h1:WSv9moolRsBcpZbwEf6gZxj7h0uJlJskJq5zkEWKO8Y= github.com/aws/aws-lambda-go v1.47.0 h1:0H8s0vumYx/YKs4sE7YM0ktwL2eWse+kfopsRI1sXVI= @@ -641,8 +641,6 @@ github.com/aws/aws-sdk-go-v2/service/kinesis v1.33.0 h1:JPXkrQk5OS/+Q81fKH97Ll/V github.com/aws/aws-sdk-go-v2/service/kinesis v1.33.0/go.mod h1:dJngkoVMrq0K7QvRkdRZYM4NUp6cdWa2GBdpm8zoY8U= github.com/aws/aws-sdk-go-v2/service/kms v1.35.3 h1:UPTdlTOwWUX49fVi7cymEN6hDqCwe3LNv1vi7TXUutk= github.com/aws/aws-sdk-go-v2/service/kms v1.35.3/go.mod h1:gjDP16zn+WWalyaUqwCCioQ8gU8lzttCCc9jYsiQI/8= -github.com/aws/aws-sdk-go-v2/service/kms v1.38.1 h1:tecq7+mAav5byF+Mr+iONJnCBf4B4gon8RSp4BrweSc= -github.com/aws/aws-sdk-go-v2/service/kms v1.38.1/go.mod h1:cQn6tAF77Di6m4huxovNM7NVAozWTZLsDRp9t8Z/WYk= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.32.4 h1:NgRFYyFpiMD62y4VPXh4DosPFbZd4vdMVBWKk0VmWXc= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.32.4/go.mod h1:TKKN7IQoM7uTnyuFm9bm9cw5P//ZYTl4m3htBWQ1G/c= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.35.2 h1:vlYXbindmagyVA3RS2SPd47eKZ00GZZQcr+etTviHtc= @@ -679,6 +677,8 @@ github.com/blevesearch/snowball v0.6.1 h1:cDYjn/NCH+wwt2UdehaLpr2e4BwLIjN4V/TdLs github.com/blevesearch/snowball v0.6.1/go.mod h1:ZF0IBg5vgpeoUhnMza2v0A/z8m1cWPlwhke08LpNusg= github.com/blevesearch/stempel v0.2.0 h1:CYzVPaScODMvgE9o+kf6D4RJ/VRomyi9uHF+PtB+Afc= github.com/blevesearch/stempel v0.2.0/go.mod h1:wjeTHqQv+nQdbPuJ/YcvOjTInA2EIc6Ks1FoSUzSLvc= +github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= +github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= @@ -731,6 +731,8 @@ github.com/containerd/containerd v1.7.18 h1:jqjZTQNfXGoEaZdW1WwPU0RqSn1Bm2Ay/KJP github.com/containerd/containerd v1.7.18/go.mod h1:IYEk9/IO6wAPUz2bCMVUbsfXjzw5UNP5fLz4PsUygQ4= github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= github.com/coreos/etcd v3.3.27+incompatible h1:QIudLb9KeBsE5zyYxd1mjzRSkzLg9Wf9QlRwFgd6oTA= @@ -751,6 +753,7 @@ github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHf github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/creasty/defaults v1.8.0 h1:z27FJxCAa0JKt3utc0sCImAEb+spPucmKoOdLHvHYKk= @@ -794,6 +797,7 @@ github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/docker/distribution v2.7.0+incompatible h1:neUDAlf3wX6Ml4HdqTrbcOHXtfRN0TFIwt6YFL7N9RU= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= @@ -806,6 +810,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY= github.com/dolthub/swiss v0.2.1 h1:gs2osYs5SJkAaH5/ggVJqXQxRXtWshF6uE0lgR/Y3Gw= github.com/dolthub/swiss v0.2.1/go.mod h1:8AhKZZ1HK7g18j7v7k6c5cYIGEZJcPn0ARsai8cUrh0= +github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= +github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= github.com/drone/funcmap v0.0.0-20220929084810-72602997d16f h1:/jEs7lulqVO2u1+XI5rW4oFwIIusxuDOVKD9PAzlW2E= github.com/drone/funcmap v0.0.0-20220929084810-72602997d16f/go.mod h1:nDRkX7PHq+p39AD5/usv3KZMerxZTYU/9rfLS5IDspU= github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI= @@ -859,6 +865,7 @@ github.com/fsouza/fake-gcs-server v1.52.2/go.mod h1:47HKyIkz6oLTes1R8vEaHLwXfzYs github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= @@ -988,8 +995,6 @@ github.com/grafana/grafana-app-sdk/logging v0.39.1/go.mod h1:WhDENSnaGHtyVVwZGVn github.com/grafana/grafana-app-sdk/logging v0.40.0/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU= github.com/grafana/grafana-app-sdk/logging v0.40.3 h1:2VXsXXEQiqAavRP8wusRDB6rDqf5lufP7A6NfjELqPE= github.com/grafana/grafana-app-sdk/logging v0.40.3/go.mod h1:otUD9XpJD7A5sCLb8mcs9hIXGdeV6lnhzVwe747g4RU= -github.com/grafana/grafana-app-sdk/plugin v0.40.3 h1:uH0oFZnYOUL+OXcyhd5NVYwoM+Wa0WUXvZ2Om1M91r0= -github.com/grafana/grafana-app-sdk/plugin v0.40.3/go.mod h1:+ylwE0P8WgPu5zURK5aDnVJpwRpuK3573rwrVV28qzQ= github.com/grafana/grafana-app-sdk/plugin v0.41.0 h1:ShUvGpAVzM3UxcsfwS6l/lwW4ytDeTbCQXf8w2P8Yp8= github.com/grafana/grafana-app-sdk/plugin v0.41.0/go.mod h1:YIhimVfAqtOp3kdhxOanaSZjypVKh/bYxf9wfFfhDm0= github.com/grafana/grafana-aws-sdk v0.38.2 h1:TzQD0OpWsNjtldi5G5TLDlBRk8OyDf+B5ujcoAu4Dp0= @@ -1203,10 +1208,10 @@ github.com/mitchellh/gox v0.4.0 h1:lfGJxY7ToLJQjHHwi0EX6uYBdK78egf954SQl13PQJc= github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mithrandie/readline-csvq v1.3.0 h1:VTJEOGouJ8j27jJCD4kBBbNTxM0OdBvE1aY1tMhlqE8= github.com/mithrandie/readline-csvq v1.3.0/go.mod h1:FKyYqDgf/G4SNov7SMFXRWO6LQLXIOeTog/NB97FZl0= +github.com/moby/moby v27.5.1+incompatible h1:/pN59F/t3U7Q4FPzV88nzqf7Fp0qqCSL2KzhZaiKcKw= +github.com/moby/moby v27.5.1+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= -github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= @@ -1215,11 +1220,14 @@ github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8 h1:P48LjvUQpTReR3TQRbxSeSBsMXzfK0uol7eRcr7VBYQ= github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A= github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM= @@ -1740,6 +1748,8 @@ golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMe golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b h1:DU+gwOBXU+6bO0sEyO7o/NeMlxZxCZEvI7v+J4a1zRQ= golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4= +golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488 h1:3doPGa+Gg4snce233aCWnbZVFsyFMo/dR40KK/6skyE= +golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488/go.mod h1:fGb/2+tgXXjhjHsTNdVEEMZNWA0quBnfrO+AfoDSAKw= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= @@ -1863,6 +1873,8 @@ gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= gopkg.in/vmihailenco/msgpack.v2 v2.9.2 h1:gjPqo9orRVlSAH/065qw3MsFCDpH7fa1KpiizXyllY4= gopkg.in/vmihailenco/msgpack.v2 v2.9.2/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34= honnef.co/go/tools v0.3.2/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= diff --git a/pkg/aggregator/go.mod b/pkg/aggregator/go.mod index c6da7f2336d..51ddc319f3f 100644 --- a/pkg/aggregator/go.mod +++ b/pkg/aggregator/go.mod @@ -137,17 +137,17 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.40.0 // indirect + golang.org/x/crypto v0.41.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect diff --git a/pkg/aggregator/go.sum b/pkg/aggregator/go.sum index 90bafdd4714..bec1d40e6bb 100644 --- a/pkg/aggregator/go.sum +++ b/pkg/aggregator/go.sum @@ -403,8 +403,8 @@ go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= @@ -414,8 +414,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -425,8 +425,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= @@ -451,14 +451,14 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -472,8 +472,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/apimachinery/go.mod b/pkg/apimachinery/go.mod index 78854c60506..ce231290790 100644 --- a/pkg/apimachinery/go.mod +++ b/pkg/apimachinery/go.mod @@ -43,11 +43,11 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect go.opentelemetry.io/otel/trace v1.37.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/grpc v1.74.2 // indirect google.golang.org/protobuf v1.36.6 // indirect diff --git a/pkg/apimachinery/go.sum b/pkg/apimachinery/go.sum index df48bc9bb77..45a22c473b8 100644 --- a/pkg/apimachinery/go.sum +++ b/pkg/apimachinery/go.sum @@ -96,8 +96,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -110,8 +110,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -129,8 +129,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -142,8 +142,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= diff --git a/pkg/apiserver/go.mod b/pkg/apiserver/go.mod index 41f81051b82..d45b4d47541 100644 --- a/pkg/apiserver/go.mod +++ b/pkg/apiserver/go.mod @@ -82,15 +82,15 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/term v0.33.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/term v0.34.0 // indirect + golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.11.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.36.0 // indirect google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect diff --git a/pkg/apiserver/go.sum b/pkg/apiserver/go.sum index 88081713de9..3e0c96a17c5 100644 --- a/pkg/apiserver/go.sum +++ b/pkg/apiserver/go.sum @@ -240,8 +240,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -264,8 +264,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= @@ -291,23 +291,23 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= -golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -322,8 +322,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/build/action.go b/pkg/build/action.go deleted file mode 100644 index 5c93a935341..00000000000 --- a/pkg/build/action.go +++ /dev/null @@ -1 +0,0 @@ -package build diff --git a/pkg/build/cmd/fetchimages.go b/pkg/build/cmd/fetchimages.go deleted file mode 100644 index 26260aedb19..00000000000 --- a/pkg/build/cmd/fetchimages.go +++ /dev/null @@ -1,127 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os/exec" - "path/filepath" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/grafana/grafana/pkg/build/docker" - "github.com/grafana/grafana/pkg/build/gcloud" -) - -const ( - alpine = "alpine" - ubuntu = "ubuntu" -) - -// GetImageFiles returns the list of image (.img, but should be .tar because they are tar archives) files that are -// created in the 'tag' process and stored in the prerelease bucket, waiting to be released. -func GetImageFiles(grafana string, version string, architectures []config.Architecture) []string { - bases := []string{alpine, ubuntu} - images := []string{} - for _, base := range bases { - for _, arch := range architectures { - image := fmt.Sprintf("%s-%s-%s.img", grafana, version, arch) - if base == "ubuntu" { - image = fmt.Sprintf("%s-%s-ubuntu-%s.img", grafana, version, arch) - } - - images = append(images, image) - } - } - - return images -} - -func FetchImages(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - metadata, err := config.GenerateMetadata(c) - if err != nil { - return err - } - - buildConfig, err := config.GetBuildConfig(metadata.ReleaseMode.Mode) - if err != nil { - return err - } - - cfg := docker.Config{ - Archs: buildConfig.Docker.Architectures, - Distribution: buildConfig.Docker.Distribution, - Bucket: buildConfig.Docker.PrereleaseBucket, - Edition: c.String("edition"), - Tag: metadata.GrafanaVersion, - } - - grafana := "grafana" - if cfg.Edition == "enterprise" { - grafana = "grafana-enterprise" - } - if cfg.Edition == "enterprise2" { - grafana = "grafana-enterprise2" - } - if cfg.Edition == "grafana" || cfg.Edition == "oss" { - grafana = "grafana-oss" - } - - baseURL := fmt.Sprintf("gs://%s/%s/", cfg.Bucket, cfg.Tag) - images := GetImageFiles(grafana, cfg.Tag, cfg.Archs) - - log.Printf("Fetching images [%v]", images) - - if err := gcloud.ActivateServiceAccount(); err != nil { - return err - } - if err := DownloadImages(baseURL, images, "."); err != nil { - return err - } - if err := LoadImages(images, "."); err != nil { - return err - } - return nil -} - -// LoadImages uses the `docker load -i` command to load the image tar file into the docker daemon so that it can be -// tagged and pushed. -func LoadImages(images []string, source string) error { - p := filepath.Clean(source) - for _, image := range images { - image := filepath.Join(p, image) - log.Println("Loading image", image) - //nolint:gosec - cmd := exec.Command("docker", "load", "-i", image) - cmd.Dir = "." - out, err := cmd.CombinedOutput() - if err != nil { - log.Printf("out: %s\n", out) - return fmt.Errorf("error loading image: %q", err) - } - log.Println("Loaded image", image) - } - log.Println("Images successfully loaded!") - return nil -} - -func DownloadImages(baseURL string, images []string, destination string) error { - for _, image := range images { - p := baseURL + image - log.Println("Downloading image", p) - //nolint:gosec - cmd := exec.Command("gsutil", "-m", "cp", "-r", p, destination) - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("failed to download: %w\n%s", err, out) - } - } - return nil -} diff --git a/pkg/build/cmd/fetchimages_test.go b/pkg/build/cmd/fetchimages_test.go deleted file mode 100644 index 9452b011a66..00000000000 --- a/pkg/build/cmd/fetchimages_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "testing" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/stretchr/testify/require" -) - -func TestGetImageFiles(t *testing.T) { - var ( - architectures = []config.Architecture{ - config.ArchAMD64, - config.ArchARM64, - config.ArchARMv7, - } - ) - - t.Run("1.2.3", func(t *testing.T) { - expect := []string{ - "grafana-oss-1.2.3-amd64.img", - "grafana-oss-1.2.3-arm64.img", - "grafana-oss-1.2.3-armv7.img", - "grafana-oss-1.2.3-ubuntu-amd64.img", - "grafana-oss-1.2.3-ubuntu-arm64.img", - "grafana-oss-1.2.3-ubuntu-armv7.img", - } - - res := GetImageFiles("grafana-oss", "1.2.3", architectures) - - require.Equal(t, expect, res) - }) - - t.Run("1.2.3+example-01", func(t *testing.T) { - expect := []string{ - "grafana-oss-1.2.3+example-01-amd64.img", - "grafana-oss-1.2.3+example-01-arm64.img", - "grafana-oss-1.2.3+example-01-armv7.img", - "grafana-oss-1.2.3+example-01-ubuntu-amd64.img", - "grafana-oss-1.2.3+example-01-ubuntu-arm64.img", - "grafana-oss-1.2.3+example-01-ubuntu-armv7.img", - } - - res := GetImageFiles("grafana-oss", "1.2.3+example-01", architectures) - - require.Equal(t, expect, res) - }) -} diff --git a/pkg/build/cmd/flags.go b/pkg/build/cmd/flags.go deleted file mode 100644 index f0fb0ee1168..00000000000 --- a/pkg/build/cmd/flags.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import "github.com/urfave/cli/v2" - -var ( - jobsFlag = cli.IntFlag{ - Name: "jobs", - Usage: "Number of parallel jobs", - } - buildIDFlag = cli.StringFlag{ - Name: "build-id", - Usage: "Optionally supply a build ID to be part of the version", - } - editionFlag = cli.StringFlag{ - Name: "edition", - Usage: "The edition of Grafana to build (oss or enterprise)", - Value: "oss", - } - triesFlag = cli.IntFlag{ - Name: "tries", - Usage: "Specify number of tries before failing", - Value: 1, - } - tagFlag = cli.StringFlag{ - Name: "tag", - Usage: "Grafana version tag", - } - securityFlag = cli.BoolFlag{ - Name: "security", - Usage: "Security release", - } - srcFlag = cli.StringFlag{ - Name: "src-bucket", - Value: "grafana-prerelease", - Usage: "Google Cloud Storage bucket", - } - securityDestBucketFlag = cli.StringFlag{ - Name: "security-dest-bucket", - Usage: "Google Cloud Storage bucket for security packages (or $SECURITY_DEST_BUCKET)", - } - destFlag = cli.StringFlag{ - Name: "dest-bucket", - Value: "grafana-downloads", - Usage: "Google Cloud Storage bucket for published packages", - } -) diff --git a/pkg/build/cmd/grafanacom.go b/pkg/build/cmd/grafanacom.go deleted file mode 100644 index 934d888d4ce..00000000000 --- a/pkg/build/cmd/grafanacom.go +++ /dev/null @@ -1,406 +0,0 @@ -package main - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "log" - "net" - "net/http" - "net/url" - "os" - "path" - "path/filepath" - "strings" - "time" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/grafana/grafana/pkg/build/gcloud" - "github.com/grafana/grafana/pkg/build/gcloud/storage" - "github.com/grafana/grafana/pkg/build/gcom" - "github.com/grafana/grafana/pkg/build/packaging" - "github.com/grafana/grafana/pkg/build/versions" -) - -const grafanaAPI = "https://grafana.com/api" - -var httpClient = http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: func(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) { - return dialer.DialContext - }(&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }), - ForceAttemptHTTP2: true, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - }, -} - -// GrafanaCom implements the sub-command "grafana-com". -func GrafanaCom(c *cli.Context) error { - bucketStr := c.String("src-bucket") - edition := config.Edition(c.String("edition")) - - if err := gcloud.ActivateServiceAccount(); err != nil { - return fmt.Errorf("couldn't activate service account, err: %w", err) - } - - metadata, err := config.GenerateMetadata(c) - if err != nil { - return err - } - - releaseMode, err := metadata.GetReleaseMode() - if err != nil { - return err - } - - version := metadata.GrafanaVersion - semver := versions.ParseSemver(version) - if releaseMode.Mode == config.Cronjob { - gcs, err := storage.New() - if err != nil { - return err - } - bucket := gcs.Bucket(bucketStr) - latestMainVersion, err := storage.GetLatestMainBuild(c.Context, bucket, filepath.Join(string(edition), "main")) - if err != nil { - return err - } - version = latestMainVersion - } - - dryRun := c.Bool("dry-run") - simulateRelease := c.Bool("simulate-release") - // Test release mode and dryRun imply simulateRelease - if releaseMode.IsTest || dryRun { - simulateRelease = true - } - - grafanaAPIKey := strings.TrimSpace(os.Getenv("GRAFANA_COM_API_KEY")) - if grafanaAPIKey == "" { - return cli.Exit("the environment variable GRAFANA_COM_API_KEY must be set", 1) - } - - pkgjson, err := getPackageJSON() - if err != nil { - return cli.Exit(err.Error(), 1) - } - - whatsNewURL, releaseNotesURL, err := getReleaseURLs(semver, pkgjson) - if err != nil { - return cli.Exit(err.Error(), 1) - } - - // TODO: Verify config values - cfg := packaging.PublishConfig{ - Config: config.Config{ - Version: version, - }, - Edition: edition, - ReleaseMode: releaseMode, - GrafanaAPIKey: grafanaAPIKey, - WhatsNewURL: whatsNewURL, - ReleaseNotesURL: releaseNotesURL, - DryRun: dryRun, - TTL: c.String("ttl"), - SimulateRelease: simulateRelease, - } - - if err := publishPackages(cfg); err != nil { - return cli.Exit(err.Error(), 1) - } - - log.Println("Successfully published packages to grafana.com!") - return nil -} - -type grafanaConf struct { - WhatsNewURL string `json:"whatsNewUrl"` - ReleaseNotesURL string `json:"releaseNotesUrl"` -} - -type packageConf struct { - Grafana grafanaConf `json:"grafana"` -} - -func getPackageJSON() (*packageConf, error) { - pkgB, err := os.ReadFile("package.json") - if err != nil { - return nil, fmt.Errorf("failed to read package.json: %w", err) - } - - var pconf packageConf - if err := json.Unmarshal(pkgB, &pconf); err != nil { - return nil, fmt.Errorf("failed to decode package.json: %w", err) - } - - return &pconf, nil -} - -func getReleaseURLs(semver versions.Semver, pconf *packageConf) (string, string, error) { - u := fmt.Sprintf(pconf.Grafana.WhatsNewURL, semver.Major, semver.Minor, semver.Patch) - if _, err := url.ParseRequestURI(u); err != nil { - return "", "", fmt.Errorf("grafana.whatsNewUrl is invalid in package.json: %q", pconf.Grafana.WhatsNewURL) - } - if _, err := url.ParseRequestURI(pconf.Grafana.ReleaseNotesURL); err != nil { - return "", "", fmt.Errorf("grafana.releaseNotesUrl is invalid in package.json: %q", - pconf.Grafana.ReleaseNotesURL) - } - - return u, pconf.Grafana.ReleaseNotesURL, nil -} - -func Builds(baseURL *url.URL, grafana, version string, packages []packaging.BuildArtifact) ([]GCOMPackage, error) { - builds := make([]GCOMPackage, len(packages)) - for i, v := range packages { - var ( - os = v.Distro - arch = v.Arch - ) - - if v.Distro == "windows" { - os = "win" - if v.Ext == "msi" { - os = "win-installer" - } - } - - if v.Distro == "rhel" { - if arch == "aarch64" { - arch = "arm64" - } - if arch == "x86_64" { - arch = "amd64" - } - } - - if v.Distro == "deb" { - if arch == "armhf" { - arch = "armv7" - if v.RaspberryPi { - log.Println(v.Distro, arch, "raspberrypi == true") - arch = "armv6" - } - } - } - - u := gcom.GetURL(baseURL, version, grafana, v.Distro, v.Arch, v.Ext, v.Musl, v.RaspberryPi) - builds[i] = GCOMPackage{ - OS: os, - URL: u.String(), - Arch: arch, - } - } - - return builds, nil -} - -// publishPackages publishes packages to grafana.com. -func publishPackages(cfg packaging.PublishConfig) error { - log.Printf("Publishing Grafana packages, version %s, %s edition, %s mode, dryRun: %v, simulating: %v...\n", - cfg.Version, cfg.Edition, cfg.ReleaseMode.Mode, cfg.DryRun, cfg.SimulateRelease) - - versionStr := fmt.Sprintf("v%s", cfg.Version) - log.Printf("Creating release %s at grafana.com...\n", versionStr) - - var ( - pth string - grafana = "grafana" - ) - - switch cfg.Edition { - case config.EditionOSS: - pth = "oss" - case config.EditionEnterprise: - grafana = "grafana-enterprise" - pth = "enterprise" - default: - return fmt.Errorf("unrecognized edition %q", cfg.Edition) - } - - switch cfg.ReleaseMode.Mode { - case config.MainMode, config.DownstreamMode, config.CronjobMode: - pth = path.Join(pth, packaging.MainFolder) - default: - pth = path.Join(pth, packaging.ReleaseFolder) - } - - pth = path.Join(pth) - baseArchiveURL := &url.URL{ - Scheme: "https", - Host: "dl.grafana.com", - Path: pth, - } - - builds, err := Builds(baseArchiveURL, grafana, cfg.Version, packaging.ArtifactConfigs) - if err != nil { - return err - } - - r := Release{ - Version: cfg.Version, - ReleaseDate: time.Now().UTC(), - Builds: builds, - Stable: cfg.ReleaseMode.Mode == config.TagMode && !cfg.ReleaseMode.IsPreview && !cfg.ReleaseMode.IsTest, - Beta: cfg.ReleaseMode.IsPreview, - Nightly: cfg.ReleaseMode.Mode == config.CronjobMode, - } - if cfg.ReleaseMode.Mode == config.TagMode || r.Beta { - r.WhatsNewURL = cfg.WhatsNewURL - r.ReleaseNotesURL = cfg.ReleaseNotesURL - } - - if err := postRequest(cfg, "versions", r, fmt.Sprintf("create release %s", r.Version)); err != nil { - return err - } - - if err := postRequest(cfg, fmt.Sprintf("versions/%s", cfg.Version), r, - fmt.Sprintf("update release %s", cfg.Version)); err != nil { - return err - } - - for i, v := range r.Builds { - sha, err := getSHA256(v.URL) - if err != nil { - return err - } - - r.Builds[i].SHA256 = string(sha) - } - - for _, b := range r.Builds { - if err := postRequest(cfg, fmt.Sprintf("versions/%s/packages", cfg.Version), b, - fmt.Sprintf("create build %s %s", b.OS, b.Arch)); err != nil { - return err - } - if err := postRequest(cfg, fmt.Sprintf("versions/%s/packages/%s/%s", cfg.Version, b.Arch, b.OS), b, - fmt.Sprintf("update build %s %s", b.OS, b.Arch)); err != nil { - return err - } - } - - return nil -} - -func getSHA256(u string) ([]byte, error) { - shaURL := fmt.Sprintf("%s.sha256", u) - - // nolint:gosec - resp, err := http.Get(shaURL) - if err != nil { - return nil, err - } - defer func() { - if err := resp.Body.Close(); err != nil { - log.Println("failed to close response body, err: %w", err) - } - }() - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return nil, fmt.Errorf("failed downloading %s: %s", u, resp.Status) - } - - sha256, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return sha256, nil -} - -func postRequest(cfg packaging.PublishConfig, pth string, body any, descr string) error { - var sfx string - switch cfg.Edition { - case config.EditionOSS: - case config.EditionEnterprise: - sfx = packaging.EnterpriseSfx - default: - return fmt.Errorf("unrecognized edition %q", cfg.Edition) - } - product := fmt.Sprintf("grafana%s", sfx) - - jsonB, err := json.Marshal(body) - if err != nil { - return fmt.Errorf("failed to JSON encode release: %w", err) - } - - u, err := constructURL(product, pth) - if err != nil { - return err - } - req, err := http.NewRequest(http.MethodPost, u, bytes.NewReader(jsonB)) - if err != nil { - return err - } - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", cfg.GrafanaAPIKey)) - req.Header.Add("Content-Type", "application/json") - - log.Printf("Posting to grafana.com API, %s - JSON: %s\n", u, string(jsonB)) - if cfg.SimulateRelease { - log.Println("Only simulating request") - return nil - } - - resp, err := httpClient.Do(req) - if err != nil { - return fmt.Errorf("failed posting to %s (%s): %s", u, descr, err) - } - defer func() { - if err := resp.Body.Close(); err != nil { - log.Println("failed to close response body, err: %w", err) - } - }() - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - body, err := io.ReadAll(resp.Body) - if err != nil { - return err - } - - if strings.Contains(string(body), "already exists") || strings.Contains(string(body), "Nothing to update") { - log.Printf("Already exists: %s\n", descr) - return nil - } - - return fmt.Errorf("failed posting to %s (%s): %s", u, descr, resp.Status) - } - - log.Printf("Successfully posted to grafana.com API, %s\n", u) - - return nil -} - -func constructURL(product string, pth string) (string, error) { - productPath := filepath.Clean(filepath.Join("/", product, pth)) - u, err := url.Parse(grafanaAPI) - if err != nil { - return "", err - } - u.Path = path.Join(u.Path, productPath) - return u.String(), err -} - -type GCOMPackage struct { - OS string `json:"os"` - URL string `json:"url"` - SHA256 string `json:"sha256"` - Arch string `json:"arch"` -} - -type Release struct { - Version string `json:"version"` - ReleaseDate time.Time `json:"releaseDate"` - Stable bool `json:"stable"` - Beta bool `json:"beta"` - Nightly bool `json:"nightly"` - WhatsNewURL string `json:"whatsNewUrl"` - ReleaseNotesURL string `json:"releaseNotesUrl"` - Builds []GCOMPackage `json:"-"` -} diff --git a/pkg/build/cmd/grafanacom_test.go b/pkg/build/cmd/grafanacom_test.go deleted file mode 100644 index 1b0eb0bcf20..00000000000 --- a/pkg/build/cmd/grafanacom_test.go +++ /dev/null @@ -1,284 +0,0 @@ -package main - -import ( - "fmt" - "net/url" - "path" - "testing" - - "github.com/grafana/grafana/pkg/build/packaging" - "github.com/grafana/grafana/pkg/build/versions" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func Test_constructURL(t *testing.T) { - type args struct { - product string - pth string - } - tests := []struct { - name string - args args - want string - wantErr bool - }{ - {name: "cleans .. sequence", args: args{"..", ".."}, want: "https://grafana.com/api", wantErr: false}, - {name: "doesn't clean anything - non malicious url", args: args{"foo", "bar"}, want: "https://grafana.com/api/foo/bar", wantErr: false}, - {name: "doesn't clean anything - three dots", args: args{"...", "..."}, want: "https://grafana.com/api/.../...", wantErr: false}, - {name: "cleans .", args: args{"..", ".."}, want: "https://grafana.com/api", wantErr: false}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := constructURL(tt.args.product, tt.args.pth) - if (err != nil) != tt.wantErr { - t.Errorf("constructURL() error = %v, wantErr %v", err, tt.wantErr) - return - } - if got != tt.want { - t.Errorf("constructURL() got = %v, want %v", got, tt.want) - } - }) - } -} - -func TestBuilds(t *testing.T) { - baseURL := &url.URL{ - Scheme: "https", - Host: "dl.example.com", - Path: path.Join("oss", "release"), - } - - version := "1.2.3" - grafana := "grafana" - packages := []packaging.BuildArtifact{ - { - Distro: "deb", - Arch: "arm64", - Ext: "deb", - }, - { - Distro: "rhel", - Arch: "aarch64", - Ext: "rpm", - }, - { - Distro: "linux", - Arch: "arm64", - Ext: "tar.gz", - }, - { - Distro: "deb", - Arch: "armhf", - Ext: "deb", - RaspberryPi: true, - }, - { - Distro: "deb", - Arch: "armhf", - Ext: "deb", - }, - { - Distro: "linux", - Arch: "armv7", - Ext: "tar.gz", - }, - { - Distro: "windows", - Arch: "amd64", - Ext: "zip", - }, - { - Distro: "windows", - Arch: "amd64", - Ext: "msi", - }, - } - - expect := []GCOMPackage{ - { - URL: "https://dl.example.com/oss/release/grafana_1.2.3_arm64.deb", - OS: "deb", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3-1.aarch64.rpm", - OS: "rhel", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3.linux-arm64.tar.gz", - OS: "linux", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-rpi_1.2.3_armhf.deb", - OS: "deb", - Arch: "armv6", - }, - { - URL: "https://dl.example.com/oss/release/grafana_1.2.3_armhf.deb", - OS: "deb", - Arch: "armv7", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3.linux-armv7.tar.gz", - OS: "linux", - Arch: "armv7", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3.windows-amd64.zip", - OS: "win", - Arch: "amd64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3.windows-amd64.msi", - OS: "win-installer", - Arch: "amd64", - }, - } - - builds, err := Builds(baseURL, grafana, version, packages) - require.NoError(t, err) - require.Equal(t, len(expect), len(builds)) - - for i := range builds { - t.Run(fmt.Sprintf("[%d/%d] %s", i+1, len(builds), expect[i].URL), func(t *testing.T) { - assert.Equal(t, expect[i].URL, builds[i].URL) - assert.Equal(t, expect[i].OS, builds[i].OS) - assert.Equal(t, expect[i].Arch, builds[i].Arch) - }) - } -} - -func TestBuildsWithPlus(t *testing.T) { - baseURL := &url.URL{ - Scheme: "https", - Host: "dl.example.com", - Path: path.Join("oss", "release"), - } - - version := "1.2.3+example-01" - grafana := "grafana" - packages := []packaging.BuildArtifact{ - { - Distro: "deb", - Arch: "arm64", - Ext: "deb", - }, - { - Distro: "rhel", - Arch: "aarch64", - Ext: "rpm", - }, - { - Distro: "linux", - Arch: "arm64", - Ext: "tar.gz", - }, - { - Distro: "deb", - Arch: "armhf", - Ext: "deb", - RaspberryPi: true, - }, - { - Distro: "deb", - Arch: "armhf", - Ext: "deb", - }, - { - Distro: "linux", - Arch: "armv7", - Ext: "tar.gz", - }, - { - Distro: "windows", - Arch: "amd64", - Ext: "zip", - }, - { - Distro: "windows", - Arch: "amd64", - Ext: "msi", - }, - } - - expect := []GCOMPackage{ - { - URL: "https://dl.example.com/oss/release/grafana_1.2.3+example~01_arm64.deb", - OS: "deb", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3+example~01-1.aarch64.rpm", - OS: "rhel", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3+example-01.linux-arm64.tar.gz", - OS: "linux", - Arch: "arm64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-rpi_1.2.3+example~01_armhf.deb", - OS: "deb", - Arch: "armv6", - }, - { - URL: "https://dl.example.com/oss/release/grafana_1.2.3+example~01_armhf.deb", - OS: "deb", - Arch: "armv7", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3+example-01.linux-armv7.tar.gz", - OS: "linux", - Arch: "armv7", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3+example-01.windows-amd64.zip", - OS: "win", - Arch: "amd64", - }, - { - URL: "https://dl.example.com/oss/release/grafana-1.2.3+example-01.windows-amd64.msi", - OS: "win-installer", - Arch: "amd64", - }, - } - - builds, err := Builds(baseURL, grafana, version, packages) - require.NoError(t, err) - require.Equal(t, len(expect), len(builds)) - - for i := range builds { - t.Run(fmt.Sprintf("[%d/%d] %s", i+1, len(builds), expect[i].URL), func(t *testing.T) { - assert.Equal(t, expect[i].URL, builds[i].URL) - assert.Equal(t, expect[i].OS, builds[i].OS) - assert.Equal(t, expect[i].Arch, builds[i].Arch) - }) - } -} - -func TestReleaseURLs(t *testing.T) { - f := "https://grafana.com/whats-new-in-v%[1]s-%[2]s" - - smv := versions.Semver{ - Major: "1", - Minor: "2", - Patch: "3", - } - - conf := packageConf{ - Grafana: grafanaConf{ - WhatsNewURL: f, - ReleaseNotesURL: "https://example.com", - }, - } - - expect := "https://grafana.com/whats-new-in-v1-2" - - a, _, err := getReleaseURLs(smv, &conf) - require.NoError(t, err) - require.Equal(t, expect, a) -} diff --git a/pkg/build/cmd/main.go b/pkg/build/cmd/main.go index 8b2152c42a5..3fb66dfd67e 100644 --- a/pkg/build/cmd/main.go +++ b/pkg/build/cmd/main.go @@ -4,18 +4,9 @@ import ( "log" "os" - "github.com/grafana/grafana/pkg/build/cmd/util" "github.com/grafana/grafana/pkg/build/daggerbuild/cmd" - "github.com/urfave/cli/v2" ) -var additionalCommands []*cli.Command = make([]*cli.Command, 0, 5) - -//nolint:unused -func registerAppCommand(c *cli.Command) { - additionalCommands = append(additionalCommands, c) -} - func main() { // TODO change the registerer if the user is running using a JSON file etc for k, v := range cmd.Artifacts { @@ -25,272 +16,6 @@ func main() { } app := cmd.GlobalCLI.App() - artifactsCommand := cmd.GlobalCLI.ArtifactsCommand() - artifactsCommand.Subcommands = cli.Commands{ - { - Name: "storybook", - Usage: "[ARCHIVED] Publish Grafana storybook", - Action: PublishStorybookAction, - Flags: []cli.Flag{ - &editionFlag, - &tagFlag, - &srcFlag, - &cli.StringFlag{ - Name: "storybook-bucket", - Value: "grafana-storybook", - Usage: "Google Cloud Storage bucket for storybooks", - }, - }, - }, - { - Name: "static-assets", - Usage: "[ARCHIVED] Publish Grafana static assets", - Action: PublishStaticAssetsAction, - Flags: []cli.Flag{ - &editionFlag, - &securityFlag, - &securityDestBucketFlag, - &tagFlag, - &srcFlag, - &destFlag, - &cli.StringFlag{ - Name: "static-assets-bucket", - Value: "grafana-static-assets", - Usage: "Google Cloud Storage bucket for static assets", - }, - &cli.StringSliceFlag{ - Name: "static-asset-editions", - Usage: "All the editions of the static assets (or $STATIC_ASSET_EDITIONS)", - }, - }, - }, - { - Name: "packages", - Usage: "[ARCHIVED] Publish Grafana packages", - Action: PublishArtifactsAction, - Flags: []cli.Flag{ - &editionFlag, - &securityFlag, - &securityDestBucketFlag, - &tagFlag, - &srcFlag, - &destFlag, - &cli.StringSliceFlag{ - Name: "artifacts-editions", - Value: cli.NewStringSlice("oss", "enterprise", "enterprise2"), - Usage: "Editions for which the artifacts should be delivered (oss,enterprise,enterprise2), (or $ARTIFACTS_EDITIONS)", - }, - &cli.StringFlag{ - Name: "enterprise2-dest-bucket", - Value: "grafana-downloads-enterprise2", - Usage: "Google Cloud Storage bucket for published packages", - }, - &cli.StringFlag{ - Name: "enterprise2-security-prefix", - Usage: "Bucket path prefix for enterprise2 security releases (or $ENTERPRISE2_SECURITY_PREFIX)", - }, - }, - }, - { - Name: "docker", - Usage: "[ARCHIVED] Handle Grafana Docker images", - Subcommands: cli.Commands{ - { - Name: "fetch", - Usage: "Fetch Grafana Docker images", - ArgsUsage: "[version]", - Action: util.MaxArgCountWrapper(1, FetchImages), - Flags: []cli.Flag{ - &editionFlag, - }, - }, - }, - }, - { - Name: "npm", - Usage: "[ARCHIVED] Handle Grafana npm packages", - Subcommands: cli.Commands{ - { - Name: "release", - Usage: "Release npm packages", - ArgsUsage: "[version]", - Action: NpmReleaseAction, - Flags: []cli.Flag{ - &tagFlag, - }, - }, - { - Name: "store", - Usage: "Store npm packages tarball", - Action: NpmStoreAction, - Flags: []cli.Flag{ - &tagFlag, - }, - }, - { - Name: "retrieve", - Usage: "Retrieve npm packages tarball", - Action: NpmRetrieveAction, - Flags: []cli.Flag{ - &tagFlag, - }, - }, - }, - }, - } - app.Commands = append(app.Commands, []*cli.Command{ - { - Name: "e2e-tests", - Usage: "[ARCHIVED] Run Grafana e2e tests", - Action: EndToEndTests, - Flags: []cli.Flag{ - &triesFlag, - &cli.IntFlag{ - Name: "port", - Value: 3001, - Usage: "Specify the server port", - }, - &cli.StringFlag{ - Name: "suite", - Usage: "Specify the end-to-end tests suite to be used", - }, - &cli.StringFlag{ - Name: "host", - Value: "grafana-server", - Usage: "Specify the server host", - }, - &cli.StringFlag{ - Name: "video", - Value: "true", - Usage: "Specify if videos should be recorded", - }, - }, - }, - { - Name: "upload-cdn", - Usage: "[ARCHIVED] Upload public/* to a cdn bucket", - Action: UploadCDN, - Flags: []cli.Flag{ - &editionFlag, - }, - }, - { - Name: "publish-metrics", - Usage: "[ARCHIVED] Publish a set of metrics from stdin", - ArgsUsage: "", - Action: util.MaxArgCountWrapper(1, PublishMetrics), - }, - { - Name: "verify-drone", - Usage: "[ARCHIVED] Verify Drone configuration", - Action: VerifyDrone, - }, - { - Name: "store-storybook", - Usage: "[ARCHIVED] Stores storybook to GCS buckets", - Action: StoreStorybook, - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "deployment", - Usage: "Kind of deployment (e.g. canary/latest)", - }, - }, - }, - { - Name: "verify-storybook", - Usage: "[ARCHIVED] Integrity check for storybook build", - Action: VerifyStorybook, - }, - { - Name: "upload-packages", - Usage: "[ARCHIVED] Upload Grafana packages", - Action: UploadPackages, - Flags: []cli.Flag{ - &jobsFlag, - &editionFlag, - &cli.BoolFlag{ - Name: "enterprise2", - Usage: "Declare if the edition is enterprise2", - }, - }, - }, - artifactsCommand, - { - Name: "publish", - Usage: "[ARCHIVED] Publish packages to Grafana com and repositories", - Subcommands: cli.Commands{ - { - Name: "grafana-com", - Usage: "Publish packages to grafana.com", - Action: GrafanaCom, - Flags: []cli.Flag{ - &editionFlag, - &buildIDFlag, - &util.DryRunFlag, - &cli.StringFlag{ - Name: "src-bucket", - Value: "grafana-downloads", - Usage: "Google Cloud Storage bucket", - }, - }, - }, - { - Name: "github", - Usage: "Publish packages to GitHub releases", - Action: PublishGithub, - Flags: []cli.Flag{ - &util.DryRunFlag, - &cli.StringFlag{ - Name: "path", - Usage: "Path to the asset to be published", - }, - &cli.StringFlag{ - Name: "repo", - Required: true, - Usage: "GitHub repository", - }, - &cli.StringFlag{ - Name: "tag", - Usage: "Release tag (default from metadata)", - }, - &cli.BoolFlag{ - Name: "create", - Usage: "Create release if it doesn't exist", - }, - }, - }, - { - Name: "aws", - Usage: "Publish image to AWS Marketplace releases", - Action: PublishAwsMarketplace, - Flags: []cli.Flag{ - &util.DryRunFlag, - &cli.StringFlag{ - Name: "version", - Usage: "Release version (default from metadata)", - }, - &cli.StringFlag{ - Name: "image", - Required: true, - Usage: "Name of the image to be released", - }, - &cli.StringFlag{ - Name: "repo", - Required: true, - Usage: "AWS Marketplace ECR repository", - }, - &cli.StringFlag{ - Name: "product", - Required: true, - Usage: "AWS Marketplace product identifier", - }, - }, - }, - }, - }, - }...) - - app.Commands = append(app.Commands, additionalCommands...) if err := app.Run(os.Args); err != nil { log.Fatalln(err) diff --git a/pkg/build/cmd/npm.go b/pkg/build/cmd/npm.go deleted file mode 100644 index 4660b22b636..00000000000 --- a/pkg/build/cmd/npm.go +++ /dev/null @@ -1,98 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os" - "strings" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/npm" -) - -func NpmRetrieveAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - tag := c.String("tag") - if tag == "" { - return fmt.Errorf("no tag version specified, exitting") - } - - if strings.Contains(tag, "security") { - log.Printf("skipping npm publish because version '%s' has 'security'", tag) - return nil - } - - prereleaseBucket := strings.TrimSpace(os.Getenv("PRERELEASE_BUCKET")) - if prereleaseBucket == "" { - return cli.Exit("the environment variable PRERELEASE_BUCKET must be set", 1) - } - - err := npm.FetchNpmPackages(c.Context, tag, prereleaseBucket) - if err != nil { - return err - } - return nil -} - -func NpmStoreAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - tag := c.String("tag") - if tag == "" { - return fmt.Errorf("no tag version specified, exiting") - } - - if strings.Contains(tag, "security") { - log.Printf("skipping npm publish because version '%s' has 'security'", tag) - return nil - } - - prereleaseBucket := strings.TrimSpace(os.Getenv("PRERELEASE_BUCKET")) - if prereleaseBucket == "" { - return cli.Exit("the environment variable PRERELEASE_BUCKET must be set", 1) - } - - err := npm.StoreNpmPackages(c.Context, tag, prereleaseBucket) - if err != nil { - return err - } - return nil -} - -func NpmReleaseAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - tag := c.String("tag") - if tag == "" { - return fmt.Errorf("no tag version specified, exitting") - } - - if strings.Contains(tag, "security") { - log.Printf("skipping npm publish because version '%s' has 'security'", tag) - return nil - } - - err := npm.PublishNpmPackages(c.Context, tag) - if err != nil { - return err - } - - return nil -} diff --git a/pkg/build/cmd/publishartifacts.go b/pkg/build/cmd/publishartifacts.go deleted file mode 100644 index bf3f162e362..00000000000 --- a/pkg/build/cmd/publishartifacts.go +++ /dev/null @@ -1,112 +0,0 @@ -package main - -import ( - "fmt" - "log" - "path/filepath" - "strings" - - "github.com/grafana/grafana/pkg/build/env" - "github.com/grafana/grafana/pkg/build/gcloud" - "github.com/grafana/grafana/pkg/build/gcloud/storage" - "github.com/urfave/cli/v2" -) - -// PublishArtifactsAction Action implements the sub-command "publish-artifacts". -func PublishArtifactsAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - security := c.Bool("security") - var securityDestBucket, enterprise2SecurityPrefix string - - artifactsEditions, err := env.RequireListWithEnvFallback(c, "artifacts-editions", "ARTIFACTS_EDITIONS") - if err != nil { - return err - } - - if security { - securityDestBucket, err = env.RequireStringWithEnvFallback(c, "security-dest-bucket", "SECURITY_DEST_BUCKET") - if err != nil { - return err - } - enterprise2SecurityPrefix, err = env.RequireStringWithEnvFallback(c, "enterprise2-security-prefix", "ENTERPRISE2_SECURITY_PREFIX") - if err != nil { - return err - } - } - - if err := gcloud.ActivateServiceAccount(); err != nil { - return fmt.Errorf("error connecting to gcp, %q", err) - } - - cfg := publishConfig{ - srcBucket: c.String("src-bucket"), - destBucket: c.String("dest-bucket"), - enterprise2DestBucket: c.String("enterprise2-dest-bucket"), - enterprise2SecurityPrefix: enterprise2SecurityPrefix, - security: security, - tag: strings.TrimPrefix(c.String("tag"), "v"), - } - - if cfg.security { - cfg.destBucket = securityDestBucket - } - - gcs, err := storage.New() - if err != nil { - return err - } - - for _, edition := range artifactsEditions { - switch edition { - case "oss", "enterprise": - err = copyArtifacts(c, gcs, cfg, edition) - if err != nil { - return err - } - case "enterprise2": - err = copyEnterprise2Artifacts(c, gcs, cfg) - if err != nil { - return err - } - default: - log.Printf("unrecognised artifacts edition: %s\n", edition) - } - } - - return nil -} - -func copyArtifacts(c *cli.Context, gcs *storage.Client, cfg publishConfig, edition string) error { - bucket := gcs.Bucket(cfg.destBucket) - destURL := edition - if !cfg.security { - destURL = filepath.Join(destURL, "release") - } - log.Printf("Copying downloads for %s, from %s bucket to %s bucket", edition, cfg.srcBucket, destURL) - if err := gcs.CopyRemoteDir(c.Context, gcs.Bucket(cfg.srcBucket), fmt.Sprintf("artifacts/downloads/v%s/%s/release", cfg.tag, edition), bucket, destURL); err != nil { - return err - } - - log.Printf("Successfully copied downloads.") - return nil -} - -func copyEnterprise2Artifacts(c *cli.Context, gcs *storage.Client, cfg publishConfig) error { - bucket := gcs.Bucket(cfg.enterprise2DestBucket) - var prefix string - if cfg.security { - prefix = cfg.enterprise2SecurityPrefix - } - destURL := fmt.Sprintf("enterprise2/%srelease", prefix) - log.Printf("Copying downloads for enterprise2, from %s bucket to %s bucket", cfg.srcBucket, destURL) - if err := gcs.CopyRemoteDir(c.Context, gcs.Bucket(cfg.srcBucket), fmt.Sprintf("artifacts/downloads-enterprise2/v%s/enterprise2/release", cfg.tag), bucket, destURL); err != nil { - return err - } - return nil -} diff --git a/pkg/build/cmd/publishaws.go b/pkg/build/cmd/publishaws.go deleted file mode 100644 index f48f821a0ed..00000000000 --- a/pkg/build/cmd/publishaws.go +++ /dev/null @@ -1,310 +0,0 @@ -package main - -import ( - "context" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "io" - "os" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ecr" - "github.com/aws/aws-sdk-go/service/marketplacecatalog" - "github.com/docker/docker/api/types/image" - "github.com/docker/docker/api/types/registry" - "github.com/docker/docker/client" - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" -) - -const ( - marketplaceChangeSetName = "Add new version" - marketplaceCatalogId = "AWSMarketplace" - marketplaceRegistryId = "709825985650" - marketplaceRegistryRegion = "us-east-1" - marketplaceRegistryUrl = "709825985650.dkr.ecr.us-east-1.amazonaws.com" - marketplaceRequestsUrl = "https://aws.amazon.com/marketplace/management/requests/" - releaseNotesTemplateUrl = "https://grafana.com/docs/grafana/latest/release-notes/release-notes-${TAG}/" - helmChartsUrl = "https://grafana.github.io/helm-charts/" - docsUrl = "https://grafana.com/docs/grafana/latest/enterprise/license/" - imagePlatform = "linux/amd64" - - publishAwsMarketplaceTestKey publishAwsMarketplaceTestKeyType = "test-client" -) - -var ( - errEmptyVersion = errors.New(`failed to retrieve release version from metadata, use "--version" to set it manually`) -) - -type publishAwsMarketplaceTestKeyType string - -type publishAwsMarketplaceFlags struct { - dryRun bool - version string - repo string - image string - product string -} - -type AwsMarketplacePublishingService struct { - auth string - docker AwsMarketplaceDocker - ecr AwsMarketplaceRegistry - mkt AwsMarketplaceCatalog -} - -type AwsMarketplaceDocker interface { - ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error) - ImageTag(ctx context.Context, source string, target string) error - ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) -} - -type AwsMarketplaceRegistry interface { - GetAuthorizationTokenWithContext(ctx context.Context, input *ecr.GetAuthorizationTokenInput, opts ...request.Option) (*ecr.GetAuthorizationTokenOutput, error) -} - -type AwsMarketplaceCatalog interface { - DescribeEntityWithContext(ctx context.Context, input *marketplacecatalog.DescribeEntityInput, opts ...request.Option) (*marketplacecatalog.DescribeEntityOutput, error) - StartChangeSetWithContext(ctx context.Context, input *marketplacecatalog.StartChangeSetInput, opts ...request.Option) (*marketplacecatalog.StartChangeSetOutput, error) -} - -func PublishAwsMarketplace(ctx *cli.Context) error { - f, err := getPublishAwsMarketplaceFlags(ctx) - if err != nil { - return err - } - - if f.version == "" { - return errEmptyVersion - } - - svc, err := getAwsMarketplacePublishingService() - if err != nil { - return err - } - - if ctx.Context.Value(publishAwsMarketplaceTestKey) != nil { - svc = ctx.Context.Value(publishAwsMarketplaceTestKey).(*AwsMarketplacePublishingService) - } - - fmt.Println("Logging in to AWS Marketplace registry") - err = svc.Login(ctx.Context) - if err != nil { - return err - } - - fmt.Printf("Retrieving image '%s:%s' from Docker Hub\n", f.image, f.version) - err = svc.PullImage(ctx.Context, f.image, f.version) - if err != nil { - return err - } - - fmt.Printf("Renaming image '%s:%s' to '%s/%s:%s'\n", f.image, f.version, marketplaceRegistryUrl, f.repo, f.version) - err = svc.TagImage(ctx.Context, f.image, f.repo, f.version) - if err != nil { - return err - } - - if !f.dryRun { - fmt.Printf("Pushing image '%s/%s:%s' to the AWS Marketplace ECR\n", marketplaceRegistryUrl, f.repo, f.version) - err = svc.PushToMarketplace(ctx.Context, f.repo, f.version) - if err != nil { - return err - } - } else { - fmt.Printf("Dry-Run: Pushing image '%s/%s:%s' to the AWS Marketplace ECR\n", marketplaceRegistryUrl, f.repo, f.version) - } - - fmt.Printf("Retrieving product identifier for product '%s'\n", f.product) - pid, err := svc.GetProductIdentifier(ctx.Context, f.product) - if err != nil { - return err - } - - if !f.dryRun { - fmt.Printf("Releasing to product, you can view the progress of the release on %s\n", marketplaceRequestsUrl) - return svc.ReleaseToProduct(ctx.Context, pid, f.repo, f.version) - } else { - fmt.Printf("Dry-Run: Releasing to product, you can view the progress of the release on %s\n", marketplaceRequestsUrl) - } - - return nil -} - -func getAwsMarketplacePublishingService() (*AwsMarketplacePublishingService, error) { - cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) - if err != nil { - return nil, err - } - - mySession := session.Must(session.NewSession()) - ecr := ecr.New(mySession, aws.NewConfig().WithRegion(marketplaceRegistryRegion)) - mkt := marketplacecatalog.New(mySession, aws.NewConfig().WithRegion(marketplaceRegistryRegion)) - return &AwsMarketplacePublishingService{ - docker: cli, - ecr: ecr, - mkt: mkt, - }, nil -} - -func (s *AwsMarketplacePublishingService) Login(ctx context.Context) error { - out, err := s.ecr.GetAuthorizationTokenWithContext(ctx, &ecr.GetAuthorizationTokenInput{}) - if err != nil { - return err - } - s.auth = *out.AuthorizationData[0].AuthorizationToken - authData, err := base64.StdEncoding.DecodeString(s.auth) - if err != nil { - return err - } - authString := strings.Split(string(authData), ":") - authData, err = json.Marshal(registry.AuthConfig{ - Username: authString[0], - Password: authString[1], - }) - s.auth = base64.StdEncoding.EncodeToString(authData) - return err -} - -func (s *AwsMarketplacePublishingService) PullImage(ctx context.Context, img string, version string) error { - reader, err := s.docker.ImagePull(ctx, fmt.Sprintf("%s:%s", img, version), image.PullOptions{ - Platform: imagePlatform, - }) - if err != nil { - return err - } - - _, err = io.Copy(os.Stdout, reader) - if err != nil { - return err - } - - err = reader.Close() - if err != nil { - return err - } - return nil -} - -func (s *AwsMarketplacePublishingService) TagImage(ctx context.Context, image string, repo string, version string) error { - err := s.docker.ImageTag(ctx, fmt.Sprintf("%s:%s", image, version), fmt.Sprintf("%s/%s:%s", marketplaceRegistryUrl, repo, version)) - if err != nil { - return err - } - return nil -} - -func (s *AwsMarketplacePublishingService) PushToMarketplace(ctx context.Context, repo string, version string) error { - reader, err := s.docker.ImagePush(ctx, fmt.Sprintf("%s/%s:%s", marketplaceRegistryUrl, repo, version), image.PushOptions{ - RegistryAuth: s.auth, - }) - if err != nil { - return err - } - - _, err = io.Copy(os.Stdout, reader) - if err != nil { - return err - } - - err = reader.Close() - if err != nil { - return err - } - return nil -} - -func (s *AwsMarketplacePublishingService) GetProductIdentifier(ctx context.Context, product string) (string, error) { - out, err := s.mkt.DescribeEntityWithContext(ctx, &marketplacecatalog.DescribeEntityInput{ - EntityId: aws.String(product), - Catalog: aws.String(marketplaceCatalogId), - }) - if err != nil { - return "", err - } - return *out.EntityIdentifier, nil -} - -func (s *AwsMarketplacePublishingService) ReleaseToProduct(ctx context.Context, pid string, repo string, version string) error { - _, err := s.mkt.StartChangeSetWithContext(ctx, &marketplacecatalog.StartChangeSetInput{ - Catalog: aws.String(marketplaceCatalogId), - ChangeSetName: aws.String(marketplaceChangeSetName), - ChangeSet: []*marketplacecatalog.Change{ - buildAwsMarketplaceChangeSet(pid, repo, version), - }, - }) - return err -} - -func getPublishAwsMarketplaceFlags(ctx *cli.Context) (*publishAwsMarketplaceFlags, error) { - metadata, err := config.GenerateMetadata(ctx) - if err != nil { - return nil, err - } - version := ctx.String("version") - if version == "" && metadata.GrafanaVersion != "" { - version = metadata.GrafanaVersion - } - image := ctx.String("image") - repo := ctx.String("repo") - product := ctx.String("product") - dryRun := ctx.Bool("dry-run") - return &publishAwsMarketplaceFlags{ - dryRun: dryRun, - version: version, - image: image, - repo: repo, - product: product, - }, nil -} - -func buildAwsMarketplaceReleaseNotesUrl(version string) string { - sanitizedVersion := strings.ReplaceAll(version, ".", "-") - return strings.ReplaceAll(releaseNotesTemplateUrl, "${TAG}", sanitizedVersion) -} - -func buildAwsMarketplaceChangeSet(entityId string, repo string, version string) *marketplacecatalog.Change { - return &marketplacecatalog.Change{ - ChangeType: aws.String("AddDeliveryOptions"), - Entity: &marketplacecatalog.Entity{ - Type: aws.String("ContainerProduct@1.0"), - Identifier: aws.String(entityId), - }, - Details: aws.String(buildAwsMarketplaceVersionDetails(repo, version)), - } -} - -func buildAwsMarketplaceVersionDetails(repo string, version string) string { - releaseNotesUrl := buildAwsMarketplaceReleaseNotesUrl(version) - return fmt.Sprintf(`{ - "Version": { - "ReleaseNotes": "Release notes are available on the website %s", - "VersionTitle": "v%s" - }, - "DeliveryOptions": [ - { - "Details": { - "EcrDeliveryOptionDetails": { - "DeploymentResources": [ - { - "Name": "Helm Charts", - "Url": "%s" - } - ], - "CompatibleServices": ["EKS", "ECS", "ECS-Anywhere", "EKS-Anywhere"], - "ContainerImages": ["%s/%s:%s"], - "Description": "Grafana Enterprise can be installed using the official Grafana Helm chart repository. The repository is available on Github: %s", - "UsageInstructions": "You can apply your Grafana Enterprise license to a new or existing Grafana Enterprise deployment by updating a configuration setting or environment variable. Your Grafana instance must be deployed on AWS, or have network access to AWS. For more information, see %s" - } - }, - "DeliveryOptionTitle": "Helm Chart" - } - ] - }`, releaseNotesUrl, version, helmChartsUrl, marketplaceRegistryUrl, repo, version, helmChartsUrl, docsUrl) -} diff --git a/pkg/build/cmd/publishaws_test.go b/pkg/build/cmd/publishaws_test.go deleted file mode 100644 index af3782b1571..00000000000 --- a/pkg/build/cmd/publishaws_test.go +++ /dev/null @@ -1,211 +0,0 @@ -package main - -import ( - "bytes" - "context" - "encoding/base64" - "errors" - "io" - "os" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/ecr" - "github.com/aws/aws-sdk-go/service/marketplacecatalog" - "github.com/docker/docker/api/types/image" - "github.com/grafana/grafana/pkg/build/cmd/util" - "github.com/stretchr/testify/assert" - "github.com/urfave/cli/v2" -) - -type awsPublishTestCase struct { - name string - args []string - expectedError error - errorContains string - expectedOutput string - mockedService *AwsMarketplacePublishingService -} - -func TestPublishAwsMarketplace(t *testing.T) { - t.Setenv("DRONE_BUILD_EVENT", "promote") - t.Setenv("DRONE_TAG", "v1.0.0") - t.Setenv("DRONE_COMMIT", "abcdefgh") - testApp := setupPublishAwsMarketplaceTests(t) - errShouldNotCallMock := errors.New("shouldn't call") - - testCases := []awsPublishTestCase{ - { - name: "try to publish without required flags", - errorContains: `Required flags "image, repo, product" not set`, - }, - { - name: "try to publish without credentials", - args: []string{"--image", "test/test", "--repo", "test/test", "--product", "test", "--version", "1.0.0"}, - mockedService: &AwsMarketplacePublishingService{ - ecr: &mockAwsMarketplaceRegistry{ - GetAuthorizationTokenWithContextError: credentials.ErrNoValidProvidersFoundInChain, - }, - }, - expectedError: credentials.ErrNoValidProvidersFoundInChain, - }, - { - name: "try to publish with valid credentials and nonexisting version", - args: []string{"--image", "test/test", "--repo", "test/test", "--product", "test", "--version", "1.0.0"}, - mockedService: &AwsMarketplacePublishingService{ - ecr: &mockAwsMarketplaceRegistry{}, - docker: &mockAwsMarketplaceDocker{}, - mkt: &mockAwsMarketplaceCatalog{}, - }, - expectedOutput: "Releasing to product", - }, - { - name: "try to publish with valid credentials and existing version", - args: []string{"--image", "test/test", "--repo", "test/test", "--product", "test", "--version", "1.0.0"}, - mockedService: &AwsMarketplacePublishingService{ - ecr: &mockAwsMarketplaceRegistry{}, - docker: &mockAwsMarketplaceDocker{}, - mkt: &mockAwsMarketplaceCatalog{}, - }, - expectedOutput: "Releasing to product", - }, - { - name: "dry run with invalid credentials", - args: []string{"--dry-run", "--image", "test/test", "--repo", "test/test", "--product", "test", "--version", "1.0.0"}, - mockedService: &AwsMarketplacePublishingService{ - ecr: &mockAwsMarketplaceRegistry{ - GetAuthorizationTokenWithContextError: credentials.ErrNoValidProvidersFoundInChain, - }, - }, - expectedError: credentials.ErrNoValidProvidersFoundInChain, - }, - { - name: "dry run with valid credentials", - args: []string{"--dry-run", "--image", "test/test", "--repo", "test/test", "--product", "test", "--version", "1.0.0"}, - mockedService: &AwsMarketplacePublishingService{ - ecr: &mockAwsMarketplaceRegistry{}, - docker: &mockAwsMarketplaceDocker{ - ImagePushError: errShouldNotCallMock, - }, - mkt: &mockAwsMarketplaceCatalog{ - StartChangeSetWithContextError: errShouldNotCallMock, - }, - }, - expectedOutput: "Dry-Run: Releasing to product", - }, - } - - if os.Getenv("DRONE_COMMIT") == "" { - // this test only works locally due to Drone environment - testCases = append(testCases, - awsPublishTestCase{ - name: "try to publish without version", - args: []string{"--image", "test/test", "--repo", "test/test", "--product", "test"}, - expectedError: errEmptyVersion, - }, - ) - } - - for _, test := range testCases { - t.Run(test.name, func(t *testing.T) { - ctx := context.WithValue(context.Background(), publishAwsMarketplaceTestKey, test.mockedService) - args := []string{"run"} - args = append(args, test.args...) - out, err := captureStdout(t, func() error { - return testApp.RunContext(ctx, args) - }) - if test.expectedOutput != "" { - assert.Contains(t, out, test.expectedOutput) - } - if test.expectedError != nil || test.errorContains != "" { - assert.Error(t, err) - if test.expectedError != nil { - assert.ErrorIs(t, err, test.expectedError) - } - if test.errorContains != "" { - assert.ErrorContains(t, err, test.errorContains) - } - } else { - assert.NoError(t, err) - } - }) - } -} - -func setupPublishAwsMarketplaceTests(t *testing.T) *cli.App { - t.Helper() - testApp := cli.NewApp() - testApp.Action = PublishAwsMarketplace - testApp.Flags = []cli.Flag{ - &util.DryRunFlag, - &cli.StringFlag{ - Name: "version", - Usage: "Release version (default from metadata)", - }, - &cli.StringFlag{ - Name: "image", - Required: true, - Usage: "Name of the image to be released", - }, - &cli.StringFlag{ - Name: "repo", - Required: true, - Usage: "AWS Marketplace ECR repository", - }, - &cli.StringFlag{ - Name: "product", - Required: true, - Usage: "AWS Marketplace product identifier", - }, - } - return testApp -} - -type mockAwsMarketplaceDocker struct { - ImagePullError error - ImageTagError error - ImagePushError error -} - -func (m *mockAwsMarketplaceDocker) ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error) { - return io.NopCloser(bytes.NewReader([]byte(""))), m.ImagePullError -} - -func (m *mockAwsMarketplaceDocker) ImageTag(ctx context.Context, source string, target string) error { - return m.ImageTagError -} - -func (m *mockAwsMarketplaceDocker) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) { - return io.NopCloser(bytes.NewReader([]byte(""))), m.ImagePushError -} - -type mockAwsMarketplaceRegistry struct { - GetAuthorizationTokenWithContextError error -} - -func (m *mockAwsMarketplaceRegistry) GetAuthorizationTokenWithContext(ctx context.Context, input *ecr.GetAuthorizationTokenInput, opts ...request.Option) (*ecr.GetAuthorizationTokenOutput, error) { - return &ecr.GetAuthorizationTokenOutput{ - AuthorizationData: []*ecr.AuthorizationData{ - { - AuthorizationToken: aws.String(base64.StdEncoding.EncodeToString([]byte("username:password"))), - }, - }, - }, m.GetAuthorizationTokenWithContextError -} - -type mockAwsMarketplaceCatalog struct { - DescribeEntityWithContextError error - StartChangeSetWithContextError error -} - -func (m *mockAwsMarketplaceCatalog) DescribeEntityWithContext(ctx context.Context, input *marketplacecatalog.DescribeEntityInput, opts ...request.Option) (*marketplacecatalog.DescribeEntityOutput, error) { - return &marketplacecatalog.DescribeEntityOutput{ - EntityIdentifier: aws.String("productid"), - }, m.DescribeEntityWithContextError -} - -func (m *mockAwsMarketplaceCatalog) StartChangeSetWithContext(ctx context.Context, input *marketplacecatalog.StartChangeSetInput, opts ...request.Option) (*marketplacecatalog.StartChangeSetOutput, error) { - return &marketplacecatalog.StartChangeSetOutput{}, m.StartChangeSetWithContextError -} diff --git a/pkg/build/cmd/publishconfig.go b/pkg/build/cmd/publishconfig.go deleted file mode 100644 index 4715fce25e7..00000000000 --- a/pkg/build/cmd/publishconfig.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -type publishConfig struct { - tag string - srcBucket string - destBucket string - enterprise2DestBucket string - enterprise2SecurityPrefix string - staticAssetsBucket string - staticAssetEditions []string - storybookBucket string - security bool -} diff --git a/pkg/build/cmd/publishgithub.go b/pkg/build/cmd/publishgithub.go deleted file mode 100644 index 86dcc714fc7..00000000000 --- a/pkg/build/cmd/publishgithub.go +++ /dev/null @@ -1,191 +0,0 @@ -package main - -import ( - "context" - "errors" - "fmt" - "os" - "path" - "strings" - - "github.com/google/go-github/v70/github" - "github.com/urfave/cli/v2" - "golang.org/x/oauth2" - - "github.com/grafana/grafana/pkg/build/config" -) - -type githubRepositoryService interface { - GetReleaseByTag(ctx context.Context, owner string, repo string, tag string) (*github.RepositoryRelease, *github.Response, error) - CreateRelease(ctx context.Context, owner string, repo string, release *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) - UploadReleaseAsset(ctx context.Context, owner string, repo string, id int64, opt *github.UploadOptions, file *os.File) (*github.ReleaseAsset, *github.Response, error) - DeleteReleaseAsset(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) - ListReleaseAssets(ctx context.Context, owner string, repo string, id int64, opt *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error) -} - -type githubRepo struct { - owner string - name string -} - -type publishGithubFlags struct { - create bool - dryRun bool - tag string - repo *githubRepo - artifactPath string -} - -var ( - newGithubClient = githubRepositoryClient - errTokenIsEmpty = errors.New("the environment variable GH_TOKEN must be set") - errTagIsEmpty = errors.New(`failed to retrieve release tag from metadata, use "--tag" to set it manually`) - errReleaseNotFound = errors.New(`release not found, use "--create" to create the release`) -) - -func PublishGithub(c *cli.Context) error { - ctx := c.Context - token := os.Getenv("GH_TOKEN") - f, err := getPublishGithubFlags(c) - if err != nil { - return err - } - - if f.tag == "" { - return errTagIsEmpty - } - - if token == "" { - return errTokenIsEmpty - } - - if f.dryRun { - return runPublishGithubDryRun(f, token, c) - } - - client := newGithubClient(ctx, token) - release, res, err := client.GetReleaseByTag(ctx, f.repo.owner, f.repo.name, f.tag) - if err != nil && res.StatusCode != 404 { - return err - } - - if release == nil { - if f.create { - release, _, err = client.CreateRelease(ctx, f.repo.owner, f.repo.name, &github.RepositoryRelease{TagName: &f.tag}) - if err != nil { - return err - } - } else { - return errReleaseNotFound - } - } - - artifactName := path.Base(f.artifactPath) - file, err := os.Open(f.artifactPath) - if err != nil { - return err - } - - assetsPage := 1 - foundAsset := false - for { - assets, resp, err := client.ListReleaseAssets(ctx, f.repo.owner, f.repo.name, *release.ID, &github.ListOptions{ - Page: assetsPage, - }) - if err != nil { - return err - } - for _, asset := range assets { - if asset.GetName() == artifactName { - fmt.Printf("Found existing artifact with the name '%s'. Deleting that now.\n", artifactName) - if _, err := client.DeleteReleaseAsset(ctx, f.repo.owner, f.repo.name, asset.GetID()); err != nil { - return fmt.Errorf("failed to delete already existing asset: %w", err) - } - foundAsset = true - break - } - } - if resp.NextPage <= assetsPage || foundAsset { - break - } - assetsPage = resp.NextPage - } - - asset, _, err := client.UploadReleaseAsset(ctx, f.repo.owner, f.repo.name, *release.ID, &github.UploadOptions{Name: artifactName}, file) - if err != nil { - return err - } - fmt.Printf("Asset '%s' uploaded to release '%s' on repository '%s/%s'\nDownload: %s\n", *asset.Name, f.tag, f.repo.owner, f.repo.name, *asset.BrowserDownloadURL) - return nil -} - -func githubRepositoryClient(ctx context.Context, token string) githubRepositoryService { - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: token}, - ) - tc := oauth2.NewClient(ctx, ts) - - client := github.NewClient(tc) - return client.Repositories -} - -func getPublishGithubFlags(c *cli.Context) (*publishGithubFlags, error) { - metadata, err := config.GenerateMetadata(c) - if err != nil { - return nil, err - } - tag := c.Value("tag").(string) - if tag == "" && metadata.GrafanaVersion != "" { - tag = fmt.Sprintf("v%s", metadata.GrafanaVersion) - } - fullRepo := c.Value("repo").(string) - dryRun := c.Value("dry-run").(bool) - owner := strings.Split(fullRepo, "/")[0] - name := strings.Split(fullRepo, "/")[1] - create := c.Value("create").(bool) - artifactPath := c.Value("path").(string) - if artifactPath == "" { - artifactPath = fmt.Sprintf("grafana-enterprise2-%s-amd64.img", metadata.GrafanaVersion) - fmt.Printf("path argument is not provided, resolving to default %s...\n", artifactPath) - } - return &publishGithubFlags{ - artifactPath: artifactPath, - create: create, - dryRun: dryRun, - tag: tag, - repo: &githubRepo{ - owner: owner, - name: name, - }, - }, nil -} - -func runPublishGithubDryRun(f *publishGithubFlags, token string, c *cli.Context) error { - client := newGithubClient(c.Context, token) - fmt.Println("Dry-Run: Retrieving release on repository by tag") - release, res, err := client.GetReleaseByTag(c.Context, f.repo.owner, f.repo.name, f.tag) - if err != nil && res.StatusCode != 404 { - fmt.Println("Dry-Run: Github communication error:\n", err) - return nil - } - - if release == nil { - if f.create { - fmt.Println("Dry-Run: Release doesn't exist and --create is enabled, so it would try to create the release") - } else { - fmt.Println("Dry-Run: Release doesn't exist and --create is disabled, so it would fail with error") - return nil - } - } - - artifactName := path.Base(f.artifactPath) - fmt.Printf("Dry-Run: Opening file for release: %s\n", f.artifactPath) - _, err = os.Open(f.artifactPath) - if err != nil { - fmt.Println("Dry-Run: Error opening file\n", err) - return nil - } - - fmt.Printf("Dry-Run: Would upload asset '%s' to release '%s' on repo '%s/%s' and return download URL if successful\n", artifactName, f.tag, f.repo.owner, f.repo.name) - return nil -} diff --git a/pkg/build/cmd/publishgithub_test.go b/pkg/build/cmd/publishgithub_test.go deleted file mode 100644 index 24c77fef501..00000000000 --- a/pkg/build/cmd/publishgithub_test.go +++ /dev/null @@ -1,240 +0,0 @@ -package main - -import ( - "context" - "errors" - "io" - "net/http" - "os" - "path/filepath" - "testing" - - "github.com/google/go-github/v70/github" - "github.com/stretchr/testify/assert" - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/cmd/util" -) - -type githubPublishTestCases struct { - name string - args []string - token string - expectedError error - errorContains string - expectedOutput string - mockedService *mockGithubRepositoryServiceImpl -} - -var mockGithubRepositoryService = &mockGithubRepositoryServiceImpl{} - -func mockGithubRepositoryClient(context.Context, string) githubRepositoryService { - return mockGithubRepositoryService -} - -func TestPublishGithub(t *testing.T) { - t.Setenv("DRONE_BUILD_EVENT", "promote") - t.Setenv("DRONE_TAG", "v1.0.0") - t.Setenv("DRONE_COMMIT", "abcdefgh") - testApp, testPath := setupPublishGithubTests(t) - mockErrUnauthorized := errors.New("401") - - testCases := []githubPublishTestCases{ - { - name: "try to publish without required flags", - errorContains: `Required flags "path, repo" not set`, - }, - { - name: "try to publish without token", - args: []string{"--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - expectedError: errTokenIsEmpty, - }, - { - name: "try to publish with invalid token", - token: "invalid", - args: []string{"--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: mockErrUnauthorized}, - expectedError: mockErrUnauthorized, - }, - { - name: "try to publish with valid token and nonexisting tag with create disabled", - token: "valid", - args: []string{"--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: errReleaseNotFound}, - expectedError: errReleaseNotFound, - }, - { - name: "try to publish with valid token and nonexisting tag with create enabled", - token: "valid", - args: []string{"--path", testPath, "--repo", "test/test", "--tag", "v1.0.0", "--create"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: errReleaseNotFound}, - }, - { - name: "try to publish with valid token and existing tag", - token: "valid", - args: []string{"--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - }, - { - name: "dry run with invalid token", - token: "invalid", - args: []string{"--dry-run", "--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: mockErrUnauthorized}, - expectedOutput: "Github communication error", - }, - { - name: "dry run with valid token and nonexisting tag with create disabled", - token: "valid", - args: []string{"--dry-run", "--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: errReleaseNotFound}, - expectedOutput: "Release doesn't exist", - }, - { - name: "dry run with valid token and nonexisting tag with create enabled", - token: "valid", - args: []string{"--dry-run", "--path", testPath, "--repo", "test/test", "--tag", "v1.0.0", "--create"}, - mockedService: &mockGithubRepositoryServiceImpl{tagErr: errReleaseNotFound}, - expectedOutput: "Would upload asset", - }, - { - name: "dry run with valid token and existing tag", - token: "valid", - args: []string{"--dry-run", "--path", testPath, "--repo", "test/test", "--tag", "v1.0.0"}, - expectedOutput: "Would upload asset", - }, - } - - if os.Getenv("DRONE_COMMIT") == "" { - // this test only works locally due to Drone environment - testCases = append(testCases, - githubPublishTestCases{ - name: "try to publish without tag", - args: []string{"--path", testPath, "--repo", "test/test"}, - expectedError: errTagIsEmpty, - }, - ) - } - - for _, test := range testCases { - t.Run(test.name, func(t *testing.T) { - if test.token != "" { - t.Setenv("GH_TOKEN", test.token) - } - if test.mockedService != nil { - mockGithubRepositoryService = test.mockedService - } else { - mockGithubRepositoryService = &mockGithubRepositoryServiceImpl{} - } - args := []string{"run"} - args = append(args, test.args...) - out, err := captureStdout(t, func() error { - return testApp.Run(args) - }) - if test.expectedOutput != "" { - assert.Contains(t, out, test.expectedOutput) - } - if test.expectedError != nil || test.errorContains != "" { - assert.Error(t, err) - if test.expectedError != nil { - assert.ErrorIs(t, err, test.expectedError) - } - if test.errorContains != "" { - assert.ErrorContains(t, err, test.errorContains) - } - } else { - assert.NoError(t, err) - } - }) - } -} - -func setupPublishGithubTests(t *testing.T) (*cli.App, string) { - t.Helper() - ex, err := os.Executable() - if err != nil { - panic(err) - } - testPath := filepath.Dir(ex) - - newGithubClient = mockGithubRepositoryClient - - testApp := cli.NewApp() - testApp.Action = PublishGithub - testApp.Flags = []cli.Flag{ - &util.DryRunFlag, - &cli.StringFlag{ - Name: "path", - Required: true, - Usage: "Path to the asset to be published", - }, - &cli.StringFlag{ - Name: "repo", - Required: true, - Usage: "Github repository", - }, - &cli.StringFlag{ - Name: "tag", - Usage: "Release tag (default from metadata)ß", - }, - &cli.BoolFlag{ - Name: "create", - Usage: "Create release if it doesn't exist", - }, - } - return testApp, testPath -} - -func captureStdout(t *testing.T, fn func() error) (string, error) { - t.Helper() - rescueStdout := os.Stdout - r, w, _ := os.Pipe() - os.Stdout = w - err := fn() - werr := w.Close() - if werr != nil { - return "", err - } - out, _ := io.ReadAll(r) - os.Stdout = rescueStdout - return string(out), err -} - -type mockGithubRepositoryServiceImpl struct { - tagErr error - createErr error - uploadErr error -} - -func (m *mockGithubRepositoryServiceImpl) GetReleaseByTag(ctx context.Context, owner string, repo string, tag string) (*github.RepositoryRelease, *github.Response, error) { - var release *github.RepositoryRelease - res := &github.Response{Response: &http.Response{}} - if m.tagErr == nil { - releaseID := int64(1) - release = &github.RepositoryRelease{ID: &releaseID} - } else if errors.Is(m.tagErr, errReleaseNotFound) { - res.StatusCode = 404 - } - return release, res, m.tagErr -} - -func (m *mockGithubRepositoryServiceImpl) CreateRelease(ctx context.Context, owner string, repo string, release *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) { - releaseID := int64(1) - return &github.RepositoryRelease{ID: &releaseID}, &github.Response{}, m.createErr -} - -func (m *mockGithubRepositoryServiceImpl) UploadReleaseAsset(ctx context.Context, owner string, repo string, id int64, opt *github.UploadOptions, file *os.File) (*github.ReleaseAsset, *github.Response, error) { - assetName := "test" - assetUrl := "testurl.com.br" - return &github.ReleaseAsset{Name: &assetName, BrowserDownloadURL: &assetUrl}, &github.Response{}, m.uploadErr -} - -func (m *mockGithubRepositoryServiceImpl) DeleteReleaseAsset(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) { - return nil, nil -} - -func (m *mockGithubRepositoryServiceImpl) ListReleaseAssets(ctx context.Context, owner string, repo string, id int64, opts *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error) { - resp := github.Response{} - resp.LastPage = 1 - resp.FirstPage = 1 - resp.NextPage = 0 - return []*github.ReleaseAsset{}, &resp, nil -} diff --git a/pkg/build/cmd/publishmetrics.go b/pkg/build/cmd/publishmetrics.go deleted file mode 100644 index 9d0576891fd..00000000000 --- a/pkg/build/cmd/publishmetrics.go +++ /dev/null @@ -1,42 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "io" - "log" - "os" - "regexp" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/metrics" -) - -func PublishMetrics(c *cli.Context) error { - apiKey := c.Args().Get(0) - - input, err := io.ReadAll(os.Stdin) - if err != nil { - return cli.Exit(fmt.Sprintf("Reading from stdin failed: %s", err), 1) - } - - reMetrics := regexp.MustCompile(`(?ms)^Metrics: (\{.+\})`) - ms := reMetrics.FindSubmatch(input) - if len(ms) == 0 { - return cli.Exit(fmt.Sprintf("Input on wrong format: %q", string(input)), 1) - } - - m := map[string]string{} - if err := json.Unmarshal(ms[1], &m); err != nil { - return cli.Exit(fmt.Sprintf("decoding metrics failed: %s", err), 1) - } - - log.Printf("Received metrics %+v", m) - - if err := metrics.Publish(m, apiKey); err != nil { - return cli.Exit(fmt.Sprintf("publishing metrics failed: %s", err), 1) - } - - return nil -} diff --git a/pkg/build/cmd/publishstaticassets.go b/pkg/build/cmd/publishstaticassets.go deleted file mode 100644 index 5b6eff9f12a..00000000000 --- a/pkg/build/cmd/publishstaticassets.go +++ /dev/null @@ -1,51 +0,0 @@ -package main - -import ( - "fmt" - "strings" - - "github.com/grafana/grafana/pkg/build/env" - "github.com/grafana/grafana/pkg/build/gcloud" - "github.com/grafana/grafana/pkg/build/gcloud/storage" - "github.com/urfave/cli/v2" -) - -// PublishStaticAssetsAction Action implements the sub-command "artifacts static-assets". -func PublishStaticAssetsAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - staticAssetEditions, err := env.RequireListWithEnvFallback(c, "static-asset-editions", "STATIC_ASSET_EDITIONS") - if err != nil { - return err - } - - if err := gcloud.ActivateServiceAccount(); err != nil { - return fmt.Errorf("error connecting to gcp, %q", err) - } - - cfg := publishConfig{ - srcBucket: c.String("src-bucket"), - staticAssetsBucket: c.String("static-assets-bucket"), - staticAssetEditions: staticAssetEditions, - tag: strings.TrimPrefix(c.String("tag"), "v"), - } - - gcs, err := storage.New() - if err != nil { - return err - } - bucket := gcs.Bucket(cfg.staticAssetsBucket) - - for _, edition := range staticAssetEditions { - if err := gcs.CopyRemoteDir(c.Context, gcs.Bucket(cfg.srcBucket), fmt.Sprintf("artifacts/static-assets/%s/%s", edition, cfg.tag), bucket, fmt.Sprintf("%s/%s", edition, cfg.tag)); err != nil { - return err - } - } - - return nil -} diff --git a/pkg/build/cmd/publishstorybook.go b/pkg/build/cmd/publishstorybook.go deleted file mode 100644 index e33366d8e4b..00000000000 --- a/pkg/build/cmd/publishstorybook.go +++ /dev/null @@ -1,64 +0,0 @@ -package main - -import ( - "fmt" - "log" - "strings" - - "github.com/grafana/grafana/pkg/build/gcloud" - "github.com/grafana/grafana/pkg/build/gcloud/storage" - "github.com/grafana/grafana/pkg/build/versions" - "github.com/urfave/cli/v2" -) - -// PublishStorybookAction Action implements the sub-command "publish-artifacts". -func PublishStorybookAction(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - if err := gcloud.ActivateServiceAccount(); err != nil { - return fmt.Errorf("error connecting to gcp, %q", err) - } - - cfg := publishConfig{ - srcBucket: c.String("src-bucket"), - storybookBucket: c.String("storybook-bucket"), - tag: strings.TrimPrefix(c.String("tag"), "v"), - } - - gcs, err := storage.New() - if err != nil { - return err - } - bucket := gcs.Bucket(cfg.storybookBucket) - if err := gcs.CopyRemoteDir(c.Context, gcs.Bucket(cfg.srcBucket), fmt.Sprintf("artifacts/storybook/v%s", cfg.tag), bucket, cfg.tag); err != nil { - return err - } - - if latest, err := isLatest(cfg); err == nil && latest { - log.Printf("Copying storybooks to latest...") - if err := gcs.CopyRemoteDir(c.Context, gcs.Bucket(cfg.srcBucket), fmt.Sprintf("artifacts/storybook/v%s", cfg.tag), bucket, "latest"); err != nil { - return err - } - } else { - return err - } - - return nil -} - -func isLatest(cfg publishConfig) (bool, error) { - stableVersion, err := versions.GetLatestVersion(versions.LatestStableVersionURL) - if err != nil { - return false, err - } - isLatest, err := versions.IsGreaterThanOrEqual(cfg.tag, stableVersion) - if err != nil { - return false, err - } - return isLatest, nil -} diff --git a/pkg/build/cmd/storestorybook.go b/pkg/build/cmd/storestorybook.go deleted file mode 100644 index 13970e6a32e..00000000000 --- a/pkg/build/cmd/storestorybook.go +++ /dev/null @@ -1,50 +0,0 @@ -package main - -import ( - "log" - "path/filepath" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/grafana/grafana/pkg/build/gcloud/storage" -) - -// StoreStorybook implements the sub-command "store-storybook". -func StoreStorybook(c *cli.Context) error { - deployment := c.String("deployment") - - metadata, err := config.GenerateMetadata(c) - if err != nil { - return err - } - - buildConfig, err := config.GetBuildConfig(metadata.ReleaseMode.Mode) - if err != nil { - return err - } - - storybookBucket := buildConfig.Buckets.Storybook - srcPath := buildConfig.Buckets.StorybookSrcDir - srcPath = filepath.Join(srcPath, deployment) - - gcs, err := storage.New() - if err != nil { - return err - } - bucket := gcs.Bucket(storybookBucket) - - if err := gcs.DeleteDir(c.Context, bucket, srcPath); err != nil { - return err - } - - log.Printf("Successfully cleaned source: %s/%s\n", storybookBucket, srcPath) - - if err := gcs.CopyLocalDir(c.Context, "packages/grafana-ui/dist/storybook", bucket, srcPath, true); err != nil { - return err - } - - log.Printf("Successfully stored storybook to: %s/%s!\n", storybookBucket, srcPath) - - return nil -} diff --git a/pkg/build/cmd/uploadcdn.go b/pkg/build/cmd/uploadcdn.go deleted file mode 100644 index e18e1f65e16..00000000000 --- a/pkg/build/cmd/uploadcdn.go +++ /dev/null @@ -1,76 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os" - "path/filepath" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/grafana/grafana/pkg/build/gcloud/storage" -) - -// UploadCDN implements the sub-command "upload-cdn". -func UploadCDN(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - metadata, err := config.GenerateMetadata(c) - if err != nil { - return err - } - - version := metadata.GrafanaVersion - if err != nil { - return cli.Exit(err.Error(), 1) - } - - buildConfig, err := config.GetBuildConfig(metadata.ReleaseMode.Mode) - if err != nil { - return err - } - - edition := os.Getenv("EDITION") - log.Printf("Uploading Grafana CDN Assets, version %s, %s edition...", version, edition) - - editionPath := "" - - switch config.Edition(edition) { - case config.EditionOSS: - editionPath = "grafana-oss" - case config.EditionEnterprise: - editionPath = "grafana" - case config.EditionEnterprise2: - editionPath = os.Getenv("ENTERPRISE2_CDN_PATH") - default: - panic(fmt.Sprintf("unrecognized edition %q", edition)) - } - - gcs, err := storage.New() - if err != nil { - return err - } - - bucket := gcs.Bucket(buildConfig.Buckets.CDNAssets) - srcPath := buildConfig.Buckets.CDNAssetsDir - srcPath = filepath.Join(srcPath, editionPath, version) - - if err := gcs.DeleteDir(c.Context, bucket, srcPath); err != nil { - return err - } - log.Printf("Successfully cleaned source: %s/%s\n", buildConfig.Buckets.CDNAssets, srcPath) - - if err := gcs.CopyLocalDir(c.Context, "./public", bucket, srcPath, false); err != nil { - return err - } - - log.Printf("Successfully uploaded cdn static assets to: %s/%s!\n", buildConfig.Buckets.CDNAssets, srcPath) - - return nil -} diff --git a/pkg/build/cmd/uploadpackages.go b/pkg/build/cmd/uploadpackages.go deleted file mode 100644 index 5801192c62c..00000000000 --- a/pkg/build/cmd/uploadpackages.go +++ /dev/null @@ -1,234 +0,0 @@ -package main - -import ( - "encoding/base64" - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "regexp" - "strings" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/config" - "github.com/grafana/grafana/pkg/build/droneutil" - "github.com/grafana/grafana/pkg/build/gcloud" -) - -// PackageRegexp returns a regexp for matching packages corresponding to a certain Grafana edition. -func PackageRegexp(edition config.Edition) *regexp.Regexp { - var sfx string - switch edition { - case config.EditionOSS: - case config.EditionEnterprise: - sfx = "-enterprise" - case config.EditionEnterprise2: - sfx = "-enterprise2" - default: - panic(fmt.Sprintf("unrecognized edition %q", edition)) - } - rePkg, err := regexp.Compile(fmt.Sprintf(`^grafana%s(?:-rpi)?[-_][^-_]+.*$`, sfx)) - if err != nil { - panic(fmt.Sprintf("Failed to compile regexp: %s", err)) - } - - return rePkg -} - -const releaseFolder = "release" -const mainFolder = "main" -const releaseBranchFolder = "prerelease" - -type uploadConfig struct { - config.Config - - edition config.Edition - versionMode config.VersionMode - gcpKey string - distDir string - versionFolder string -} - -// UploadPackages implements the sub-command "upload-packages". -func UploadPackages(c *cli.Context) error { - if c.NArg() > 0 { - if err := cli.ShowSubcommandHelp(c); err != nil { - return cli.Exit(err.Error(), 1) - } - return cli.Exit("", 1) - } - - gcpKeyB64 := strings.TrimSpace(os.Getenv("GCP_KEY")) - if gcpKeyB64 == "" { - return cli.Exit("the environment variable GCP_KEY must be set", 1) - } - gcpKeyB, err := base64.StdEncoding.DecodeString(gcpKeyB64) - if err != nil { - return cli.Exit("failed to base64 decode $GCP_KEY", 1) - } - gcpKey := string(gcpKeyB) - - distDir, err := filepath.Abs("dist") - if err != nil { - return cli.Exit(err.Error(), 1) - } - - metadata, err := config.GenerateMetadata(c) - if err != nil { - return err - } - - version := metadata.GrafanaVersion - - releaseMode, err := metadata.GetReleaseMode() - if err != nil { - return cli.Exit(err.Error(), 1) - } - - releaseModeConfig, err := config.GetBuildConfig(releaseMode.Mode) - if err != nil { - return cli.Exit(err.Error(), 1) - } - - var edition config.Edition - if e, ok := os.LookupEnv("EDITION"); ok { - edition = config.Edition(e) - } - - if c.Bool("enterprise2") { - edition = config.EditionEnterprise2 - } - - if edition == "" { - return fmt.Errorf("both EDITION envvar and '--enterprise2' flag are missing. At least one of those is required") - } - - // TODO: Verify config values - cfg := uploadConfig{ - Config: config.Config{ - Version: version, - Bucket: releaseModeConfig.Buckets.Artifacts, - }, - edition: edition, - versionMode: releaseMode.Mode, - gcpKey: gcpKey, - distDir: distDir, - } - - event, err := droneutil.GetDroneEventFromEnv() - if err != nil { - return err - } - - if cfg.edition == config.EditionEnterprise2 { - cfg.Bucket, err = bucketForEnterprise2(releaseModeConfig, event) - if err != nil { - return err - } - } - - cfg.versionFolder, err = getVersionFolder(cfg, event) - if err != nil { - return err - } - - if err := uploadPackages(cfg); err != nil { - return cli.Exit(err.Error(), 1) - } - - log.Println("Successfully uploaded packages!") - return nil -} - -// Corner case for custom enterprise2 mode -func bucketForEnterprise2(releaseModeConfig *config.BuildConfig, event string) (string, error) { - if event == config.Custom { - buildConfig, err := config.GetBuildConfig(config.ReleaseBranchMode) - if err != nil { - return "", err - } - return buildConfig.Buckets.ArtifactsEnterprise2, nil - } - - if releaseModeConfig.Buckets.ArtifactsEnterprise2 != "" { - return releaseModeConfig.Buckets.ArtifactsEnterprise2, nil - } - - return "", fmt.Errorf("enterprise2 bucket var doesn't exist") -} - -func getVersionFolder(cfg uploadConfig, event string) (string, error) { - switch cfg.versionMode { - case config.TagMode, config.CloudMode: - return releaseFolder, nil - case config.MainMode, config.DownstreamMode: - return mainFolder, nil - case config.ReleaseBranchMode: - return releaseBranchFolder, nil - default: - // Corner case for custom enterprise2 mode - if event == config.Custom && cfg.versionMode == config.Enterprise2Mode { - return releaseFolder, nil - } - return "", fmt.Errorf("unrecognized version mode: %s", cfg.versionMode) - } -} - -func uploadPackages(cfg uploadConfig) error { - log.Printf("Uploading Grafana packages, version %s, %s edition, %s mode...\n", cfg.Version, cfg.edition, - cfg.versionMode) - - if err := gcloud.ActivateServiceAccount(); err != nil { - return fmt.Errorf("couldn't activate service account, err: %w", err) - } - - edition := strings.ToLower(string(cfg.edition)) - - var sfx string - switch cfg.edition { - case config.EditionOSS: - case config.EditionEnterprise: - sfx = "-enterprise" - case config.EditionEnterprise2: - sfx = "-enterprise2" - default: - panic(fmt.Sprintf("unrecognized edition %q", cfg.edition)) - } - matches, err := filepath.Glob(filepath.Join(cfg.distDir, fmt.Sprintf("grafana%s*", sfx))) - if err != nil { - return fmt.Errorf("failed to list packages: %w", err) - } - fpaths := []string{} - rePkg := PackageRegexp(cfg.edition) - for _, fpath := range matches { - fname := filepath.Base(fpath) - if strings.Contains(fname, "latest") || !rePkg.MatchString(fname) { - log.Printf("Ignoring file %q\n", fpath) - continue - } - - fpaths = append(fpaths, fpath) - } - - var tag, gcsPath string - droneTag := strings.TrimSpace(os.Getenv("DRONE_TAG")) - if droneTag != "" { - tag = droneTag - gcsPath = fmt.Sprintf("gs://%s/%s/%s/%s", cfg.Bucket, tag, edition, cfg.versionFolder) - } else { - gcsPath = fmt.Sprintf("gs://%s/%s/%s/", cfg.Bucket, edition, cfg.versionFolder) - } - log.Printf("Uploading %d file(s) to GCS (%s)...\n", len(fpaths), gcsPath) - - args := []string{"-m", "cp"} - args = append(args, fpaths...) - args = append(args, gcsPath) - cmd := exec.Command("gsutil", args...) - if output, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("failed to upload files to GCS: %s", output) - } - - return nil -} diff --git a/pkg/build/cmd/uploadpackages_test.go b/pkg/build/cmd/uploadpackages_test.go deleted file mode 100644 index 9d3bc7b52e1..00000000000 --- a/pkg/build/cmd/uploadpackages_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package main - -import ( - "errors" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/grafana/grafana/pkg/build/config" -) - -func Test_getVersionFolder(t *testing.T) { - type args struct { - cfg uploadConfig - event string - versionFolder string - } - tests := []struct { - name string - args args - err error - }{ - {"tag mode", args{uploadConfig{versionMode: config.TagMode}, "", releaseFolder}, nil}, - {"main mode", args{uploadConfig{versionMode: config.MainMode}, "", mainFolder}, nil}, - {"downstream mode", args{uploadConfig{versionMode: config.DownstreamMode}, "", mainFolder}, nil}, - {"release branch mode", args{uploadConfig{versionMode: config.ReleaseBranchMode}, "", releaseBranchFolder}, nil}, - {"enterprise pro mode", args{uploadConfig{versionMode: config.Enterprise2Mode}, config.Custom, releaseFolder}, nil}, - {"cloud mode", args{uploadConfig{versionMode: config.CloudMode}, "", releaseFolder}, nil}, - {"unrecognised version mode", args{uploadConfig{versionMode: "foo"}, config.Custom, ""}, errors.New("")}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - versionMode, err := getVersionFolder(tt.args.cfg, tt.args.event) - if tt.err != nil { - require.Error(t, err) - } - require.Equal(t, versionMode, tt.args.versionFolder) - }) - } -} - -func Test_checkForEnterprise2Edition(t *testing.T) { - type args struct { - releaseModeConfig *config.BuildConfig - event string - } - tests := []struct { - name string - args args - want string - err error - }{ - {"event is not custom", args{releaseModeConfig: &config.BuildConfig{Buckets: config.Buckets{ArtifactsEnterprise2: "dummy"}}}, "dummy", nil}, - {"event is not custom and string is empty", args{releaseModeConfig: &config.BuildConfig{Buckets: config.Buckets{ArtifactsEnterprise2: ""}}}, "", fmt.Errorf("enterprise2 bucket var doesn't exist")}, - {"event is custom", args{releaseModeConfig: nil, event: "custom"}, "grafana-downloads-enterprise2", nil}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := bucketForEnterprise2(tt.args.releaseModeConfig, tt.args.event) - if tt.err != nil { - require.Error(t, err) - } - assert.Equalf(t, tt.want, got, "bucketForEnterprise2(%v, %v)", tt.args.releaseModeConfig, tt.args.event) - }) - } -} diff --git a/pkg/build/cmd/verifydrone.go b/pkg/build/cmd/verifydrone.go deleted file mode 100644 index 14596377110..00000000000 --- a/pkg/build/cmd/verifydrone.go +++ /dev/null @@ -1,125 +0,0 @@ -package main - -import ( - "errors" - "flag" - "fmt" - "io" - "log" - "os" - - "github.com/drone/drone-cli/drone/lint" - "github.com/drone/drone-cli/drone/starlark" - "github.com/google/go-cmp/cmp" - cliv1 "github.com/urfave/cli" - "github.com/urfave/cli/v2" - "gopkg.in/yaml.v3" - - "github.com/grafana/grafana/pkg/build/fsutil" -) - -func VerifyDrone(c *cli.Context) error { - const yml = ".drone.yml" - const backup = ".drone.yml.bak" - - if err := fsutil.CopyFile(yml, backup); err != nil { - return cli.Exit(fmt.Sprintf("failed to copy %s to %s: %s", yml, backup, err), 1) - } - defer func() { - if err := os.Remove(yml); err != nil { - log.Printf("Failed to rename %s to %s", backup, yml) - } - if err := os.Rename(backup, yml); err != nil { - log.Printf("Failed to rename %s to %s", backup, yml) - } - }() - - flags := &flag.FlagSet{} - for _, flag := range starlark.Command.Flags { - flag.Apply(flags) - } - if err := flags.Set("format", "true"); err != nil { - return err - } - cStarlark := cliv1.NewContext(cliv1.NewApp(), flags, nil) - action := starlark.Command.Action.(func(*cliv1.Context)) - action(cStarlark) - - if err := verifyYAML(yml, backup); err != nil { - return err - } - - flags = &flag.FlagSet{} - for _, flag := range lint.Command.Flags { - flag.Apply(flags) - } - err := flags.Set("trusted", "true") - if err != nil { - return err - } - cLint := cliv1.NewContext(cliv1.NewApp(), flags, nil) - actionE := lint.Command.Action.(func(*cliv1.Context) error) - if err := actionE(cLint); err != nil { - return err - } - - log.Printf("%s is valid", yml) - - return nil -} - -func readConfig(fpath string) ([]map[string]any, error) { - //nolint:gosec - f, err := os.Open(fpath) - if err != nil { - return nil, cli.Exit(fmt.Sprintf("failed to read %s: %s", fpath, err), 1) - } - defer func() { - if err := f.Close(); err != nil { - log.Println("error closing file", err) - } - }() - - // The YAML stream may contain multiple pipeline configurations, read them all - dec := yaml.NewDecoder(f) - var c []map[string]any - for { - var m map[string]any - if err := dec.Decode(&m); err != nil { - if errors.Is(err, io.EOF) { - break - } - return nil, cli.Exit(fmt.Sprintf("Failed to decode %s: %s", fpath, err), 1) - } - - if m["kind"] == "signature" { - log.Printf("Ignoring a signature") - continue - } - - c = append(c, m) - } - - return c, nil -} - -func verifyYAML(yml, backup string) error { - log.Printf("Comparing %s and %s", yml, backup) - - c1, err := readConfig(yml) - if err != nil { - return err - } - - c2, err := readConfig(backup) - if err != nil { - return err - } - - if !cmp.Equal(c1, c2) { - return cli.Exit(fmt.Sprintf("%s is out of sync with .drone.star - regenerate it with drone starlark convert", - yml), 1) - } - - return nil -} diff --git a/pkg/build/cmd/verifystorybook.go b/pkg/build/cmd/verifystorybook.go deleted file mode 100644 index 109a0cdd619..00000000000 --- a/pkg/build/cmd/verifystorybook.go +++ /dev/null @@ -1,32 +0,0 @@ -// Package verifystorybook contains the sub-command "verify-storybook". -package main - -import ( - "fmt" - "log" - "path/filepath" - - "github.com/grafana/grafana/pkg/build/fsutil" - "github.com/urfave/cli/v2" -) - -// VerifyStorybook Action implements the sub-command "verify-storybook". -func VerifyStorybook(c *cli.Context) error { - const grafanaDir = "." - - paths := []string{ - "packages/grafana-ui/dist/storybook/index.html", - "packages/grafana-ui/dist/storybook/iframe.html"} - for _, p := range paths { - exists, err := fsutil.Exists(filepath.Join(grafanaDir, p)) - if err != nil { - return cli.Exit(fmt.Sprintf("failed to verify Storybook build: %s", err), 1) - } - if !exists { - return fmt.Errorf("failed to verify Storybook build, missing %q", p) - } - } - - log.Printf("Successfully verified Storybook integrity") - return nil -} diff --git a/pkg/build/config/config.go b/pkg/build/config/config.go deleted file mode 100644 index 7aa4176e13a..00000000000 --- a/pkg/build/config/config.go +++ /dev/null @@ -1,18 +0,0 @@ -package config - -type Config struct { - Version string - Bucket string - DebRepoBucket string - DebDBBucket string - RPMRepoBucket string - GPGPassPath string - GPGPrivateKey string - GPGPublicKey string - NumWorkers int - GitHubUser string - GitHubToken string - PullEnterprise bool - PackageVersion string - SignPackages bool -} diff --git a/pkg/build/config/edition.go b/pkg/build/config/edition.go deleted file mode 100644 index 48d7375f1cd..00000000000 --- a/pkg/build/config/edition.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -type Edition string - -const ( - EditionOSS Edition = "oss" - EditionEnterprise Edition = "enterprise" - EditionEnterprise2 Edition = "enterprise2" -) diff --git a/pkg/build/config/genmetadata.go b/pkg/build/config/genmetadata.go deleted file mode 100644 index 1ff0565bc17..00000000000 --- a/pkg/build/config/genmetadata.go +++ /dev/null @@ -1,103 +0,0 @@ -package config - -import ( - "fmt" - "os" - "strings" - - "github.com/urfave/cli/v2" - - "github.com/grafana/grafana/pkg/build/droneutil" -) - -func GenerateMetadata(c *cli.Context) (Metadata, error) { - var metadata Metadata - version := "" - - event, err := droneutil.GetDroneEventFromEnv() - if err != nil { - return Metadata{}, err - } - - tag, ok := os.LookupEnv("DRONE_TAG") - if !ok { - fmt.Println("DRONE_TAG envvar not present, %w", err) - } - - var releaseMode ReleaseMode - switch event { - case string(PullRequestMode): - releaseMode = ReleaseMode{Mode: PullRequestMode} - case Push: - mode, err := CheckDroneTargetBranch() - if err != nil { - return Metadata{}, err - } - releaseMode = ReleaseMode{Mode: mode} - case Custom: - if edition, _ := os.LookupEnv("EDITION"); edition == string(EditionEnterprise2) { - releaseMode = ReleaseMode{Mode: Enterprise2Mode} - if tag != "" { - version = strings.TrimPrefix(tag, "v") - } - break - } - mode, err := CheckDroneTargetBranch() - if err != nil { - return Metadata{}, err - } - // if there is a custom event targeting the main branch, that's an enterprise downstream build - if mode == MainBranch { - releaseMode = ReleaseMode{Mode: DownstreamMode} - } else { - releaseMode = ReleaseMode{Mode: mode} - } - case Tag, Promote: - if tag == "" { - return Metadata{}, fmt.Errorf("DRONE_TAG envvar not present for a tag/promotion event, %w", err) - } - version = strings.TrimPrefix(tag, "v") - mode, err := CheckSemverSuffix() - if err != nil { - return Metadata{}, err - } - releaseMode = mode - case Cronjob: - releaseMode = ReleaseMode{Mode: CronjobMode} - } - - if version == "" { - version, err = generateVersionFromBuildID() - if err != nil { - return Metadata{}, err - } - } - - currentCommit, err := GetDroneCommit() - if err != nil { - return Metadata{}, err - } - metadata = Metadata{ - GrafanaVersion: version, - ReleaseMode: releaseMode, - GrabplVersion: c.App.Version, - CurrentCommit: currentCommit, - } - - fmt.Printf("building Grafana version: %s, release mode: %+v\n", metadata.GrafanaVersion, metadata.ReleaseMode) - - return metadata, nil -} - -func generateVersionFromBuildID() (string, error) { - buildID, ok := os.LookupEnv("DRONE_BUILD_NUMBER") - if !ok { - return "", fmt.Errorf("unable to get DRONE_BUILD_NUMBER environmental variable") - } - var err error - version, err := GenerateGrafanaVersion(buildID, ".") - if err != nil { - return "", err - } - return version, nil -} diff --git a/pkg/build/config/genmetadata_test.go b/pkg/build/config/genmetadata_test.go deleted file mode 100644 index d8eeb06bb6a..00000000000 --- a/pkg/build/config/genmetadata_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package config - -import ( - "flag" - "os" - "testing" - - "github.com/stretchr/testify/require" - "github.com/urfave/cli/v2" -) - -const ( - DroneBuildEvent = "DRONE_BUILD_EVENT" - DroneTargetBranch = "DRONE_TARGET_BRANCH" - DroneTag = "DRONE_TAG" - DroneSemverPrerelease = "DRONE_SEMVER_PRERELEASE" - DroneBuildNumber = "DRONE_BUILD_NUMBER" -) - -const ( - hashedGrafanaVersion = "9.2.0-12345" - versionedBranch = "v9.2.x" -) - -func TestGetMetadata(t *testing.T) { - tcs := []struct { - envMap map[string]string - expVersion string - mode ReleaseMode - }{ - {map[string]string{DroneBuildEvent: PullRequest, DroneTargetBranch: "", DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, ReleaseMode{Mode: PullRequestMode}}, - {map[string]string{DroneBuildEvent: Push, DroneTargetBranch: versionedBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, ReleaseMode{Mode: ReleaseBranchMode}}, - {map[string]string{DroneBuildEvent: Push, DroneTargetBranch: MainBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, ReleaseMode{Mode: MainMode}}, - {map[string]string{DroneBuildEvent: Custom, DroneTargetBranch: versionedBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, ReleaseMode{Mode: ReleaseBranchMode}}, - {map[string]string{DroneBuildEvent: Custom, DroneTargetBranch: MainBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, hashedGrafanaVersion, ReleaseMode{Mode: DownstreamMode}}, - {map[string]string{DroneBuildEvent: Custom, DroneTargetBranch: MainBranch, DroneTag: "", DroneSemverPrerelease: "", DroneBuildNumber: "12345", "EDITION": string(EditionEnterprise2)}, hashedGrafanaVersion, ReleaseMode{Mode: Enterprise2Mode}}, - {map[string]string{DroneBuildEvent: Tag, DroneTargetBranch: "", DroneTag: "v9.2.0", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, "9.2.0", ReleaseMode{Mode: TagMode, IsPreview: false, IsTest: false}}, - {map[string]string{DroneBuildEvent: Tag, DroneTargetBranch: "", DroneTag: "v9.2.0-preview", DroneSemverPrerelease: "preview", DroneBuildNumber: "12345"}, "9.2.0-preview", ReleaseMode{Mode: TagMode, IsPreview: true, IsTest: false}}, - {map[string]string{DroneBuildEvent: Tag, DroneTargetBranch: "", DroneTag: "v9.2.0-test", DroneSemverPrerelease: "test", DroneBuildNumber: "12345"}, "9.2.0-test", ReleaseMode{Mode: TagMode, IsPreview: false, IsTest: true}}, - {map[string]string{DroneBuildEvent: Promote, DroneTargetBranch: "", DroneTag: "v9.2.0", DroneSemverPrerelease: "", DroneBuildNumber: "12345"}, "9.2.0", ReleaseMode{Mode: TagMode, IsPreview: false, IsTest: false}}, - {map[string]string{DroneBuildEvent: Promote, DroneTargetBranch: "", DroneTag: "v9.2.0-preview", DroneSemverPrerelease: "preview", DroneBuildNumber: "12345"}, "9.2.0-preview", ReleaseMode{Mode: TagMode, IsPreview: true, IsTest: false}}, - {map[string]string{DroneBuildEvent: Promote, DroneTargetBranch: "", DroneTag: "v9.2.0-test", DroneSemverPrerelease: "test", DroneBuildNumber: "12345"}, "9.2.0-test", ReleaseMode{Mode: TagMode, IsPreview: false, IsTest: true}}, - } - - ctx := cli.NewContext(cli.NewApp(), &flag.FlagSet{}, nil) - for _, tc := range tcs { - t.Run("Should return valid metadata, ", func(t *testing.T) { - setUpEnv(t, tc.envMap) - testMetadata(t, ctx, tc.expVersion, tc.mode) - }) - } -} - -func testMetadata(t *testing.T, ctx *cli.Context, version string, releaseMode ReleaseMode) { - t.Helper() - - metadata, err := GenerateMetadata(ctx) - require.NoError(t, err) - t.Run("with a valid version", func(t *testing.T) { - expVersion := metadata.GrafanaVersion - require.Equal(t, expVersion, version) - }) - - t.Run("with a valid release mode from the built-in list", func(t *testing.T) { - expMode := metadata.ReleaseMode - require.NoError(t, err) - require.Equal(t, expMode, releaseMode) - }) -} - -func setUpEnv(t *testing.T, envMap map[string]string) { - t.Helper() - - os.Clearenv() - t.Setenv("DRONE_COMMIT", "abcd12345") - for k, v := range envMap { - t.Setenv(k, v) - } -} diff --git a/pkg/build/config/package.json b/pkg/build/config/package.json deleted file mode 100644 index 1a5184b05c7..00000000000 --- a/pkg/build/config/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "9.2.0-pre" -} diff --git a/pkg/build/config/variant.go b/pkg/build/config/variant.go deleted file mode 100644 index 6b476ed95e6..00000000000 --- a/pkg/build/config/variant.go +++ /dev/null @@ -1,64 +0,0 @@ -package config - -// Variant is the OS / Architecture combination that Grafana can be compiled for. -type Variant string - -const ( - VariantLinuxAmd64 Variant = "linux-amd64" - VariantLinuxAmd64Musl Variant = "linux-amd64-musl" - VariantArmV6 Variant = "linux-armv6" - VariantArmV7 Variant = "linux-armv7" - VariantArmV7Musl Variant = "linux-armv7-musl" - VariantArm64 Variant = "linux-arm64" - VariantArm64Musl Variant = "linux-arm64-musl" - VariantDarwinAmd64 Variant = "darwin-amd64" - VariantWindowsAmd64 Variant = "windows-amd64" -) - -var AllVariants = []Variant{ - // https://github.com/golang/go/issues/58425 disabling arm builds until go issue is resolved - // VariantArmV6, - // VariantArmV7, - // VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, -} - -// Architecture is an allowed value in the GOARCH environment variable. -type Architecture string - -const ( - ArchAMD64 Architecture = "amd64" - ArchARMv6 Architecture = "armv6" - ArchARMv7 Architecture = "armv7" - ArchARM64 Architecture = "arm64" - ArchARMHF Architecture = "armhf" - ArchARMHFP Architecture = "armhfp" - ArchARM Architecture = "arm" -) - -type OS string - -const ( - OSWindows OS = "windows" - OSDarwin OS = "darwin" - OSLinux OS = "linux" -) - -type LibC string - -const ( - LibCMusl = "musl" -) - -// Distribution is the base os image where the Grafana image is built on. -type Distribution string - -const ( - Ubuntu Distribution = "ubuntu" - Alpine Distribution = "alpine" -) diff --git a/pkg/build/config/version.go b/pkg/build/config/version.go index 1533231a43b..dd1b0405119 100644 --- a/pkg/build/config/version.go +++ b/pkg/build/config/version.go @@ -5,72 +5,9 @@ import ( "fmt" "os" "path/filepath" - "regexp" "strings" - - "github.com/grafana/grafana/pkg/build/git" ) -type Metadata struct { - GrafanaVersion string `json:"version,omitempty"` - ReleaseMode ReleaseMode `json:"releaseMode,omitempty"` - GrabplVersion string `json:"grabplVersion,omitempty"` - CurrentCommit string `json:"currentCommit,omitempty"` -} - -type ReleaseMode struct { - Mode VersionMode `json:"mode,omitempty"` - IsPreview bool `json:"IsPreview,omitempty"` - IsTest bool `json:"isTest,omitempty"` -} - -type PluginSignature struct { - Sign bool `json:"sign,omitempty"` - AdminSign bool `json:"adminSign,omitempty"` -} - -type Docker struct { - ShouldSave bool `json:"shouldSave,omitempty"` - Distribution []Distribution `json:"distribution,omitempty"` - Architectures []Architecture `json:"archs,omitempty"` - PrereleaseBucket string `json:"prereleaseBucket,omitempty"` -} - -type Buckets struct { - Artifacts string `json:"artifacts,omitempty"` - ArtifactsEnterprise2 string `json:"artifactsEnterprise2,omitempty"` - CDNAssets string `json:"CDNAssets,omitempty"` - CDNAssetsDir string `json:"CDNAssetsDir,omitempty"` - Storybook string `json:"storybook,omitempty"` - StorybookSrcDir string `json:"storybookSrcDir,omitempty"` -} - -// BuildConfig represents the struct that defines all of the different variables used to build Grafana -type BuildConfig struct { - Variants []Variant `json:"variants,omitempty"` - PluginSignature PluginSignature `json:"pluginSignature,omitempty"` - Docker Docker `json:"docker,omitempty"` - Buckets Buckets `json:"buckets,omitempty"` -} - -func (md *Metadata) GetReleaseMode() (ReleaseMode, error) { - return md.ReleaseMode, nil -} - -// VersionMap is a map of versions. Each key of the Versions map is an event that uses the config as the value for that key. -// For example, the 'pull_request' key will have data in it that might cause Grafana to be built differently in a pull request, -// than the way it will be built in 'main' -type VersionMap map[VersionMode]BuildConfig - -// GetBuildConfig reads the embedded config.json and decodes it. -func GetBuildConfig(mode VersionMode) (*BuildConfig, error) { - if v, ok := Versions[mode]; ok { - return &v, nil - } - - return nil, fmt.Errorf("mode '%s' not found in version list", mode) -} - // GenerateGrafanaVersion gets the Grafana version from the package.json func GenerateGrafanaVersion(buildID, grafanaDir string) (string, error) { version, err := GetPackageJSONVersion(grafanaDir) @@ -106,55 +43,6 @@ func GetPackageJSONVersion(grafanaDir string) (string, error) { return version, nil } -func CheckDroneTargetBranch() (VersionMode, error) { - rePRCheckBranch := git.PRCheckRegexp() - reRlsBranch := regexp.MustCompile(`^v\d+\.\d+\.x$`) - target := os.Getenv("DRONE_TARGET_BRANCH") - if target == "" { - return "", fmt.Errorf("failed to get DRONE_TARGET_BRANCH environmental variable") - } else if target == string(MainMode) { - return MainMode, nil - } - if reRlsBranch.MatchString(target) { - return ReleaseBranchMode, nil - } - if rePRCheckBranch.MatchString(target) { - return PullRequestMode, nil - } - fmt.Printf("unrecognized target branch: %s, defaulting to %s\n", target, PullRequestMode) - return PullRequestMode, nil -} - -func CheckSemverSuffix() (ReleaseMode, error) { - rePreviewRls := regexp.MustCompile(`preview.*`) - reTestRls := regexp.MustCompile(`test.*`) - reCloudRls := regexp.MustCompile(`cloud.*`) - tagSuffix, ok := os.LookupEnv("DRONE_SEMVER_PRERELEASE") - if !ok || tagSuffix == "" { - fmt.Println("DRONE_SEMVER_PRERELEASE doesn't exist for a tag, this is a release event...") - return ReleaseMode{Mode: TagMode}, nil - } - switch { - case rePreviewRls.MatchString(tagSuffix): - return ReleaseMode{Mode: TagMode, IsPreview: true}, nil - case reTestRls.MatchString(tagSuffix): - return ReleaseMode{Mode: TagMode, IsTest: true}, nil - case reCloudRls.MatchString(tagSuffix): - return ReleaseMode{Mode: CloudMode}, nil - default: - fmt.Printf("DRONE_SEMVER_PRERELEASE is custom string, release event with %s suffix\n", tagSuffix) - return ReleaseMode{Mode: TagMode}, nil - } -} - -func GetDroneCommit() (string, error) { - commit := strings.TrimSpace(os.Getenv("DRONE_COMMIT")) - if commit == "" { - return "", fmt.Errorf("the environment variable DRONE_COMMIT is missing") - } - return commit, nil -} - func shortenBuildID(buildID string) string { buildID = strings.ReplaceAll(buildID, "-", "") if len(buildID) < 9 { diff --git a/pkg/build/config/version_mode.go b/pkg/build/config/version_mode.go deleted file mode 100644 index d7734bb7d01..00000000000 --- a/pkg/build/config/version_mode.go +++ /dev/null @@ -1,28 +0,0 @@ -package config - -// VersionMode defines the source event that created a release or published version -type VersionMode string - -const ( - MainMode VersionMode = "main" - TagMode VersionMode = "release" - ReleaseBranchMode VersionMode = "branch" - PullRequestMode VersionMode = "pull_request" - DownstreamMode VersionMode = "downstream" - Enterprise2Mode VersionMode = "enterprise2" - CronjobMode VersionMode = "cron" - CloudMode VersionMode = "cloud" -) - -const ( - Tag = "tag" - PullRequest = "pull_request" - Push = "push" - Custom = "custom" - Promote = "promote" - Cronjob = "cron" -) - -const ( - MainBranch = "main" -) diff --git a/pkg/build/config/versions.go b/pkg/build/config/versions.go deleted file mode 100644 index d87c60d7ff0..00000000000 --- a/pkg/build/config/versions.go +++ /dev/null @@ -1,237 +0,0 @@ -package config - -var Versions = VersionMap{ - PullRequestMode: { - Variants: []Variant{ - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantArm64, - VariantArm64Musl, - }, - PluginSignature: PluginSignature{ - Sign: false, - AdminSign: false, - }, - Docker: Docker{ - ShouldSave: false, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - }, - Distribution: []Distribution{ - Alpine, - }, - }, - }, - MainMode: { - Variants: []Variant{ - VariantArmV6, - VariantArmV7, - VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: false, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - ArchARMv7, // GOARCH=ARM is used for both armv6 and armv7. They are differentiated by the GOARM variable. - }, - Distribution: []Distribution{ - Alpine, - Ubuntu, - }, - }, - Buckets: Buckets{ - Artifacts: "grafana-downloads", - ArtifactsEnterprise2: "grafana-downloads-enterprise2", - CDNAssets: "grafana-static-assets", - Storybook: "grafana-storybook", - }, - }, - DownstreamMode: { - Variants: []Variant{ - VariantArmV6, - VariantArmV7, - VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: true, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - ArchARMv7, // GOARCH=ARM is used for both armv6 and armv7. They are differentiated by the GOARM variable. - }, - Distribution: []Distribution{ - Alpine, - Ubuntu, - }, - }, - Buckets: Buckets{ - Artifacts: "grafana-downloads", - ArtifactsEnterprise2: "grafana-downloads-enterprise2", - CDNAssets: "grafana-static-assets", - }, - }, - ReleaseBranchMode: { - Variants: []Variant{ - VariantArmV6, - VariantArmV7, - VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: true, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - ArchARMv7, - }, - Distribution: []Distribution{ - Alpine, - Ubuntu, - }, - PrereleaseBucket: "grafana-prerelease/artifacts/docker", - }, - Buckets: Buckets{ - Artifacts: "grafana-downloads", - ArtifactsEnterprise2: "grafana-downloads-enterprise2", - CDNAssets: "grafana-static-assets", - }, - }, - TagMode: { - Variants: []Variant{ - VariantArmV6, - VariantArmV7, - VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: true, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - ArchARMv7, - }, - Distribution: []Distribution{ - Alpine, - Ubuntu, - }, - PrereleaseBucket: "grafana-prerelease/artifacts/docker", - }, - Buckets: Buckets{ - Artifacts: "grafana-prerelease/artifacts/downloads", - ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", - CDNAssets: "grafana-prerelease", - CDNAssetsDir: "artifacts/static-assets", - Storybook: "grafana-prerelease", - StorybookSrcDir: "artifacts/storybook", - }, - }, - Enterprise2Mode: { - Variants: []Variant{ - VariantArmV6, - VariantArmV7, - VariantArmV7Musl, - VariantArm64, - VariantArm64Musl, - VariantDarwinAmd64, - VariantWindowsAmd64, - VariantLinuxAmd64, - VariantLinuxAmd64Musl, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: true, - Architectures: []Architecture{ - ArchAMD64, - ArchARM64, - ArchARMv7, - }, - Distribution: []Distribution{ - Alpine, - Ubuntu, - }, - PrereleaseBucket: "grafana-prerelease/artifacts/docker", - }, - Buckets: Buckets{ - Artifacts: "grafana-prerelease/artifacts/downloads", - ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", - CDNAssets: "grafana-prerelease", - CDNAssetsDir: "artifacts/static-assets", - Storybook: "grafana-prerelease", - StorybookSrcDir: "artifacts/storybook", - }, - }, - CloudMode: { - Variants: []Variant{ - VariantLinuxAmd64Musl, - // We still need this variant to build the .deb file - VariantLinuxAmd64, - }, - PluginSignature: PluginSignature{ - Sign: true, - AdminSign: true, - }, - Docker: Docker{ - ShouldSave: true, - Architectures: []Architecture{ - ArchAMD64, - }, - Distribution: []Distribution{ - Alpine, - }, - PrereleaseBucket: "grafana-prerelease/artifacts/docker", - }, - Buckets: Buckets{ - Artifacts: "grafana-prerelease/artifacts/downloads", - ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2", - CDNAssets: "grafana-prerelease", - CDNAssetsDir: "artifacts/static-assets", - Storybook: "grafana-prerelease", - StorybookSrcDir: "artifacts/storybook", - }, - }, -} diff --git a/pkg/build/daggerbuild/cmd/app.go b/pkg/build/daggerbuild/cmd/app.go index f63dcea934c..ac4d1f61bbf 100644 --- a/pkg/build/daggerbuild/cmd/app.go +++ b/pkg/build/daggerbuild/cmd/app.go @@ -26,27 +26,7 @@ func (c *CLI) App() *cli.App { Name: "grafana-build", Usage: "A build tool for Grafana", Commands: []*cli.Command{ - // Legacy commands, should eventually be completely replaced by what's in "artifacts" - { - Name: "package", - Subcommands: []*cli.Command{ - PackagePublishCommand, - }, - }, - { - Name: "docker", - Subcommands: []*cli.Command{ - DockerPublishCommand, - }, - }, - ProImageCommand, - { - Name: "npm", - Subcommands: []*cli.Command{ - PublishNPMCommand, - }, - }, - GCOMCommand, + c.ArtifactsCommand(), }, } } diff --git a/pkg/build/daggerbuild/cmd/docker_publish.go b/pkg/build/daggerbuild/cmd/docker_publish.go deleted file mode 100644 index a809e28eb80..00000000000 --- a/pkg/build/daggerbuild/cmd/docker_publish.go +++ /dev/null @@ -1,19 +0,0 @@ -package cmd - -import ( - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -var DockerPublishCommand = &cli.Command{ - Name: "publish", - Action: PipelineActionWithPackageInput(pipelines.PublishDocker), - Usage: "Using a grafana.docker.tar.gz as input (ideally one built using the 'package' command), publish a docker image and manifest", - Flags: JoinFlagsWithDefault( - PackageInputFlags, - DockerFlags, - DockerPublishFlags, - GCPFlags, - ConcurrencyFlags, - ), -} diff --git a/pkg/build/daggerbuild/cmd/gcom.go b/pkg/build/daggerbuild/cmd/gcom.go deleted file mode 100644 index 6414cba99a6..00000000000 --- a/pkg/build/daggerbuild/cmd/gcom.go +++ /dev/null @@ -1,11 +0,0 @@ -package cmd - -import ( - "github.com/urfave/cli/v2" -) - -var GCOMCommand = &cli.Command{ - Name: "gcom", - Description: "Executes requests to grafana.com", - Subcommands: []*cli.Command{GCOMPublishCommand}, -} diff --git a/pkg/build/daggerbuild/cmd/gcom_publish.go b/pkg/build/daggerbuild/cmd/gcom_publish.go deleted file mode 100644 index 0d41aa05096..00000000000 --- a/pkg/build/daggerbuild/cmd/gcom_publish.go +++ /dev/null @@ -1,18 +0,0 @@ -package cmd - -import ( - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -var GCOMPublishCommand = &cli.Command{ - Name: "publish", - Action: PipelineActionWithPackageInput(pipelines.PublishGCOM), - Description: "Publishes a grafana.tar.gz (ideally one built using the 'package' command) to grafana.com (--destination will be the download path)", - Flags: JoinFlagsWithDefault( - GCOMFlags, - PackageInputFlags, - PublishFlags, - ConcurrencyFlags, - ), -} diff --git a/pkg/build/daggerbuild/cmd/main.go b/pkg/build/daggerbuild/cmd/main.go deleted file mode 100644 index 6b31194b684..00000000000 --- a/pkg/build/daggerbuild/cmd/main.go +++ /dev/null @@ -1,47 +0,0 @@ -package cmd - -import ( - "errors" - "fmt" - "os" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -// Deprecated: use the Artifact type instead -func PipelineActionWithPackageInput(pf pipelines.PipelineFuncWithPackageInput) cli.ActionFunc { - return func(c *cli.Context) error { - var ( - ctx = c.Context - opts = []dagger.ClientOpt{} - ) - if c.Bool("verbose") { - opts = append(opts, dagger.WithLogOutput(os.Stderr)) - } - client, err := dagger.Connect(ctx, opts...) - if err != nil { - return err - } - defer func(c *dagger.Client) { - if err := c.Close(); err != nil { - fmt.Println("error closing dagger client:", err) - } - }(client) - - args, err := pipelines.PipelineArgsFromContext(ctx, c) - if err != nil { - return err - } - - if len(args.PackageInputOpts.Packages) == 0 { - return errors.New("expected at least one package from a '--package' flag") - } - - if err := pf(ctx, client, args); err != nil { - return err - } - return nil - } -} diff --git a/pkg/build/daggerbuild/cmd/npm_publish.go b/pkg/build/daggerbuild/cmd/npm_publish.go deleted file mode 100644 index 4a764034cca..00000000000 --- a/pkg/build/daggerbuild/cmd/npm_publish.go +++ /dev/null @@ -1,18 +0,0 @@ -package cmd - -import ( - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -var PublishNPMCommand = &cli.Command{ - Name: "publish", - Action: PipelineActionWithPackageInput(pipelines.PublishNPM), - Usage: "Using a grafana.tar.gz as input (ideally one built using the 'package' command), take the npm artifacts and publish them on NPM.", - Flags: JoinFlagsWithDefault( - PackageInputFlags, - NPMFlags, - GCPFlags, - ConcurrencyFlags, - ), -} diff --git a/pkg/build/daggerbuild/cmd/package_publish.go b/pkg/build/daggerbuild/cmd/package_publish.go deleted file mode 100644 index 095a848ad12..00000000000 --- a/pkg/build/daggerbuild/cmd/package_publish.go +++ /dev/null @@ -1,18 +0,0 @@ -package cmd - -import ( - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -var PackagePublishCommand = &cli.Command{ - Name: "publish", - Action: PipelineActionWithPackageInput(pipelines.PublishPackage), - Description: "Publishes a grafana.tar.gz (ideally one built using the 'package' command) in the destination directory (--destination)", - Flags: JoinFlagsWithDefault( - PackageInputFlags, - PublishFlags, - GCPFlags, - ConcurrencyFlags, - ), -} diff --git a/pkg/build/daggerbuild/cmd/pro_image.go b/pkg/build/daggerbuild/cmd/pro_image.go deleted file mode 100644 index 43001452244..00000000000 --- a/pkg/build/daggerbuild/cmd/pro_image.go +++ /dev/null @@ -1,13 +0,0 @@ -package cmd - -import ( - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" - "github.com/urfave/cli/v2" -) - -var ProImageCommand = &cli.Command{ - Name: "pro-image", - Action: PipelineActionWithPackageInput(pipelines.ProImage), - Description: "Creates a hosted grafana pro image", - Flags: JoinFlagsWithDefault(ProImageFlags, GCPFlags, PackageInputFlags), -} diff --git a/pkg/build/daggerbuild/containers/google_cloud.go b/pkg/build/daggerbuild/containers/google_cloud.go deleted file mode 100644 index 3463aaec270..00000000000 --- a/pkg/build/daggerbuild/containers/google_cloud.go +++ /dev/null @@ -1,132 +0,0 @@ -package containers - -import ( - "fmt" - "math/rand" - "os" - "path/filepath" - "strconv" - - "dagger.io/dagger" -) - -const GoogleCloudImage = "google/cloud-sdk:alpine" - -// GCPAuthenticator injects authentication information into the provided container. -type GCPAuthenticator interface { - Authenticate(*dagger.Client, *dagger.Container) (*dagger.Container, error) -} - -// GCPServiceAccount satisfies GCPAuthenticator and injects the provided ServiceAccount into the filesystem and adds a 'gcloud auth activate-service-account' -type GCPServiceAccount struct { - DaggerFile *dagger.File - JSONFile string -} - -func (a *GCPServiceAccount) Authenticate(d *dagger.Client, c *dagger.Container) (*dagger.Container, error) { - if a.DaggerFile == nil && a.JSONFile == "" { - return nil, fmt.Errorf("GCPServiceAccount authentication missed JSONFile AND DaggerFile") - } - var container *dagger.Container - - if a.JSONFile != "" { - container = c.WithMountedFile( - "/opt/service_account.json", - d.Host().Directory(filepath.Dir(a.JSONFile)).File(filepath.Base(a.JSONFile)), - ) - } - - if a.DaggerFile != nil { - container = c.WithMountedFile("/opt/service_account.json", a.DaggerFile) - } - - return container.WithExec([]string{"gcloud", "auth", "activate-service-account", "--key-file", "/opt/service_account.json"}), nil -} - -func NewGCPServiceAccount(filepath string) *GCPServiceAccount { - return &GCPServiceAccount{ - JSONFile: filepath, - } -} - -func NewGCPServiceAccountWithFile(file *dagger.File) *GCPServiceAccount { - return &GCPServiceAccount{ - DaggerFile: file, - } -} - -// InheritedServiceAccount uses `gcloud` command in the current shell to get the GCS credentials. -// This type should really only be used when running locally. -type GCPInheritedAuth struct{} - -func (a *GCPInheritedAuth) Authenticate(d *dagger.Client, c *dagger.Container) (*dagger.Container, error) { - if val, ok := os.LookupEnv("GOOGLE_APPLICATION_CREDENTIALS"); ok { - return c.WithMountedDirectory("/auth/credentials.json", d.Host().Directory(val)).WithEnvVariable("GOOGLE_APPLICATION_CREDENTIALS", "/auth/credentials.json"), nil - } - - cfg, err := os.UserHomeDir() - if err != nil { - return nil, err - } - - return c.WithMountedDirectory("/root/.config/gcloud", d.Host().Directory(filepath.Join(cfg, ".config", "gcloud"))), nil -} - -func GCSUploadDirectory(d *dagger.Client, image string, auth GCPAuthenticator, dir *dagger.Directory, dst string) (*dagger.Container, error) { - container := d.Container().From(image). - WithMountedDirectory("/src", dir) - - var err error - container, err = auth.Authenticate(d, container) - if err != nil { - return nil, err - } - - secret := d.SetSecret("gcs-destination", dst) - container = container.WithSecretVariable("GCS_DESTINATION", secret) - - return container.WithExec([]string{"/bin/sh", "-c", "gcloud storage cp -r /src/* ${GCS_DESTINATION}"}), nil -} - -func GCSDownloadFile(d *dagger.Client, image string, auth GCPAuthenticator, url string) (*dagger.File, error) { - var ( - container = d.Container().From(image) - err error - r = rand.Int() - ) - - container, err = auth.Authenticate(d, container) - if err != nil { - return nil, err - } - secret := d.SetSecret("gcs-download-url", url) - file := container. - WithEnvVariable("RAND", strconv.Itoa(r)). - WithSecretVariable("GCS_DOWNLOAD_URL", secret). - WithExec([]string{"/bin/sh", "-c", "gcloud storage cp ${GCS_DOWNLOAD_URL} /src/file"}). - File("/src/file") - - return file, nil -} - -func GCSAuth(d *dagger.Client, opts *GCPOpts) GCPAuthenticator { - var auth GCPAuthenticator = &GCPInheritedAuth{} - // The order of operations: - // 1. Try to use base64 key. - // 2. Try to use gcp-service-account-key (path to a file). - // 3. Try mounting $XDG_CONFIG_HOME/gcloud - if key := opts.ServiceAccountKeyBase64; key != "" { - secret := d.SetSecret("gcp-sa-key-base64", key) - // Write key to a file in an alpine container... - file := d.Container().From("alpine"). - WithSecretVariable("GCP_SERVICE_ACCOUNT_KEY_BASE64", secret). - WithExec([]string{"/bin/sh", "-c", "echo $GCP_SERVICE_ACCOUNT_KEY_BASE64 | base64 -d > /key.json"}). - File("/key.json") - - auth = NewGCPServiceAccountWithFile(file) - } else if key := opts.ServiceAccountKey; key != "" { - auth = NewGCPServiceAccount(key) - } - - return auth -} diff --git a/pkg/build/daggerbuild/containers/opts_pro_image.go b/pkg/build/daggerbuild/containers/opts_pro_image.go deleted file mode 100644 index 8affbc6f753..00000000000 --- a/pkg/build/daggerbuild/containers/opts_pro_image.go +++ /dev/null @@ -1,42 +0,0 @@ -package containers - -import "github.com/grafana/grafana/pkg/build/daggerbuild/cliutil" - -type ProImageOpts struct { - // Github token used to clone private repositories. - GitHubToken string - - // The path to a Grafana debian package. - Deb string - - // The Grafana version. - GrafanaVersion string - - // The docker image tag. - ImageTag string - - // The docker image repo. - Repo string - - // The release type. - ReleaseType string - - // True if the pro image should be pushed to the container registry. - Push bool - - // The container registry that the image should be pushed to. Required if Push is true. - ContainerRegistry string -} - -func ProImageOptsFromFlags(c cliutil.CLIContext) *ProImageOpts { - return &ProImageOpts{ - GitHubToken: c.String("github-token"), - Deb: c.String("deb"), - GrafanaVersion: c.String("grafana-version"), - ImageTag: c.String("image-tag"), - Repo: c.String("repo"), - ReleaseType: c.String("release-type"), - Push: c.Bool("push"), - ContainerRegistry: c.String("registry"), - } -} diff --git a/pkg/build/daggerbuild/containers/package_input.go b/pkg/build/daggerbuild/containers/package_input.go deleted file mode 100644 index 13b4e53117f..00000000000 --- a/pkg/build/daggerbuild/containers/package_input.go +++ /dev/null @@ -1,73 +0,0 @@ -package containers - -import ( - "context" - "fmt" - "net/url" - "path/filepath" - "strings" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/cliutil" -) - -type PackageInputOpts struct { - // Name is used when overriding the artifact that is being produced. This is used in very specific scenarios where - // the source package's name does not match the package's metadata name. - Name string - Packages []string -} - -func PackageInputOptsFromFlags(c cliutil.CLIContext) *PackageInputOpts { - return &PackageInputOpts{ - Name: c.String("name"), - Packages: c.StringSlice("package"), - } -} - -// GetPackage uses the PackageInputOpts to get a Grafana package, either from the local filesystem (if the package is of type 'file://...') -// or Google Cloud Storage if the package is a 'gs://' URL. -func GetPackages(ctx context.Context, d *dagger.Client, packageOpts *PackageInputOpts, gcpOpts *GCPOpts) ([]*dagger.File, error) { - files := make([]*dagger.File, len(packageOpts.Packages)) - for i, pkg := range packageOpts.Packages { - u, err := url.Parse(pkg) - if err != nil { - return nil, err - } - - var file *dagger.File - switch u.Scheme { - case "file", "fs": - p := strings.TrimPrefix(u.String(), u.Scheme+"://") - f, err := getLocalPackage(ctx, d, p) - if err != nil { - return nil, err - } - - file = f - case "gs": - f, err := getGCSPackage(ctx, d, gcpOpts, u.String()) - if err != nil { - return nil, err - } - - file = f - default: - return nil, fmt.Errorf("%w: %s", ErrorUnrecognizedScheme, u.Scheme) - } - - files[i] = file - } - - return files, nil -} - -func getLocalPackage(ctx context.Context, d *dagger.Client, file string) (*dagger.File, error) { - // pending https://github.com/dagger/dagger/issues/4745 - return d.Host().Directory(filepath.Dir(file)).File(filepath.Base(file)), nil -} - -func getGCSPackage(ctx context.Context, d *dagger.Client, opts *GCPOpts, gcsURL string) (*dagger.File, error) { - auth := GCSAuth(d, opts) - return GCSDownloadFile(d, GoogleCloudImage, auth, gcsURL) -} diff --git a/pkg/build/daggerbuild/containers/publish_dir.go b/pkg/build/daggerbuild/containers/publish_dir.go deleted file mode 100644 index abe1ad0bbdd..00000000000 --- a/pkg/build/daggerbuild/containers/publish_dir.go +++ /dev/null @@ -1,62 +0,0 @@ -package containers - -import ( - "context" - "fmt" - "log" - "net/url" - "strings" - - "dagger.io/dagger" -) - -func publishLocalDir(ctx context.Context, dir *dagger.Directory, dst string) error { - if _, err := dir.Export(ctx, dst); err != nil { - return err - } - - return nil -} - -func publishGCSDir(ctx context.Context, d *dagger.Client, dir *dagger.Directory, opts *GCPOpts, dst string) error { - auth := GCSAuth(d, opts) - uploader, err := GCSUploadDirectory(d, GoogleCloudImage, auth, dir, dst) - if err != nil { - return err - } - - if _, err := ExitError(ctx, uploader); err != nil { - return err - } - - return nil -} - -// PublishDirectory publishes a directory to the given destination. -func PublishDirectory(ctx context.Context, d *dagger.Client, dir *dagger.Directory, opts *GCPOpts, dst string) (string, error) { - log.Println("Publishing directory", dst) - u, err := url.Parse(dst) - if err != nil { - // If the destination URL is not a URL then we can assume that it's just a filepath. - if err := publishLocalDir(ctx, dir, dst); err != nil { - return "", err - } - return "", err - } - - switch u.Scheme { - case "file", "fs": - dst := strings.TrimPrefix(u.String(), u.Scheme+"://") - if err := publishLocalDir(ctx, dir, dst); err != nil { - return "", err - } - case "gs": - if err := publishGCSDir(ctx, d, dir, opts, dst); err != nil { - return "", err - } - default: - return "", fmt.Errorf("%w: '%s'", ErrorUnrecognizedScheme, u.Scheme) - } - - return dst, nil -} diff --git a/pkg/build/daggerbuild/gcom/opts.go b/pkg/build/daggerbuild/gcom/opts.go deleted file mode 100644 index b2a97839e0b..00000000000 --- a/pkg/build/daggerbuild/gcom/opts.go +++ /dev/null @@ -1,34 +0,0 @@ -package gcom - -import ( - "net/url" - - "github.com/grafana/grafana/pkg/build/daggerbuild/cliutil" -) - -// GCOMOpts are options used when making requests to grafana.com. -type GCOMOpts struct { - URL *url.URL - DownloadURL *url.URL - ApiKey string - Beta bool - Nightly bool -} - -func GCOMOptsFromFlags(c cliutil.CLIContext) (*GCOMOpts, error) { - apiUrl, err := url.Parse(c.String("api-url")) - if err != nil { - return nil, err - } - downloadUrl, err := url.Parse(c.String("download-url")) - if err != nil { - return nil, err - } - return &GCOMOpts{ - URL: apiUrl, - DownloadURL: downloadUrl, - ApiKey: c.String("api-key"), - Beta: c.Bool("beta"), - Nightly: c.Bool("nightly"), - }, nil -} diff --git a/pkg/build/daggerbuild/gcom/publish.go b/pkg/build/daggerbuild/gcom/publish.go deleted file mode 100644 index 8c656f0acf9..00000000000 --- a/pkg/build/daggerbuild/gcom/publish.go +++ /dev/null @@ -1,60 +0,0 @@ -package gcom - -import ( - "context" - "encoding/json" - "fmt" - - "dagger.io/dagger" -) - -type GCOMVersionPayload struct { - Version string `json:"version"` - ReleaseDate string `json:"releaseDate"` - Stable bool `json:"stable"` - Beta bool `json:"beta"` - Nightly bool `json:"nightly"` - WhatsNewURL string `json:"whatsNewUrl"` - ReleaseNotesURL string `json:"releaseNotesUrl"` -} - -type GCOMPackagePayload struct { - OS string `json:"os"` - URL string `json:"url"` - Sha256 string `json:"sha256"` - Arch string `json:"arch"` -} - -// PublishGCOMVersion publishes a version to grafana.com. -func PublishGCOMVersion(ctx context.Context, d *dagger.Client, versionPayload *GCOMVersionPayload, opts *GCOMOpts) (string, error) { - versionApiUrl := opts.URL.JoinPath("/versions") - - jsonVersionPayload, err := json.Marshal(versionPayload) - if err != nil { - return "", err - } - - apiKeySecret := d.SetSecret("gcom-api-key", opts.ApiKey) - - return d.Container().From("alpine/curl"). - WithSecretVariable("GCOM_API_KEY", apiKeySecret). - WithExec([]string{"/bin/sh", "-c", fmt.Sprintf(`curl -H "Content-Type: application/json" -H "Authorization: Bearer $GCOM_API_KEY" -d '%s' %s`, string(jsonVersionPayload), versionApiUrl.String())}). - Stdout(ctx) -} - -// PublishGCOMPackage publishes a package to grafana.com. -func PublishGCOMPackage(ctx context.Context, d *dagger.Client, packagePayload *GCOMPackagePayload, opts *GCOMOpts, version string) (string, error) { - packagesApiUrl := opts.URL.JoinPath("/versions/", version, "/packages") - - jsonPackagePayload, err := json.Marshal(packagePayload) - if err != nil { - return "", err - } - - apiKeySecret := d.SetSecret("gcom-api-key", opts.ApiKey) - - return d.Container().From("alpine/curl"). - WithSecretVariable("GCOM_API_KEY", apiKeySecret). - WithExec([]string{"/bin/sh", "-c", fmt.Sprintf(`curl -H "Content-Type: application/json" -H "Authorization: Bearer $GCOM_API_KEY" -d '%s' %s`, string(jsonPackagePayload), packagesApiUrl.String())}). - Stdout(ctx) -} diff --git a/pkg/build/daggerbuild/pipelines/docker_publish.go b/pkg/build/daggerbuild/pipelines/docker_publish.go deleted file mode 100644 index 1c714026b53..00000000000 --- a/pkg/build/daggerbuild/pipelines/docker_publish.go +++ /dev/null @@ -1,141 +0,0 @@ -package pipelines - -import ( - "context" - "fmt" - "log" - "strings" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/docker" - "golang.org/x/sync/errgroup" - "golang.org/x/sync/semaphore" -) - -func ImageManifest(tag string) string { - log.Println(tag) - log.Println(tag) - log.Println(tag) - log.Println(tag) - manifest := strings.ReplaceAll(tag, "-image-tags", "") - lastDash := strings.LastIndex(manifest, "-") - return manifest[:lastDash] -} - -func LatestManifest(tag string) string { - suffix := "" - if strings.Contains(tag, "ubuntu") { - suffix = "-ubuntu" - } - - manifest := strings.ReplaceAll(tag, "-image-tags", "") - manifestImage := strings.Split(manifest, ":")[0] - return strings.Join([]string{manifestImage, fmt.Sprintf("latest%s", suffix)}, ":") -} - -// PublishDocker is a pipeline that uses a grafana.docker.tar.gz as input and publishes a Docker image to a container registry or repository. -// Grafana's Dockerfile should support supplying a tar.gz using a --build-arg. -func PublishDocker(ctx context.Context, d *dagger.Client, args PipelineArgs) error { - opts := args.DockerOpts - packages, err := containers.GetPackages(ctx, d, args.PackageInputOpts, args.GCPOpts) - if err != nil { - return err - } - - var ( - wg = &errgroup.Group{} - sm = semaphore.NewWeighted(args.ConcurrencyOpts.Parallel) - ) - - manifestTags := make(map[string][]string) - for i, name := range args.PackageInputOpts.Packages { - // For each package we retrieve the tags grafana-image-tags and grafana-oss-image-tags, or grafana-enterprise-image-tags - format := opts.TagFormat - if strings.Contains(name, "ubuntu") { - format = opts.UbuntuTagFormat - } - - tarOpts := TarOptsFromFileName(name) - - tags, err := docker.Tags(opts.Org, opts.Registry, []string{opts.Repository}, format, tarOpts.NameOpts()) - if err != nil { - return err - } - log.Println(tags) - for _, tag := range tags { - // For each tag we publish an image and add the tag to the list of tags for a specific manifest - // Since each package has a maximum of 2 tags, this for loop will only run twice on a worst case scenario - manifest := ImageManifest(tag) - manifestTags[manifest] = append(manifestTags[manifest], tag) - - if opts.Latest { - manifest := LatestManifest(tag) - manifestTags[manifest] = append(manifestTags[manifest], tag) - } - - wg.Go(PublishPackageImageFunc(ctx, sm, d, packages[i], tag, opts)) - } - } - - if err := wg.Wait(); err != nil { - // Wait for all images to be published - return err - } - - for manifest, tags := range manifestTags { - // Publish each manifest - wg.Go(PublishDockerManifestFunc(ctx, sm, d, manifest, tags, opts)) - } - - return wg.Wait() -} - -func PublishPackageImageFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, pkg *dagger.File, tag string, opts *docker.DockerOpts) func() error { - return func() error { - log.Printf("[%s] Attempting to publish image", tag) - log.Printf("[%s] Acquiring semaphore", tag) - if err := sm.Acquire(ctx, 1); err != nil { - return fmt.Errorf("failed to acquire semaphore: %w", err) - } - defer sm.Release(1) - log.Printf("[%s] Acquired semaphore", tag) - - log.Printf("[%s] Publishing image", tag) - out, err := docker.PublishPackageImage(ctx, d, pkg, tag, opts.Username, opts.Password, opts.Registry) - if err != nil { - return fmt.Errorf("[%s] error: %w", tag, err) - } - log.Printf("[%s] Done publishing image", tag) - - if _, err := fmt.Fprintln(Stdout, out); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - - return nil - } -} - -func PublishDockerManifestFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, manifest string, tags []string, opts *docker.DockerOpts) func() error { - return func() error { - log.Printf("[%s] Attempting to publish manifest", manifest) - log.Printf("[%s] Acquiring semaphore", manifest) - if err := sm.Acquire(ctx, 1); err != nil { - return fmt.Errorf("failed to acquire semaphore: %w", err) - } - defer sm.Release(1) - log.Printf("[%s] Acquired semaphore", manifest) - - log.Printf("[%s] Publishing manifest", manifest) - out, err := docker.PublishManifest(ctx, d, manifest, tags, opts.Username, opts.Password, opts.Registry) - if err != nil { - return fmt.Errorf("[%s] error: %w", manifest, err) - } - log.Printf("[%s] Done publishing manifest", manifest) - - if _, err := fmt.Fprintln(Stdout, out); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - return nil - } -} diff --git a/pkg/build/daggerbuild/pipelines/docker_publish_test.go b/pkg/build/daggerbuild/pipelines/docker_publish_test.go deleted file mode 100644 index 4bcfe540ad1..00000000000 --- a/pkg/build/daggerbuild/pipelines/docker_publish_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package pipelines_test - -import ( - "testing" - - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" -) - -func TestImageManifest(t *testing.T) { - manifests := map[string]string{ - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana-oss:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana-oss:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana:1.2.3-test.1.2.3-ubuntu", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana-oss:1.2.3-test.1.2.3-ubuntu", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana:1.2.3-test.1.2.3-ubuntu", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana-oss:1.2.3-test.1.2.3-ubuntu", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana-enterprise:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana-enterprise:1.2.3-test.1.2.3", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana-enterprise:1.2.3-test.1.2.3-ubuntu", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana-enterprise:1.2.3-test.1.2.3-ubuntu", - } - - for k, v := range manifests { - if n := pipelines.ImageManifest(k); n != v { - t.Errorf("Expected '%s' manifest to equal '%s' but got '%s'", k, v, n) - } - } -} - -func TestLatestManifest(t *testing.T) { - manifests := map[string]string{ - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana:latest", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana-oss:latest", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana:latest", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana-oss:latest", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana:latest-ubuntu", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana-oss:latest-ubuntu", - "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana:latest-ubuntu", - "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana-oss:latest-ubuntu", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-amd64": "docker.io/grafana/grafana-enterprise:latest", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-arm64": "docker.io/grafana/grafana-enterprise:latest", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-amd64": "docker.io/grafana/grafana-enterprise:latest-ubuntu", - "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-arm64": "docker.io/grafana/grafana-enterprise:latest-ubuntu", - } - - for k, v := range manifests { - if n := pipelines.LatestManifest(k); n != v { - t.Errorf("Expected '%s' manifest to equal '%s' but got '%s'", k, v, n) - } - } -} diff --git a/pkg/build/daggerbuild/pipelines/docker_test.go b/pkg/build/daggerbuild/pipelines/docker_test.go deleted file mode 100644 index 4d6aea01b94..00000000000 --- a/pkg/build/daggerbuild/pipelines/docker_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package pipelines_test - -// -// func TestImageName(t *testing.T) { -// // Normally I don't advocate for abstracting tests using test cases -// // but I think in this case I would really like to get a clearer view into what docker image tags will be produced. -// // Be sure that if you add additional test cases to this that you don't use formatting or concatenation; it should be obvious when looking at the test -// // what the expected output should be. And that value should not change based on another value. -// type tc struct { -// Description string -// Tags []string -// BaseImage pipelines.BaseImage -// DockerOpts *containers.DockerOpts -// TarOpts pipelines.TarFileOpts -// } -// -// var ( -// version = "v1.2.3-test.1.2.3" -// ) -// -// cases := []tc{ -// { -// Description: "Grafana docker images are created for both the 'docker.io/grafana/grafana-image-tags' and 'docker.io/grafana/grafana-oss-image-tags' repositories. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-amd64", -// "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-amd64", -// }, -// }, -// { -// Description: "Grafana docker images are created for both the 'docker.io/grafana/grafana-image-tags' and 'docker.io/grafana/grafana-oss-image-tags' repositories. ARM64 images have a -arm64 suffix. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/arm64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-arm64", -// "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-arm64", -// }, -// }, -// { -// Description: "Grafana docker images are created for both the 'docker.io/grafana/grafana-image-tags' and 'docker.io/grafana/grafana-oss-image-tags' repositories. Ubuntu images have a '-ubuntu' suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageUbuntu, -// Tags: []string{ -// "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-amd64", -// "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-amd64", -// }, -// }, -// { -// Description: "Grafana docker images are created for both the 'docker.io/grafana/grafana-image-tags' and 'docker.io/grafana/grafana-oss-image-tags' repositories. ARM64 images have an -arm64 suffix. Ubuntu images have a '-ubuntu' suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/arm64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageUbuntu, -// Tags: []string{ -// "docker.io/grafana/grafana-image-tags:1.2.3-test.1.2.3-ubuntu-arm64", -// "docker.io/grafana/grafana-oss-image-tags:1.2.3-test.1.2.3-ubuntu-arm64", -// }, -// }, -// { -// Description: "Enterprise docker images are created for only the docker.io/grafana/grafana-enterprise-image-tags repository. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "enterprise", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-amd64", -// }, -// }, -// { -// Description: "Enterprise docker images are created for only the docker.io/grafana/grafana-enterprise-image-tags repository. ARM64 images have an -arm64 suffix. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "enterprise", -// Distro: "linux/arm64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-arm64", -// }, -// }, -// { -// Description: "Enterprise docker images are created for only the docker.io/grafana/grafana-enterprise-image-tags repository. Ubuntu images have a '-ubuntu' suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "enterprise", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageUbuntu, -// Tags: []string{ -// "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-amd64", -// }, -// }, -// { -// Description: "Enterprise docker images are created for only the docker.io/grafana/grafana-enterprise-image-tags repository. ARM64 images have an -arm64 suffix. Ubuntu images have a '-ubuntu' suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "enterprise", -// Distro: "linux/arm64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "grafana", -// Registry: "docker.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageUbuntu, -// Tags: []string{ -// "docker.io/grafana/grafana-enterprise-image-tags:1.2.3-test.1.2.3-ubuntu-arm64", -// }, -// }, -// { -// Description: "Grafana docker images are created for both the 'registry.io/org/grafana-image-tags' and 'registry.io/org/grafana-oss-image-tags' repositories. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "org", -// Registry: "registry.io", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "registry.io/org/grafana-image-tags:1.2.3-test.1.2.3-amd64", -// "registry.io/org/grafana-oss-image-tags:1.2.3-test.1.2.3-amd64", -// }, -// }, -// { -// Description: "Grafana docker images are created for only the 'registry.io/org/grafana-dev' repository. Alpine images have no suffix.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "org", -// Registry: "registry.io", -// Repository: "grafana-dev", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageAlpine, -// Tags: []string{ -// "registry.io/org/grafana-dev:1.2.3-test.1.2.3-amd64", -// }, -// }, -// { -// Description: "Grafana docker images are created for only the 'registry.io/org/grafana-dev' repository.", -// TarOpts: pipelines.TarFileOpts{ -// Edition: "", -// Distro: "linux/amd64", -// Version: version, -// }, -// DockerOpts: &containers.DockerOpts{ -// Org: "org", -// Registry: "registry.io", -// Repository: "grafana-dev", -// TagFormat: pipelines.DefaultTagFormat, -// UbuntuTagFormat: pipelines.DefaultUbuntuTagFormat, -// }, -// BaseImage: pipelines.BaseImageUbuntu, -// Tags: []string{ -// "registry.io/org/grafana-dev:1.2.3-test.1.2.3-ubuntu-amd64", -// }, -// }, -// } -// -// for n, test := range cases { -// t.Run(fmt.Sprintf("[%d / %d] %s", n+1, len(cases), test.Description), func(t *testing.T) { -// expect := sort.StringSlice(test.Tags) -// res, err := pipelines.GrafanaImageTags(test.BaseImage, test.DockerOpts, test.TarOpts) -// if err != nil { -// t.Fatal("Unexpected error:", err.Error()) -// } -// -// for i := range expect { -// e := expect[i] -// r := res[i] -// if e != r { -// t.Errorf("[%d / %d]\nExpected '%s'\nReceived '%s'", i+1, len(expect), e, r) -// } -// } -// }) -// } -// } diff --git a/pkg/build/daggerbuild/pipelines/gcom_publish.go b/pkg/build/daggerbuild/pipelines/gcom_publish.go deleted file mode 100644 index 7fc28d39201..00000000000 --- a/pkg/build/daggerbuild/pipelines/gcom_publish.go +++ /dev/null @@ -1,154 +0,0 @@ -package pipelines - -import ( - "context" - "fmt" - "log" - "path/filepath" - "strings" - "time" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/backend" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/gcom" - "golang.org/x/sync/errgroup" - "golang.org/x/sync/semaphore" -) - -func VersionPayloadFromFileName(name string, opts *gcom.GCOMOpts) *gcom.GCOMVersionPayload { - var ( - tarOpts = TarOptsFromFileName(name) - splitVersion = strings.Split(tarOpts.Version, ".") - stable = true - nightly = false - beta = false - ) - - if opts.Beta { - stable = false - beta = true - } - if opts.Nightly { - stable = false - beta = false - nightly = true - } - - return &gcom.GCOMVersionPayload{ - Version: tarOpts.Version, - ReleaseDate: time.Now().Format(time.RFC3339Nano), - Stable: stable, - Beta: beta, - Nightly: nightly, - WhatsNewURL: fmt.Sprintf("https://grafana.com/docs/grafana/next/whatsnew/whats-new-in-v%s-%s/", splitVersion[0], splitVersion[1]), - ReleaseNotesURL: "https://grafana.com/docs/grafana/next/release-notes/", - } -} - -func PackagePayloadFromFile(ctx context.Context, d *dagger.Client, name string, file *dagger.File, opts *gcom.GCOMOpts) (*gcom.GCOMPackagePayload, error) { - tarOpts := TarOptsFromFileName(name) - ext := filepath.Ext(name) - os, _ := backend.OSAndArch(tarOpts.Distro) - arch := strings.ReplaceAll(backend.FullArch(tarOpts.Distro), "/", "") - - if os == "windows" { - os = "win" - } - - if ext == ".deb" { - os = "deb" - } - if ext == ".rpm" { - os = "rhel" - } - if ext == ".exe" { - os = "win-installer" - } - - sha256, err := containers.Sha256(d, file).Contents(ctx) - if err != nil { - return nil, err - } - - return &gcom.GCOMPackagePayload{ - OS: os, - URL: opts.DownloadURL.JoinPath(name).String(), - Sha256: sha256, - Arch: arch, - }, nil -} - -func PublishGCOM(ctx context.Context, d *dagger.Client, args PipelineArgs) error { - var ( - opts = args.GCOMOpts - wg = &errgroup.Group{} - sm = semaphore.NewWeighted(args.ConcurrencyOpts.Parallel) - ) - - packages, err := containers.GetPackages(ctx, d, args.PackageInputOpts, args.GCPOpts) - if err != nil { - return err - } - - // Extract the package versions - versionPayloads := make(map[string]*gcom.GCOMVersionPayload) - for _, name := range args.PackageInputOpts.Packages { - tarOpts := TarOptsFromFileName(name) - if _, ok := versionPayloads[tarOpts.Version]; !ok { - log.Printf("[%s] Building version payload", tarOpts.Version) - versionPayloads[tarOpts.Version] = VersionPayloadFromFileName(name, opts) - } - } - - // Publish each version only once - for _, p := range versionPayloads { - log.Printf("[%s] Attempting to publish version", p.Version) - out, err := gcom.PublishGCOMVersion(ctx, d, p, opts) - if err != nil { - return err - } - log.Printf("[%s] Done publishing version", p.Version) - if _, err := fmt.Fprintln(Stdout, strings.ReplaceAll(out, "\n", "")); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - } - - // Publish the package(s) - for i, name := range args.PackageInputOpts.Packages { - wg.Go(PublishGCOMPackageFunc(ctx, sm, d, opts, name, packages[i])) - } - return wg.Wait() -} - -func PublishGCOMPackageFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, opts *gcom.GCOMOpts, path string, file *dagger.File) func() error { - return func() error { - name := filepath.Base(path) - tarOpts := TarOptsFromFileName(name) - log.Printf("[%s] Attempting to publish package", name) - log.Printf("[%s] Acquiring semaphore", name) - if err := sm.Acquire(ctx, 1); err != nil { - return fmt.Errorf("failed to acquire semaphore: %w", err) - } - defer sm.Release(1) - log.Printf("[%s] Acquired semaphore", name) - - log.Printf("[%s] Building package payload", name) - packagePayload, err := PackagePayloadFromFile(ctx, d, name, file, opts) - if err != nil { - return fmt.Errorf("[%s] error: %w", name, err) - } - - log.Printf("[%s] Publishing package", name) - out, err := gcom.PublishGCOMPackage(ctx, d, packagePayload, opts, tarOpts.Version) - if err != nil { - return fmt.Errorf("[%s] error: %w", name, err) - } - log.Printf("[%s] Done publishing package", name) - - if _, err := fmt.Fprintln(Stdout, strings.ReplaceAll(out, "\n", "")); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - return nil - } -} diff --git a/pkg/build/daggerbuild/pipelines/npm_publish.go b/pkg/build/daggerbuild/pipelines/npm_publish.go deleted file mode 100644 index aab5366818b..00000000000 --- a/pkg/build/daggerbuild/pipelines/npm_publish.go +++ /dev/null @@ -1,69 +0,0 @@ -package pipelines - -import ( - "context" - "fmt" - "log" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/frontend" - "golang.org/x/sync/errgroup" - "golang.org/x/sync/semaphore" -) - -func PublishNPM(ctx context.Context, d *dagger.Client, args PipelineArgs) error { - var ( - wg = &errgroup.Group{} - sm = semaphore.NewWeighted(args.ConcurrencyOpts.Parallel) - ) - - packages, err := containers.GetPackages(ctx, d, args.PackageInputOpts, args.GCPOpts) - if err != nil { - return err - } - - // Extract the package(s) - for i := range args.PackageInputOpts.Packages { - var ( - // name = ReplaceExt(v, "") - targz = packages[i] - ) - - artifacts := containers.ExtractedArchive(d, targz).Directory("npm-artifacts") - - entries, err := artifacts.Entries(ctx) - if err != nil { - return err - } - - for _, path := range entries { - wg.Go(PublishNPMFunc(ctx, sm, d, artifacts.File(path), path, args.NpmToken, args.NpmRegistry, args.NpmTags)) - } - } - return wg.Wait() -} - -func PublishNPMFunc(ctx context.Context, sm *semaphore.Weighted, d *dagger.Client, pkg *dagger.File, path, token, registry string, tags []string) func() error { - return func() error { - log.Printf("[%s] Attempting to publish package", path) - log.Printf("[%s] Acquiring semaphore", path) - if err := sm.Acquire(ctx, 1); err != nil { - return fmt.Errorf("failed to acquire semaphore: %w", err) - } - defer sm.Release(1) - log.Printf("[%s] Acquired semaphore", path) - - log.Printf("[%s] Publishing package", path) - out, err := frontend.PublishNPM(ctx, d, pkg, token, registry, tags) - if err != nil { - return fmt.Errorf("[%s] error: %w", path, err) - } - log.Printf("[%s] Done publishing package", path) - - if _, err := fmt.Fprintln(Stdout, out); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - return nil - } -} diff --git a/pkg/build/daggerbuild/pipelines/package_names.go b/pkg/build/daggerbuild/pipelines/package_names.go deleted file mode 100644 index 55b4898345b..00000000000 --- a/pkg/build/daggerbuild/pipelines/package_names.go +++ /dev/null @@ -1,87 +0,0 @@ -package pipelines - -import ( - "fmt" - "path/filepath" - "strings" - - "github.com/grafana/grafana/pkg/build/daggerbuild/backend" - "github.com/grafana/grafana/pkg/build/daggerbuild/packages" -) - -type TarFileOpts struct { - // Name is the name of the product in the package. 99% of the time, this will be "grafana" or "grafana-enterprise". - Name string - Version string - BuildID string - // Edition is the flavor text after "grafana-", like "enterprise". - Edition string - Distro backend.Distribution - Suffix string -} - -func (opts *TarFileOpts) NameOpts() packages.NameOpts { - return packages.NameOpts{ - // Name is the name of the product in the package. 99% of the time, this will be "grafana" or "grafana-enterprise". - Name: packages.Name(opts.Name), - Version: opts.Version, - BuildID: opts.BuildID, - Distro: opts.Distro, - } -} - -func WithoutExt(name string) string { - ext := filepath.Ext(name) - n := strings.TrimSuffix(name, ext) - - // Explicitly handle `.gz` which might will also probably have a `.tar` extension as well. - if ext == ".gz" { - n = strings.TrimSuffix(n, ".ubuntu.docker.tar") - n = strings.TrimSuffix(n, ".docker.tar") - n = strings.TrimSuffix(n, ".tar") - } - - return n -} - -func TarOptsFromFileName(filename string) TarFileOpts { - filename = filepath.Base(filename) - n := WithoutExt(filename) - components := strings.Split(n, "_") - if len(components) != 5 { - return TarFileOpts{} - } - - var ( - name = components[0] - version = components[1] - buildID = components[2] - os = components[3] - arch = components[4] - ) - if archv := strings.Split(arch, "-"); len(archv) == 2 { - // The reverse operation of removing the 'v' for 'arm' because the golang environment variable - // GOARM doesn't want it, but the docker --platform flag either doesn't care or does want it. - if archv[0] == "arm" { - archv[1] = "v" + archv[1] - } - - // arm-7 should become arm/v7 - arch = strings.Join([]string{archv[0], archv[1]}, "/") - } - edition := "" - suffix := "" - if n := strings.Split(name, "-"); len(n) != 1 { - edition = strings.Join(n[1:], "-") - suffix = fmt.Sprintf("-%s", n[1]) - } - - return TarFileOpts{ - Name: name, - Edition: edition, - Version: version, - BuildID: buildID, - Distro: backend.Distribution(strings.Join([]string{os, arch}, "/")), - Suffix: suffix, - } -} diff --git a/pkg/build/daggerbuild/pipelines/package_names_test.go b/pkg/build/daggerbuild/pipelines/package_names_test.go deleted file mode 100644 index d4f050178fa..00000000000 --- a/pkg/build/daggerbuild/pipelines/package_names_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package pipelines_test - -import ( - "testing" - - "github.com/grafana/grafana/pkg/build/daggerbuild/backend" - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" -) - -func TestWithoutExt(t *testing.T) { - names := map[string]string{ - "grafana_v1.0.1-test_333_plan9_amd64.tar.gz": "grafana_v1.0.1-test_333_plan9_amd64", - "grafana-enterprise_v1.0.1-test_333_plan9_amd64.tar.gz": "grafana-enterprise_v1.0.1-test_333_plan9_amd64", - "grafana-enterprise_v1.0.1-test_333_plan9_arm-6.tar.gz": "grafana-enterprise_v1.0.1-test_333_plan9_arm-6", - "grafana-enterprise_v1.0.1-test_333_plan9_amd64.deb": "grafana-enterprise_v1.0.1-test_333_plan9_amd64", - "grafana-enterprise_v1.0.1-test_333_plan9_arm-6.deb": "grafana-enterprise_v1.0.1-test_333_plan9_arm-6", - "grafana-enterprise_v1.0.1-test_333_plan9_arm-6.docker.tar.gz": "grafana-enterprise_v1.0.1-test_333_plan9_arm-6", - "grafana-enterprise_v1.0.1-test_333_plan9_arm-6.ubuntu.docker.tar.gz": "grafana-enterprise_v1.0.1-test_333_plan9_arm-6", - } - - for k, v := range names { - if n := pipelines.WithoutExt(k); n != v { - t.Errorf("Expected '%s' without file name to equal '%s' but got '%s'", k, v, n) - } - } -} - -func TestOptsFromFile(t *testing.T) { - t.Run("It should get the correct tar file opts from a valid name", func(t *testing.T) { - name := "grafana-enterprise_v1.0.1-test_333_plan9_arm-6.tar.gz" - distro := backend.Distribution("plan9/arm/v6") - expect := pipelines.TarFileOpts{ - Edition: "enterprise", - Version: "v1.0.1-test", - BuildID: "333", - Distro: distro, - } - got := pipelines.TarOptsFromFileName(name) - if got.Edition != expect.Edition { - t.Errorf("got.Edition != expect.Edition, expected '%s'", expect.Edition) - } - if got.Version != expect.Version { - t.Errorf("got.Version != expect.Version, expected '%s', got '%s'", expect.Version, got.Version) - } - if got.BuildID != expect.BuildID { - t.Errorf("got.BuildID != expect.BuildID, expected '%s', got '%s'", expect.BuildID, got.BuildID) - } - if got.Distro != expect.Distro { - t.Errorf("got.Distro != expect.Distro, expected '%s', got '%s'", expect.Distro, got.Distro) - } - }) - t.Run("It should consider only the basename", func(t *testing.T) { - name := "somewhere/grafana-enterprise_v1.0.1-test_333_plan9_arm-6.tar.gz" - distro := backend.Distribution("plan9/arm/v6") - expect := pipelines.TarFileOpts{ - Edition: "enterprise", - Version: "v1.0.1-test", - BuildID: "333", - Distro: distro, - } - got := pipelines.TarOptsFromFileName(name) - if got.Edition != expect.Edition { - t.Errorf("got.Edition != expect.Edition, expected '%s'", expect.Edition) - } - if got.Version != expect.Version { - t.Errorf("got.Version != expect.Version, expected '%s', got '%s'", expect.Version, got.Version) - } - if got.BuildID != expect.BuildID { - t.Errorf("got.BuildID != expect.BuildID, expected '%s', got '%s'", expect.BuildID, got.BuildID) - } - if got.Distro != expect.Distro { - t.Errorf("got.Distro != expect.Distro, expected '%s', got '%s'", expect.Distro, got.Distro) - } - }) - t.Run("It should support editions with multiple hyphens", func(t *testing.T) { - name := "somewhere/grafana-enterprise-rpi_v1.0.1-test_333_plan9_arm-6.tar.gz" - distro := backend.Distribution("plan9/arm/v6") - expect := pipelines.TarFileOpts{ - Edition: "enterprise-rpi", - Version: "v1.0.1-test", - BuildID: "333", - Distro: distro, - } - got := pipelines.TarOptsFromFileName(name) - if got.Edition != expect.Edition { - t.Errorf("got.Edition != expect.Edition, expected '%s', got '%s'", expect.Edition, got.Edition) - } - if got.Version != expect.Version { - t.Errorf("got.Version != expect.Version, expected '%s', got '%s'", expect.Version, got.Version) - } - if got.BuildID != expect.BuildID { - t.Errorf("got.BuildID != expect.BuildID, expected '%s', got '%s'", expect.BuildID, got.BuildID) - } - if got.Distro != expect.Distro { - t.Errorf("got.Distro != expect.Distro, expected '%s', got '%s'", expect.Distro, got.Distro) - } - }) -} diff --git a/pkg/build/daggerbuild/pipelines/package_publish.go b/pkg/build/daggerbuild/pipelines/package_publish.go deleted file mode 100644 index 017500dd7f5..00000000000 --- a/pkg/build/daggerbuild/pipelines/package_publish.go +++ /dev/null @@ -1,34 +0,0 @@ -package pipelines - -import ( - "context" - "fmt" - "os" - "path/filepath" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" -) - -// PublishPackage takes one or multiple grafana.tar.gz as input and publishes it to a set destination. -func PublishPackage(ctx context.Context, d *dagger.Client, args PipelineArgs) error { - packages, err := containers.GetPackages(ctx, d, args.PackageInputOpts, args.GCPOpts) - if err != nil { - return err - } - - c := d.Container().From("alpine") - for i, name := range args.PackageInputOpts.Packages { - c = c.WithFile("/dist/"+filepath.Base(name), packages[i]) - } - - dst, err := containers.PublishDirectory(ctx, d, c.Directory("dist"), args.GCPOpts, args.PublishOpts.Destination) - if err != nil { - return err - } - if _, err := fmt.Fprintln(os.Stdout, dst); err != nil { - return fmt.Errorf("error writing to stdout: %w", err) - } - - return nil -} diff --git a/pkg/build/daggerbuild/pipelines/package_test.go b/pkg/build/daggerbuild/pipelines/package_test.go deleted file mode 100644 index 75ee9bcf220..00000000000 --- a/pkg/build/daggerbuild/pipelines/package_test.go +++ /dev/null @@ -1 +0,0 @@ -package pipelines_test diff --git a/pkg/build/daggerbuild/pipelines/pipeline_args.go b/pkg/build/daggerbuild/pipelines/pipeline_args.go deleted file mode 100644 index 00352368027..00000000000 --- a/pkg/build/daggerbuild/pipelines/pipeline_args.go +++ /dev/null @@ -1,147 +0,0 @@ -// package pipelines has functions and types that orchestrate containers. -package pipelines - -import ( - "context" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/cliutil" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/docker" - "github.com/grafana/grafana/pkg/build/daggerbuild/gcom" - "github.com/grafana/grafana/pkg/build/daggerbuild/gpg" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" -) - -type PipelineFunc func(context.Context, *dagger.Client, *dagger.Directory, PipelineArgs) error -type PipelineFuncWithPackageInput func(context.Context, *dagger.Client, PipelineArgs) error - -func DockerOptsFromFlags(c cliutil.CLIContext) *docker.DockerOpts { - return &docker.DockerOpts{ - Registry: c.String("registry"), - AlpineBase: c.String("alpine-base"), - UbuntuBase: c.String("ubuntu-base"), - Username: c.String("username"), - Password: c.String("password"), - Org: c.String("org"), - Repository: c.String("repo"), - Latest: c.Bool("latest"), - TagFormat: c.String("tag-format"), - UbuntuTagFormat: c.String("ubuntu-tag-format"), - } -} - -type ConcurrencyOpts struct { - Parallel int64 -} - -func ConcurrencyOptsFromFlags(c cliutil.CLIContext) *ConcurrencyOpts { - return &ConcurrencyOpts{ - Parallel: c.Int64("parallel"), - } -} - -type PipelineArgs struct { - // These arguments are ones that are available at the global level. - Verbose bool - - // Platform, where applicable, specifies what platform (linux/arm64, for example) to run the dagger containers on. - // This should really only be used if you know what you're doing. misusing this flag can result in really slow builds. - // Some example scenarios where you might want to use this: - // * You're on linux/amd64 and you're building a docker image for linux/armv7 or linux/arm64 - // * You're on linux/arm64 and you're building a package for linux/arm64 - Platform dagger.Platform - - // Context is available for all sub-commands that define their own flags. - Context cliutil.CLIContext - - // GrafanaOpts will be populated if the GrafanaFlags are enabled on the current sub-command. - // GrafanaOpts *containers.GrafanaOpts - - // PackageOpts will be populated if the PackageFlags are enabled on the current sub-command. - // PackageOpts *containers.PackageOpts - - // PublishOpts will be populated if the PublishFlags flags are enabled on the current sub-command - // This is set for pipelines that publish artifacts. - PublishOpts *containers.PublishOpts - - // PackageInputOpts will be populated if the PackageInputFlags are enabled on current sub-command. - // This is set for pipelines that accept a package as input. - PackageInputOpts *containers.PackageInputOpts - GPGOpts *gpg.GPGOpts - DockerOpts *docker.DockerOpts - GCPOpts *containers.GCPOpts - ConcurrencyOpts *ConcurrencyOpts - - // ProImageOpts will be populated if ProImageFlags are enabled on the current sub-command. - ProImageOpts *containers.ProImageOpts - - // NPMOpts will be populated if NPMFlags are enabled on the current sub-command. - NpmToken string - NpmRegistry string - NpmTags []string - - // GCOMOpts will be populated if GCOMFlags are enabled on the current sub-command. - GCOMOpts *gcom.GCOMOpts -} - -// PipelineArgsFromContext populates a pipelines.PipelineArgs from a CLI context. -func PipelineArgsFromContext(ctx context.Context, c cliutil.CLIContext) (PipelineArgs, error) { - // Global flags - var ( - verbose = c.Bool("v") - platform = c.String("platform") - ) - // grafanaOpts, err := containers.GrafanaOptsFromFlags(ctx, c) - // if err != nil { - // return PipelineArgs{}, err - // } - gcomOpts, err := gcom.GCOMOptsFromFlags(c) - if err != nil { - return PipelineArgs{}, err - } - - return PipelineArgs{ - Context: c, - Verbose: verbose, - Platform: dagger.Platform(platform), - // GrafanaOpts: grafanaOpts, - GPGOpts: &gpg.GPGOpts{}, - // PackageOpts: containers.PackageOptsFromFlags(c), - PublishOpts: containers.PublishOptsFromFlags(c), - PackageInputOpts: containers.PackageInputOptsFromFlags(c), - DockerOpts: DockerOptsFromFlags(c), - GCPOpts: containers.GCPOptsFromFlags(c), - ConcurrencyOpts: ConcurrencyOptsFromFlags(c), - ProImageOpts: containers.ProImageOptsFromFlags(c), - GCOMOpts: gcomOpts, - NpmToken: c.String("token"), - NpmRegistry: c.String("registry"), - NpmTags: c.StringSlice("tag"), - }, nil -} - -// InjectPipelineArgsIntoSpan is used to copy some of the arguments passed to -// the pipeline into a top-level OpenTelemtry span. Fields that might contain -// secrets are left out. -func InjectPipelineArgsIntoSpan(span trace.Span, args PipelineArgs) { - attributes := make([]attribute.KeyValue, 0, 10) - attributes = append(attributes, attribute.String("platform", string(args.Platform))) - // if args.GrafanaOpts != nil { - // attributes = append(attributes, attribute.String("go-version", args.GrafanaOpts.GoVersion)) - // attributes = append(attributes, attribute.String("version", args.GrafanaOpts.Version)) - // attributes = append(attributes, attribute.String("grafana-dir", args.GrafanaOpts.GrafanaDir)) - // attributes = append(attributes, attribute.String("grafana-ref", args.GrafanaOpts.GrafanaRef)) - // attributes = append(attributes, attribute.String("enterprise-dir", args.GrafanaOpts.EnterpriseDir)) - // attributes = append(attributes, attribute.String("enterprise-ref", args.GrafanaOpts.EnterpriseRef)) - // } - // if args.PackageOpts != nil { - // distros := []string{} - // for _, distro := range args.PackageOpts.Distros { - // distros = append(distros, string(distro)) - // } - // attributes = append(attributes, attribute.StringSlice("package-distros", distros)) - // } - span.SetAttributes(attributes...) -} diff --git a/pkg/build/daggerbuild/pipelines/pipeline_args_test.go b/pkg/build/daggerbuild/pipelines/pipeline_args_test.go deleted file mode 100644 index 661daa56dec..00000000000 --- a/pkg/build/daggerbuild/pipelines/pipeline_args_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package pipelines_test - -// type TestCLIContext struct { -// Data map[string]interface{} -// } -// -// func (t *TestCLIContext) Bool(key string) bool { -// if _, ok := t.Data[key]; !ok { -// return false -// } -// -// return t.Data[key].(bool) -// } -// -// func (t *TestCLIContext) String(key string) string { -// if _, ok := t.Data[key]; !ok { -// return "" -// } -// -// return t.Data[key].(string) -// } -// -// func (t *TestCLIContext) Set(key string, val string) error { -// t.Data[key] = val -// -// return nil -// } -// -// func (t *TestCLIContext) StringSlice(key string) []string { -// if _, ok := t.Data[key]; !ok { -// return nil -// } -// return t.Data[key].([]string) -// } -// -// func (t *TestCLIContext) Path(key string) string { -// return t.Data[key].(string) -// } -// -// func (t *TestCLIContext) Int64(key string) int64 { -// if _, ok := t.Data[key]; !ok { -// return 0 -// } -// -// return t.Data[key].(int64) -// } -// -// func TestPipelineArgsFromContext(t *testing.T) { -// enterpriseDir, err := os.MkdirTemp("", "grafana-enterprise-*") -// if err != nil { -// t.Fatal(err) -// } -// -// validData := map[string]interface{}{ -// "v": true, -// "version": "v1.0.0", -// "grafana": true, -// "grafana-dir": "/grafana", -// "grafana-ref": "asdf", -// "enterprise": true, -// "enterprise-dir": enterpriseDir, -// "enterprise-ref": "1234", -// "build-id": "build-1234", -// "github-token": "", -// "sign": false, -// } -// -// // t.Run("It should return a PipelineArgs object if there are no errors", func(t *testing.T) { -// // args, err := pipelines.PipelineArgsFromContext(context.Background(), &TestCLIContext{ -// // Data: validData, -// // }) -// // if err != nil { -// // t.Fatal(err) -// // } -// -// // if args.Verbose != true { -// // t.Error("args.Verbose should be true") -// // } -// // // opts := args.GrafanaOpts -// // // if opts.Version != "v1.0.0" { -// // // t.Error("args.Version should be v1.0.0") -// // // } -// -// // if opts.BuildGrafana != true { -// // t.Error("args.BuildGrafana should be true") -// // } -// -// // if opts.GrafanaDir != "/grafana" { -// // t.Error("args.GrafanaDir should be /grafana") -// // } -// -// // if opts.GrafanaRef != "asdf" { -// // t.Error("args.GrafanaRef should be asdf") -// // } -// -// // if opts.BuildEnterprise != true { -// // t.Error("args.Enterprise should be true") -// // } -// -// // if opts.EnterpriseDir != enterpriseDir { -// // t.Errorf("args.EnterpriseDir should be %s", enterpriseDir) -// // } -// -// // if opts.EnterpriseRef != "1234" { -// // t.Error("args.EnterpriseRef should be 1234") -// // } -// // }) -// -// // t.Run("If no build ID is provided, a random 12-character string should be given", func(t *testing.T) { -// // data := validData -// // data["build-id"] = "" -// // args, err := pipelines.PipelineArgsFromContext(context.Background(), &TestCLIContext{ -// // Data: data, -// // }) -// // if err != nil { -// // t.Fatal(err) -// // } -// // opts := args.GrafanaOpts -// // if opts.BuildID == "" { -// // t.Fatal("BuildID should not be empty") -// // } -// // if len(opts.BuildID) != 12 { -// // t.Fatal("BuildID should be a 12-character string") -// // } -// // }) -// -// // t.Run("If the --enterprise-ref is set to a non-default value, it should set the enterprise flag to true", func(t *testing.T) { -// // data := validData -// // data["enterprise"] = false -// // data["enterprise-ref"] = "ref-1234" -// -// // args, err := pipelines.PipelineArgsFromContext(context.Background(), &TestCLIContext{ -// // Data: data, -// // }) -// // if err != nil { -// // t.Fatal(err) -// // } -// // opts := args.GrafanaOpts -// // if opts.BuildEnterprise != true { -// // t.Fatal("args.BuildEnterprise should be true") -// // } -// // }) -// -// t.Run("If the --enterprise-ref is set to a non-default value, it should set the enterprise flag to true", func(t *testing.T) { -// data := validData -// data["enterprise"] = false -// data["enterprise-ref"] = "" -// data["enterprise-dir"] = filepath.Join(enterpriseDir, "does-not-exist") -// -// _, err := pipelines.PipelineArgsFromContext(context.Background(), &TestCLIContext{ -// Data: data, -// }) -// if err == nil { -// t.Fatal("error should not be empty") -// } -// }) -// } diff --git a/pkg/build/daggerbuild/pipelines/pro_image.go b/pkg/build/daggerbuild/pipelines/pro_image.go deleted file mode 100644 index 45d886fbde9..00000000000 --- a/pkg/build/daggerbuild/pipelines/pro_image.go +++ /dev/null @@ -1,85 +0,0 @@ -package pipelines - -import ( - "context" - "fmt" - "log" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/git" -) - -func ProImage(ctx context.Context, dc *dagger.Client, args PipelineArgs) error { - if len(args.PackageInputOpts.Packages) > 1 { - return fmt.Errorf("only one package is allowed: packages=%+v", args.PackageInputOpts.Packages) - } - packages, err := containers.GetPackages(ctx, dc, args.PackageInputOpts, args.GCPOpts) - if err != nil { - return fmt.Errorf("getting packages: packages=%+v %w", args.PackageInputOpts.Packages, err) - } - - debianPackageFile := packages[0] - - log.Printf("Cloning hosted Grafana...") - hostedGrafanaRepo, err := git.CloneWithGitHubToken(dc, args.ProImageOpts.GitHubToken, "https://github.com/grafana/hosted-grafana.git", "main") - if err != nil { - return fmt.Errorf("cloning hosted-grafana repo: %w", err) - } - - socketPath := "/var/run/docker.sock" - socket := dc.Host().UnixSocket(socketPath) - - hostedGrafanaImage := fmt.Sprintf("%s/%s:%s", args.ProImageOpts.ContainerRegistry, args.ProImageOpts.Repo, args.ProImageOpts.ImageTag) - - log.Printf("Building hosted Grafana image: %s", hostedGrafanaImage) - container := dc.Container().From("google/cloud-sdk:433.0.0-alpine"). - WithExec([]string{ - "/bin/sh", "-c", - "gcloud auth configure-docker --quiet", - }). - WithUnixSocket(socketPath, socket). - WithDirectory("/src", hostedGrafanaRepo). - WithFile("/src/grafana.deb", debianPackageFile). - WithWorkdir("/src"). - WithExec([]string{ - "/bin/sh", "-c", - "docker build --platform=linux/amd64 . -f ./cmd/hgrun/Dockerfile -t hgrun:latest", - }). - WithExec([]string{ - "/bin/sh", "-c", - fmt.Sprintf("docker build --platform=linux/amd64 --build-arg=RELEASE_TYPE=%s --build-arg=GRAFANA_VERSION=%s --build-arg=HGRUN_IMAGE=hgrun:latest . -f ./docker/hosted-grafana-all/Dockerfile -t %s", - args.ProImageOpts.ReleaseType, - args.ProImageOpts.GrafanaVersion, - hostedGrafanaImage, - ), - }) - - if args.ProImageOpts.Push { - if args.ProImageOpts.ContainerRegistry == "" { - return fmt.Errorf("--registry= is required") - } - - authenticator := containers.GCSAuth(dc, &containers.GCPOpts{ - ServiceAccountKey: args.GCPOpts.ServiceAccountKey, - ServiceAccountKeyBase64: args.GCPOpts.ServiceAccountKeyBase64, - }) - - authenticatedContainer, err := authenticator.Authenticate(dc, container) - if err != nil { - return fmt.Errorf("authenticating container with gcs auth: %w", err) - } - - log.Printf("Pushing hosted Grafana image to registry...") - container = authenticatedContainer.WithExec([]string{ - "/bin/sh", "-c", - fmt.Sprintf("docker push %s", hostedGrafanaImage), - }) - } - - if _, err := containers.ExitError(ctx, container); err != nil { - return fmt.Errorf("container did not exit successfully: %w", err) - } - - return nil -} diff --git a/pkg/build/daggerbuild/pipelines/publish.go b/pkg/build/daggerbuild/pipelines/publish.go deleted file mode 100644 index d7ec8de3d1f..00000000000 --- a/pkg/build/daggerbuild/pipelines/publish.go +++ /dev/null @@ -1,29 +0,0 @@ -package pipelines - -import ( - "io" - "os" - "sync" -) - -type SyncWriter struct { - Writer io.Writer - - mutex *sync.Mutex -} - -func NewSyncWriter(w io.Writer) *SyncWriter { - return &SyncWriter{ - Writer: w, - mutex: &sync.Mutex{}, - } -} - -func (w *SyncWriter) Write(b []byte) (int, error) { - w.mutex.Lock() - defer w.mutex.Unlock() - - return w.Writer.Write(b) -} - -var Stdout = NewSyncWriter(os.Stdout) diff --git a/pkg/build/daggerbuild/scripts/drone_build_main.sh b/pkg/build/daggerbuild/scripts/drone_build_main.sh deleted file mode 100755 index 4c584cdc3a1..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_main.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env sh - -local_dst="dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:grafana:linux/amd64 \ - -a targz:grafana:linux/arm64 \ - -a targz:grafana:linux/arm/v6 \ - -a targz:grafana:linux/arm/v7 \ - -a targz:grafana:windows/amd64 \ - -a targz:grafana:darwin/amd64 \ - -a deb:grafana:linux/amd64 \ - -a deb:grafana:linux/arm64 \ - -a deb:grafana:linux/arm/v6 \ - -a deb:grafana:linux/arm/v7 \ - -a docker:grafana:linux/amd64 \ - -a docker:grafana:linux/arm64 \ - -a docker:grafana:linux/arm/v7 \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --checksum \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-dir=${GRAFANA_DIR} \ - --github-token=${GITHUB_TOKEN} \ - --ubuntu-base=${UBUNTU_BASE} \ - --alpine-base=${ALPINE_BASE} \ - --destination=${local_dst} > assets.txt - -echo "Final list of artifacts:" -cat assets.txt - -# Move the tar.gz packages to their expected locations -cat assets.txt | IS_MAIN=true go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/main diff --git a/pkg/build/daggerbuild/scripts/drone_build_main_enterprise.sh b/pkg/build/daggerbuild/scripts/drone_build_main_enterprise.sh deleted file mode 100755 index 4e04d60343c..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_main_enterprise.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env sh -local_dst="dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:enterprise:linux/amd64 \ - -a targz:enterprise:linux/arm64 \ - -a targz:enterprise:linux/arm/v6 \ - -a targz:enterprise:linux/arm/v7 \ - -a deb:enterprise:linux/amd64 \ - -a deb:enterprise:linux/arm64 \ - -a deb:enterprise:linux/arm/v6 \ - -a deb:enterprise:linux/arm/v7 \ - -a docker:enterprise:linux/amd64 \ - -a docker:enterprise:linux/arm64 \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --checksum \ - --verify \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-ref=${SOURCE_COMMIT} \ - --grafana-repo="https://github.com/grafana/grafana.git" \ - --enterprise-ref=${DRONE_COMMIT} \ - --github-token=${GITHUB_TOKEN} \ - --ubuntu-base=${UBUNTU_BASE} \ - --alpine-base=${ALPINE_BASE} \ - --patches-repo=${PATCHES_REPO} \ - --patches-path=${PATCHES_PATH} \ - --destination=${local_dst} > assets.txt - -cat assets.txt - -# Move the tar.gz packages to their expected locations -cat assets.txt | DESTINATION=gs://grafana-downloads IS_MAIN=true go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/main diff --git a/pkg/build/daggerbuild/scripts/drone_build_main_pro.sh b/pkg/build/daggerbuild/scripts/drone_build_main_pro.sh deleted file mode 100755 index 932c6420d08..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_main_pro.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env sh -local_dst="./dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all -# Build all of the grafana.tar.gz packages. -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:pro:linux/amd64 \ - -a targz:pro:linux/arm64 \ - -a deb:pro:linux/amd64 \ - -a deb:pro:linux/arm64 \ - -a frontend:enterprise \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --checksum \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-ref=${SOURCE_COMMIT} \ - --grafana-repo="https://github.com/grafana/grafana.git" \ - --enterprise-ref=${DRONE_COMMIT} \ - --github-token=${GITHUB_TOKEN} \ - --ubuntu-base=${UBUNTU_BASE} \ - --alpine-base=${ALPINE_BASE} \ - --patches-repo=${PATCHES_REPO} \ - --patches-path=${PATCHES_PATH} \ - --destination=${local_dst} > assets.txt - -echo "Final list of artifacts:" -# Move the tar.gz packages to their expected locations -cat assets.txt | grep -v "public" | DESTINATION=gs://grafana-downloads-enterprise2 IS_MAIN=true go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/main -cat assets.txt | grep "public" | DESTINATION=gs://grafana-static-assets IS_MAIN=true go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/cdn diff --git a/pkg/build/daggerbuild/scripts/drone_build_nightly_enterprise.sh b/pkg/build/daggerbuild/scripts/drone_build_nightly_enterprise.sh deleted file mode 100755 index 2f616bd5055..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_nightly_enterprise.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env sh -set -e -local_dst="${DRONE_WORKSPACE}/dist" - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - - # -a targz:enterprise:linux/arm/v6 \ - # -a targz:enterprise:linux/arm/v7 \ - # -a deb:enterprise:linux/arm/v6:nightly \ - # -a deb:enterprise:linux/arm/v7:nightly \ - # -a docker:enterprise:linux/arm/v7 \ - # -a docker:enterprise:linux/arm/v7:ubuntu \ - -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:enterprise:linux/amd64 \ - -a targz:enterprise:linux/arm64 \ - -a targz:enterprise:linux/arm/v7 \ - -a targz:enterprise:linux/arm/v6 \ - -a deb:enterprise:linux/amd64:nightly \ - -a deb:enterprise:linux/arm64:nightly \ - -a deb:enterprise:linux/arm/v6:nightly \ - -a deb:enterprise:linux/arm/v7:nightly \ - -a rpm:enterprise:linux/amd64:sign:nightly \ - -a rpm:enterprise:linux/arm64:sign:nightly \ - -a targz:enterprise:windows/amd64 \ - -a targz:enterprise:windows/arm64 \ - -a targz:enterprise:darwin/amd64 \ - -a targz:enterprise:darwin/arm64 \ - -a zip:enterprise:windows/amd64 \ - -a msi:enterprise:windows/amd64 \ - -a docker:enterprise:linux/amd64 \ - -a docker:enterprise:linux/arm64 \ - -a docker:enterprise:linux/arm/v7 \ - -a docker:enterprise:linux/amd64:ubuntu \ - -a docker:enterprise:linux/arm64:ubuntu \ - -a docker:enterprise:linux/arm/v7:ubuntu \ - --checksum \ - --verify=false \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-ref=main \ - --enterprise-ref=main \ - --grafana-repo=https://github.com/grafana/grafana.git \ - --github-token=${GITHUB_TOKEN} \ - --destination=${local_dst} \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --ubuntu-base="${UBUNTU_BASE}" \ - --alpine-base="${ALPINE_BASE}" > assets.txt - -cat assets.txt diff --git a/pkg/build/daggerbuild/scripts/drone_build_nightly_grafana.sh b/pkg/build/daggerbuild/scripts/drone_build_nightly_grafana.sh deleted file mode 100755 index 495eda0e282..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_nightly_grafana.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env sh -set -e -local_dst="${DRONE_WORKSPACE}/dist" - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:grafana:linux/amd64 \ - -a targz:grafana:linux/arm64 \ - -a targz:grafana:linux/arm/v7 \ - -a targz:grafana:linux/arm/v6 \ - -a deb:grafana:linux/amd64:nightly \ - -a deb:grafana:linux/arm64:nightly \ - -a deb:grafana:linux/arm/v6:nightly \ - -a deb:grafana:linux/arm/v7:nightly \ - -a rpm:grafana:linux/amd64:sign:nightly \ - -a rpm:grafana:linux/arm64:sign:nightly \ - -a targz:grafana:windows/amd64 \ - -a targz:grafana:windows/arm64 \ - -a targz:grafana:darwin/amd64 \ - -a targz:grafana:darwin/arm64 \ - -a zip:grafana:windows/amd64 \ - -a msi:grafana:windows/amd64 \ - -a docker:grafana:linux/amd64 \ - -a docker:grafana:linux/arm64 \ - -a docker:grafana:linux/arm/v7 \ - -a docker:grafana:linux/amd64:ubuntu \ - -a docker:grafana:linux/arm64:ubuntu \ - -a docker:grafana:linux/arm/v7:ubuntu \ - --checksum \ - --verify \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-dir=${GRAFANA_DIR} \ - --github-token=${GITHUB_TOKEN} \ - --destination=${local_dst} \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --ubuntu-base="${UBUNTU_BASE}" \ - --alpine-base="${ALPINE_BASE}" > assets.txt - -cat assets.txt diff --git a/pkg/build/daggerbuild/scripts/drone_build_tag_enterprise.sh b/pkg/build/daggerbuild/scripts/drone_build_tag_enterprise.sh deleted file mode 100755 index 43240ed7bec..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_tag_enterprise.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env sh -local_dst="dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - -# Build all of the grafana.tar.gz packages. -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a targz:enterprise:linux/amd64 \ - -a targz:enterprise:linux/arm64 \ - -a targz:enterprise:linux/arm/v6 \ - -a targz:enterprise:linux/arm/v7 \ - -a deb:enterprise:linux/amd64 \ - -a deb:enterprise:linux/arm64 \ - -a deb:enterprise:linux/arm/v6 \ - -a deb:enterprise:linux/arm/v7 \ - -a rpm:enterprise:linux/amd64:sign \ - -a rpm:enterprise:linux/arm64:sign \ - -a targz:enterprise:windows/amd64 \ - -a targz:enterprise:windows/arm64 \ - -a targz:enterprise:darwin/amd64 \ - -a targz:enterprise:darwin/arm64 \ - -a targz:boring:linux/amd64/dynamic \ - -a zip:enterprise:windows/amd64 \ - -a msi:enterprise:windows/amd64 \ - -a docker:enterprise:linux/amd64 \ - -a docker:enterprise:linux/arm64 \ - -a docker:enterprise:linux/arm/v7 \ - -a docker:enterprise:linux/amd64:ubuntu \ - -a docker:enterprise:linux/arm64:ubuntu \ - -a docker:enterprise:linux/arm/v7:ubuntu \ - -a docker:boring:linux/amd64/dynamic \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --verify \ - --checksum \ - --parallel=5 \ - --build-id=${DRONE_BUILD_NUMBER} \ - --enterprise-ref=${DRONE_TAG} \ - --grafana-ref=${DRONE_TAG} \ - --grafana-repo=https://github.com/grafana/grafana-security-mirror.git \ - --github-token=${GITHUB_TOKEN} \ - --ubuntu-base="${UBUNTU_BASE}" \ - --alpine-base="${ALPINE_BASE}" \ - --version=${DRONE_TAG} \ - --destination=${local_dst} > assets.txt - -# Move the tar.gz packages to their expected locations -cat assets.txt | go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/prerelease diff --git a/pkg/build/daggerbuild/scripts/drone_build_tag_grafana.sh b/pkg/build/daggerbuild/scripts/drone_build_tag_grafana.sh deleted file mode 100755 index e21a705b380..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_tag_grafana.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -dst="${DESTINATION}/${DRONE_BUILD_EVENT}" -local_dst="file://dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a npm:grafana \ - -a storybook \ - -a targz:grafana:linux/amd64 \ - -a targz:grafana:linux/arm64 \ - -a targz:grafana:linux/arm/v6 \ - -a targz:grafana:linux/arm/v7 \ - -a deb:grafana:linux/amd64 \ - -a deb:grafana:linux/arm64 \ - -a deb:grafana:linux/arm/v6 \ - -a deb:grafana:linux/arm/v7 \ - -a rpm:grafana:linux/amd64:sign \ - -a rpm:grafana:linux/arm64:sign \ - -a docker:grafana:linux/amd64 \ - -a docker:grafana:linux/arm64 \ - -a docker:grafana:linux/arm/v7 \ - -a docker:grafana:linux/amd64:ubuntu \ - -a docker:grafana:linux/arm64:ubuntu \ - -a docker:grafana:linux/arm/v7:ubuntu \ - -a targz:grafana:windows/amd64 \ - -a targz:grafana:windows/arm64 \ - -a targz:grafana:darwin/amd64 \ - -a targz:grafana:darwin/arm64 \ - -a zip:grafana:windows/amd64 \ - -a msi:grafana:windows/amd64 \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --checksum \ - --verify \ - --build-id=${DRONE_BUILD_NUMBER} \ - --grafana-dir=${GRAFANA_DIR} \ - --github-token=${GITHUB_TOKEN} \ - --ubuntu-base="${UBUNTU_BASE}" \ - --alpine-base="${ALPINE_BASE}" \ - --version=${DRONE_TAG} \ - --destination=${local_dst} > assets.txt - -cat assets.txt | go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/prerelease diff --git a/pkg/build/daggerbuild/scripts/drone_build_tag_pro.sh b/pkg/build/daggerbuild/scripts/drone_build_tag_pro.sh deleted file mode 100755 index 8023e2a0f0c..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_build_tag_pro.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env sh -local_dst="dist/${DRONE_BUILD_EVENT}" -set -e - -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*' -# This command enables qemu emulators for building Docker images for arm64/armv6/armv7/etc on the host. -docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all - -# Build all of the grafana.tar.gz packages. -dagger run --silent go run ./pkg/build/cmd \ - artifacts \ - -a frontend:enterprise \ - -a targz:pro:linux/amd64 \ - -a targz:pro:linux/arm64 \ - -a targz:pro:linux/arm/v6 \ - -a targz:pro:linux/arm/v7 \ - -a deb:pro:linux/amd64 \ - -a deb:pro:linux/arm64 \ - -a targz:pro:darwin/amd64 \ - -a targz:pro:windows/amd64 \ - -a docker:pro:linux/amd64 \ - -a docker:pro:linux/arm64 \ - -a docker:pro:linux/arm/v7 \ - -a docker:pro:linux/amd64:ubuntu \ - -a docker:pro:linux/arm64:ubuntu \ - -a docker:pro:linux/arm/v7:ubuntu \ - --checksum \ - --parallel=2 \ - --yarn-cache=${YARN_CACHE_FOLDER} \ - --build-id=${DRONE_BUILD_NUMBER} \ - --enterprise-ref=${DRONE_TAG} \ - --grafana-ref=${DRONE_TAG} \ - --grafana-repo=https://github.com/grafana/grafana-security-mirror.git \ - --github-token=${GITHUB_TOKEN} \ - --version=${DRONE_TAG} \ - --ubuntu-base="${UBUNTU_BASE}" \ - --alpine-base="${ALPINE_BASE}" \ - --destination=${local_dst} > assets.txt - -# Move the tar.gz packages to their expected locations -cat assets.txt | go run ./pkg/build/daggerbuild/scripts/move_packages.go ./dist/prerelease diff --git a/pkg/build/daggerbuild/scripts/drone_publish_nightly_enterprise.sh b/pkg/build/daggerbuild/scripts/drone_publish_nightly_enterprise.sh deleted file mode 100755 index 3c7ab2f2e78..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_publish_nightly_enterprise.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env sh -set -e -local_dir="${DRONE_WORKSPACE}/dist" - -# Publish the docker images present in the bucket -dagger run --silent go run ./pkg/build/cmd docker publish \ - $(find $local_dir | grep docker.tar.gz | grep -v sha256 | awk '{print "--package=file://"$0}') \ - --username=${DOCKER_USERNAME} \ - --password=${DOCKER_PASSWORD} \ - --latest \ - --repo="grafana-enterprise-dev" - -# Publish packages to the downloads bucket -dagger run --silent go run ./pkg/build/cmd package publish \ - $(find $local_dir | grep -e .rpm -e .tar.gz -e .exe -e .zip -e .deb | awk '{print "--package=file://"$0}') \ - --gcp-service-account-key-base64=${GCP_KEY_BASE64} \ - --destination="${DOWNLOADS_DESTINATION}/enterprise/release" - -# Publish packages to grafana.com -dagger run --silent go run ./pkg/build/cmd gcom publish \ - $(find $local_dir | grep -e .rpm -e .tar.gz -e .exe -e .zip -e .deb | grep -v sha256 | grep -v docker | awk '{print "--package=file://"$0}') \ - --api-key=${GCOM_API_KEY} \ - --api-url="https://grafana.com/api/grafana-enterprise" \ - --download-url="https://dl.grafana.com/enterprise/release" \ - --nightly diff --git a/pkg/build/daggerbuild/scripts/drone_publish_nightly_grafana.sh b/pkg/build/daggerbuild/scripts/drone_publish_nightly_grafana.sh deleted file mode 100755 index 85ef11a1920..00000000000 --- a/pkg/build/daggerbuild/scripts/drone_publish_nightly_grafana.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env sh -set -e -# ver=$(cat ${GRAFANA_DIR}/package.json | jq -r .version | sed -E "s/$/-/" | sed -E "s/-.*/-${DRONE_BUILD_NUMBER}/") -local_dir="${DRONE_WORKSPACE}/dist" - -# Publish the docker images present in the bucket -dagger run --silent go run ./pkg/build/cmd docker publish \ - $(find $local_dir | grep docker.tar.gz | grep -v sha256 | awk '{print "--package=file://"$0}') \ - --username=${DOCKER_USERNAME} \ - --password=${DOCKER_PASSWORD} \ - --repo="grafana-dev" - -# Publish packages to the downloads bucket -dagger run --silent go run ./pkg/build/cmd package publish \ - $(find $local_dir | grep -e .rpm -e .tar.gz -e .exe -e .zip -e .deb | awk '{print "--package=file://"$0}') \ - --gcp-service-account-key-base64=${GCP_KEY_BASE64} \ - --destination="${DOWNLOADS_DESTINATION}/oss/release" - -# Publish only the linux/amd64 edition storybook into the storybook bucket -# dagger run --silent go run ./pkg/build/cmd storybook \ -# $(find $local_dir | grep tar.gz | grep linux | grep amd64 | grep -v sha256 | grep -v docker | awk '{print "--package=file://"$0}') \ -# --gcp-service-account-key-base64=${GCP_KEY_BASE64} \ -# --destination="${STORYBOOK_DESTINATION}/${ver}" - -# # Publish only the linux/amd64 edition static assets into the static assets bucket -# dagger run --silent go run ./pkg/build/cmd cdn \ -# $(find $local_dir | grep tar.gz | grep linux | grep amd64 | grep -v sha256 | grep -v docker | awk '{print "--package=file://"$0}') \ -# --gcp-service-account-key-base64=${GCP_KEY_BASE64} \ -# --destination="${CDN_DESTINATION}/${ver}/public" - -# Publish only the linux/amd64 edition npm packages to npm -dagger run --silent go run ./pkg/build/cmd npm publish \ - $(find $local_dir | grep tar.gz | grep linux | grep amd64 | grep -v sha256 | grep -v docker | awk '{print "--package=file://"$0}') \ - --token=${NPM_TOKEN} \ - --tag="nightly" - -# Publish packages to grafana.com -dagger run --silent go run ./pkg/build/cmd gcom publish \ - $(find $local_dir | grep -e .rpm -e .tar.gz -e .exe -e .zip -e .deb | grep -v sha256 | grep -v docker | awk '{print "--package=file://"$0}') \ - --api-key=${GCOM_API_KEY} \ - --api-url="https://grafana.com/api/grafana" \ - --download-url="https://dl.grafana.com/oss/release" \ - --nightly diff --git a/pkg/build/daggerbuild/scripts/move_packages.go b/pkg/build/daggerbuild/scripts/move_packages.go deleted file mode 100644 index 1d90852f459..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages.go +++ /dev/null @@ -1,495 +0,0 @@ -package main - -import ( - "bufio" - "context" - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "strings" - - "dagger.io/dagger" - "github.com/grafana/grafana/pkg/build/daggerbuild/backend" - "github.com/grafana/grafana/pkg/build/daggerbuild/containers" - "github.com/grafana/grafana/pkg/build/daggerbuild/pipelines" -) - -const ( - proName = "enterprise2" - // 1: The version (with a v prefix) - // 2: The "edition". Options: 'oss', 'pro', 'enterprise'. - // 3: The full name. 'grafana', 'grafana-enterprise', 'grafana-pro - // 4: The 'ersion', or 'version' without the 'v'. - // 5: The OS: 'windows', 'linux', 'darwin' - // 6: The architecture: 'amd64', 'armv6', 'armv7', 'arm64'. - // 7: -musl, sometimes. - // 8: '.sha256', sometimes. - tarGzFormat = "artifacts/downloads%[9]s/%[1]s/%[2]s/release/%[3]s-%[4]s.%[5]s-%[6]s%[7]s.tar.gz%[8]s" - debFormat = "artifacts/downloads%[9]s/%[1]s/%[2]s/release/%[3]s_%[4]s_%[6]s.deb%[8]s" - rpmFormat = "artifacts/downloads%[9]s/%[1]s/%[2]s/release/%[3]s-%[4]s-1.%[6]s.rpm%[8]s" - exeFormat = "artifacts/downloads%[9]s/%[1]s/%[2]s/release/%[3]s_%[4]s_%[6]s.exe%[8]s" - msiFormat = "artifacts/downloads%[9]s/%[1]s/%[2]s/release/%[3]s_%[4]s_%[6]s.msi%[8]s" - - tarGzMainFormat = "%[2]s/main/%[3]s-%[4]s.%[5]s-%[6]s%[7]s.tar.gz%[8]s" - debMainFormat = "%[2]s/main/%[3]s_%[4]s_%[6]s.deb%[8]s" - - // 1: ersion - // 2. name (grafana-oss | grafana-enterprise) - // 3: '-ubuntu', if set - // 4: arch - // 5: '.sha256', if set - dockerFormat = "artifacts/docker/%[1]s/%[2]s-%[1]s%[3]s-%[4]s.img%[5]s" - - // 1: ersion - // 2. name (grafana-oss | grafana-enterprise) - cdnFormat = "artifacts/static-assets/%[2]s/%[1]s/public" - cdnMainFormat = "grafana/%s/public" - - // 1: ersion - storybookFormat = "artifacts/storybook/v%[1]s" - - // 1: version - // 2: package name (@grafana-ui-10.0.0.tgz) - npmFormat = "artifacts/npm/v%[1]s/npm-artifacts" - - sha256Ext = ".sha256" - grafana = "grafana" -) - -// One artifact and be copied to multiple different locations (like armv7 tar.gz packages should be copied to tar.gz and -musl.tar.gz) -type HandlerFunc func(name string) []string - -var Handlers = map[string]HandlerFunc{ - ".tar.gz": TarGZHandler, - ".deb": DebHandler, - ".rpm": RPMHandler, - ".docker.tar.gz": DockerHandler, - ".exe": EXEHandler, - ".msi": MSIHandler, - ".zip": ZipHandler, -} - -func IsMain() bool { - return os.Getenv("IS_MAIN") != "" -} - -func NPMHandler(name string) []string { - var ( - version = strings.TrimPrefix(os.Getenv("DRONE_TAG"), "v") - ) - - return []string{fmt.Sprintf(npmFormat, version)} -} - -func ZipHandler(name string) []string { - files := EXEHandler(strings.ReplaceAll(name, "zip", "exe")) - - for i, v := range files { - files[i] = strings.ReplaceAll(v, "exe", "zip") - } - - return files -} - -func MSIHandler(name string) []string { - files := EXEHandler(strings.ReplaceAll(name, "msi", "exe")) - - for i, v := range files { - files[i] = strings.ReplaceAll(v, "exe", "msi") - } - - return files -} - -func RPMHandler(name string) []string { - ext := filepath.Ext(name) - - // If we're copying a sha256 file and not a tar.gz then we want to add .sha256 to the template - // or just give it emptystring if it's not the sha256 file - sha256 := "" - if ext == sha256Ext { - sha256 = sha256Ext - } - - n := filepath.Base(name) // Surprisingly still works even with 'gs://' urls - opts := pipelines.TarOptsFromFileName(strings.ReplaceAll(strings.ReplaceAll(n, sha256Ext, ""), "rpm", "tar.gz")) - - // In grafana-build we just use "" to refer to "oss" - edition := "oss" - fullName := grafana - if opts.Edition != "" { - edition = opts.Edition - fullName += "-" + opts.Edition - } - - goos, arch := backend.OSAndArch(opts.Distro) - arm := backend.ArchVersion(opts.Distro) - if arch == "arm" { - if arm == "7" { - arch = "armhfp" - } - } - - if arch == "arm64" { - arch = "aarch64" - } - - if arch == "amd64" { - arch = "x86_64" - } - - enterprise2 := "" - version := opts.Version - ersion := strings.Replace(strings.TrimPrefix(version, "v"), "-", "~", 1) - - if edition == "pro" { - // "pro" in this case is called "enterprise2" - fullName = "grafana-enterprise2" - edition = proName - // and is in the 'downloads-enterprise2' folder instead of 'downloads' - enterprise2 = "-enterprise2" - // and has an period separator {version}.{arch} instead of {version}_{arch} - } - dst := fmt.Sprintf(rpmFormat, version, edition, fullName, ersion, goos, arch, edition, sha256, enterprise2) - - return []string{ - dst, - } -} - -func EXEHandler(name string) []string { - packages := DebHandler(strings.ReplaceAll(name, "exe", "deb")) - for i, v := range packages { - v = strings.ReplaceAll(v, "deb", "exe") - v = strings.ReplaceAll(v, "amd64", "windows-amd64") - v = strings.ReplaceAll(v, "_", "-") - v = strings.ReplaceAll(v, "~", "-") - v = strings.ReplaceAll(v, "-windows", ".windows") - packages[i] = v - } - - return packages -} - -func DebHandler(name string) []string { - ext := filepath.Ext(name) - format := debFormat - if IsMain() { - format = debMainFormat - } - - // If we're copying a sha256 file and not a tar.gz then we want to add .sha256 to the template - // or just give it emptystring if it's not the sha256 file - sha256 := "" - if ext == sha256Ext { - sha256 = sha256Ext - } - - n := filepath.Base(name) // Surprisingly still works even with 'gs://' urls - opts := pipelines.TarOptsFromFileName(strings.ReplaceAll(strings.ReplaceAll(n, sha256Ext, ""), "deb", "tar.gz")) - - // In grafana-build we just use "" to refer to "oss" - edition := "oss" - fullName := grafana - version := opts.Version - ersion := strings.TrimPrefix(version, "v") - ersion = strings.Replace(ersion, "-", "~", 1) - enterprise2 := "" - if opts.Edition != "" { - edition = opts.Edition - fullName += "-" + opts.Edition - if edition == "pro" { - // "pro" in this case is called "enterprise2" - fullName = "grafana-enterprise2" - edition = proName - // and is in the 'downloads-enterprise2' folder instead of 'downloads' - enterprise2 = "-enterprise2" - } - - if edition == "pro-rpi" { - // "pro" in this case is called "enterprise2" - fullName = "grafana-enterprise2-rpi" - edition = proName - // and is in the 'downloads-enterprise2' folder instead of 'downloads' - enterprise2 = "-enterprise2" - } - - if edition == "rpi" { - edition = "oss" - } - - if edition == "enterprise-rpi" { - edition = "enterprise" - } - } - - names := []string{fullName} - goos, arch := backend.OSAndArch(opts.Distro) - if arch == "arm" { - arch = "armhf" - // If we're building for arm then we also copy the same thing, but with the name '-rpi'. for osme reason? - names = []string{fullName} - } - - dst := []string{} - for _, n := range names { - dst = append(dst, fmt.Sprintf(format, opts.Version, edition, n, ersion, goos, arch, edition, sha256, enterprise2)) - } - - return dst -} - -func TarGZHandler(name string) []string { - ext := filepath.Ext(name) - - // If we're copying a sha256 file and not a tar.gz then we want to add .sha256 to the template - // or just give it emptystring if it's not the sha256 file - sha256 := "" - if ext == sha256Ext { - sha256 = sha256Ext - } - - n := filepath.Base(name) // Surprisingly still works even with 'gs://' urls - opts := pipelines.TarOptsFromFileName(strings.ReplaceAll(n, sha256Ext, "")) - - // In grafana-build we just use "" to refer to "oss" - edition := "oss" - fullName := grafana - version := opts.Version - ersion := strings.TrimPrefix(version, "v") - enterprise2 := "" - if opts.Edition != "" { - edition = opts.Edition - fullName += "-" + opts.Edition - if edition == "pro" { - enterprise2 = "-enterprise2" - fullName = "grafana-enterprise2" - edition = proName - } - } - - libc := []string{""} - goos, arch := backend.OSAndArch(opts.Distro) - - if arch == "arm64" || arch == "arm" || arch == "amd64" && goos == "linux" { - libc = []string{"", "-musl"} - } - - arm := backend.ArchVersion(opts.Distro) - if arch == "arm" { - arch += "v" + arm - // I guess we don't create an arm-6-musl? - if arm == "6" { - libc = []string{""} - } - } - format := tarGzFormat - if IsMain() { - format = tarGzMainFormat - } - dst := []string{} - for _, m := range libc { - dst = append(dst, fmt.Sprintf(format, opts.Version, edition, fullName, ersion, goos, arch, m, sha256, enterprise2)) - } - - return dst -} - -func DockerHandler(name string) []string { - ext := filepath.Ext(name) - - // If we're copying a sha256 file and not a tar.gz then we want to add .sha256 to the template - // or just give it emptystring if it's not the sha256 file - sha256 := "" - if ext == sha256Ext { - sha256 = sha256Ext - } - - n := filepath.Base(name) // Surprisingly still works even with 'gs://' urls - - // try to get .ubuntu.docker.tar.gz.sha256 / .ubuntu.docker.tar.gz / docker.tar.gz to all just end in 'tar.gz' - normalized := strings.ReplaceAll(n, sha256Ext, "") - normalized = strings.ReplaceAll(normalized, ".ubuntu", "") - normalized = strings.ReplaceAll(normalized, ".docker", "") - - opts := pipelines.TarOptsFromFileName(normalized) - - // In grafana-build we just use "" to refer to "oss" - edition := "oss" - fullName := grafana - if opts.Edition != "" { - edition = opts.Edition - if edition == "pro" { - edition = proName - } - } - - fullName += "-" + edition - ubuntu := "" - if strings.Contains(name, "ubuntu") { - ubuntu = "-ubuntu" - } - - _, arch := backend.OSAndArch(opts.Distro) - if arch == "arm" { - arch += "v" + backend.ArchVersion(opts.Distro) - } - return []string{ - fmt.Sprintf(dockerFormat, strings.TrimPrefix(opts.Version, "v"), fullName, ubuntu, arch, sha256), - } -} - -func CDNHandler(name string) []string { - if IsMain() { - // This folder is is always ${dist}/${version}/${name}/${public} - dist, err := filepath.Rel(".", filepath.Join(name, "../../../")) - if err != nil { - panic(err) - } - - path, err := filepath.Rel(dist, name) - if err != nil { - panic(err) - } - s := strings.Split(path, string(os.PathSeparator)) - return []string{fmt.Sprintf(cdnMainFormat, s[0])} - } - version := strings.TrimPrefix(os.Getenv("DRONE_TAG"), "v") - return []string{fmt.Sprintf(cdnFormat, version, grafana)} -} - -func StorybookHandler(name string) []string { - version := strings.TrimPrefix(os.Getenv("DRONE_TAG"), "v") - return []string{fmt.Sprintf(storybookFormat, version)} -} - -// A hopefully temporary script that prints the gsutil commands that will move these artifacts into the location where they were expected previously. -// Just pipe this into bash or exec or whatever to do the actual copying. -// Run without redirecting stdout to verify the operations. -func main() { - prefix := os.Args[1] - - ctx := context.Background() - client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) - if err != nil { - panic(err) - } - - var ( - scanner = bufio.NewScanner(os.Stdin) - authenticator = containers.GCSAuth(client, &containers.GCPOpts{ - ServiceAccountKeyBase64: os.Getenv("GCP_KEY_BASE64"), - }) - - container = client.Container().From("google/cloud-sdk:alpine") - ) - // - if c, err := authenticator.Authenticate(client, container); err == nil { - container = c - } else { - panic(err) - } - - for scanner.Scan() { - var ( - name = scanner.Text() - ) - handler, ext := getHandler(name, Handlers) - destinations := handler(name) - if ext == "" { - for _, v := range destinations { - dir := filepath.Join(prefix, filepath.Dir(v)) - v := filepath.Join(prefix, v) - - log.Println("Creating dir", dir) - if err := os.MkdirAll(dir, 0700); err != nil { - panic(err) - } - log.Println("Copying", name, "to", v) - //nolint:gosec - cmd := exec.Command("cp", "-r", strings.TrimPrefix(name, "file://"), v) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - panic(err) - } - } - continue - } - - log.Println("File:", name, "to be copied as", destinations) - for _, v := range destinations { - dir := filepath.Join(prefix, filepath.Dir(v)) - v := filepath.Join(prefix, v) - log.Println("Creating directory", dir) - if err := os.MkdirAll(dir, 0700); err != nil { - panic(err) - } - - log.Println("Copying", name, "to", dir, "as", v) - - //nolint:gosec - cmd := exec.Command("cp", strings.TrimPrefix(name, "file://"), v) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - panic(err) - } - } - } - - log.Println("Copying", prefix, "to gcs") - dst := os.Getenv("DESTINATION") - container = container.WithMountedDirectory("dist", client.Host().Directory(prefix)). - WithExec([]string{"gcloud", "storage", "cp", "-r", "/dist/*", dst}) - - stdout, err := container.Stdout(ctx) - if err != nil { - panic(err) - } - - stderr, err := container.Stdout(ctx) - if err != nil { - panic(err) - } - - fmt.Fprint(os.Stdout, stdout) - fmt.Fprint(os.Stderr, stderr) -} - -func getHandler(name string, handlers map[string]HandlerFunc) (HandlerFunc, string) { - ext := filepath.Ext(name) - // sha256 extensions should be handled the same way what precedes the extension - if ext == sha256Ext { - ext = filepath.Ext(strings.ReplaceAll(name, sha256Ext, "")) - } - - // tar.gz extensions can also have docker.tar.gz so we need to make sure we don't skip that - if ext == ".gz" { - ext = ".tar.gz" - if filepath.Ext(strings.ReplaceAll(name, ".tar.gz", "")) == ".docker" || - filepath.Ext(strings.ReplaceAll(name, ".tar.gz.sha256", "")) == ".docker" { - ext = ".docker.tar.gz" - } - } - - handler := handlers[ext] - // If there is no extension, then we are either dealing with public assets - // or the storybook, which both require some extra handling: - if ext != "" { - return handler, ext - } - - if filepath.Base(name) == "public" { - return CDNHandler, "" - } - if filepath.Base(name) == "storybook" { - return StorybookHandler, "" - } - if filepath.Base(name) == "npm-packages" { - return NPMHandler, "" - } - panic("no handler found") -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_cdn_test.go b/pkg/build/daggerbuild/scripts/move_packages_cdn_test.go deleted file mode 100644 index d4b1711d355..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_cdn_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -var cdnMapping = map[string]m{ - "OSS: Linux AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64/public", - output: []string{ - "artifacts/static-assets/grafana/1.2.3/public", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, - "ENT: Linux AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64/public", - output: []string{ - "artifacts/static-assets/grafana/1.2.3/public", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, - "PRO: Linux AMD64": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_amd64/public", - output: []string{ - "artifacts/static-assets/grafana/1.2.3/public", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, - "main": { - input: "dist/10.3.0-62960/grafana-enterprise/public", - output: []string{ - "grafana/10.3.0-62960/public", - }, - env: map[string]string{"IS_MAIN": "true"}, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_deb_test.go b/pkg/build/daggerbuild/scripts/move_packages_deb_test.go deleted file mode 100644 index 09c882a4177..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_deb_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package main - -var debMapping = map[string]m{ - "OSS: Linux AMD64 on main": { - env: map[string]string{ - "IS_MAIN": "true", - }, - input: "file://dist/grafana_v1.2.3_102_linux_amd64.deb", - output: []string{ - "oss/main/grafana_1.2.3_amd64.deb", - }, - }, - "OSS: Linux AMD64 on main with - in version": { - env: map[string]string{ - "IS_MAIN": "true", - }, - input: "file://dist/grafana_v1.2.3-102_102_linux_amd64.deb", - output: []string{ - "oss/main/grafana_1.2.3~102_amd64.deb", - }, - }, - "OSS: Linux AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.deb", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_amd64.deb", - }, - }, - "OSS: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_amd64.deb.sha256", - }, - }, - "OSS: Linux ARM7": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.deb", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_armhf.deb", - }, - }, - "OSS: RPI ARM7": { - input: "gs://bucket/tag/grafana-rpi_v1.2.3_102_linux_arm-7.deb", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-rpi_1.2.3_armhf.deb", - }, - }, - "OSS: RPI ARM6": { - input: "gs://bucket/tag/grafana-rpi_v1.2.3_102_linux_arm-6.deb", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-rpi_1.2.3_armhf.deb", - }, - }, - "OSS: Linux ARM7 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_armhf.deb.sha256", - }, - }, - "OSS: Linux ARM64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.deb", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_arm64.deb", - }, - }, - "OSS: Linux ARM64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana_1.2.3_arm64.deb.sha256", - }, - }, - "ENT: Linux AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.deb", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_amd64.deb", - }, - }, - "ENT: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_amd64.deb.sha256", - }, - }, - "ENT: Linux ARM64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.deb", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_arm64.deb", - }, - }, - "ENT: Linux ARM64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_arm64.deb.sha256", - }, - }, - "ENT: Linux ARM7": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.deb", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_armhf.deb", - }, - }, - "ENT: RPI ARM7": { - input: "gs://bucket/tag/grafana-enterprise-rpi_v1.2.3_102_linux_arm-7.deb", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-rpi_1.2.3_armhf.deb", - }, - }, - "ENT: ARM7 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.deb.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise_1.2.3_armhf.deb.sha256", - }, - }, - "ENT2: RPI ARM7": { - input: "gs://bucket/tag/grafana-pro-rpi_v1.2.3_102_linux_arm-7.deb", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3/enterprise2/release/grafana-enterprise2-rpi_1.2.3_armhf.deb", - }, - }, - "ENT2: Pre-release AMD64": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.deb", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2_1.2.3~pre.4_amd64.deb", - }, - }, - "ENT2: Pre-release AMD64 SHA256": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.deb.sha256", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2_1.2.3~pre.4_amd64.deb.sha256", - }, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_docker_test.go b/pkg/build/daggerbuild/scripts/move_packages_docker_test.go deleted file mode 100644 index 70660c8e04f..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_docker_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package main - -var dockerMapping = map[string]m{ - "ENT: Linux AMD64 Ubuntu": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-amd64.img", - }, - }, - "ENT: Linux AMD64 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-amd64.img.sha256", - }, - }, - "ENT: Linux ARM64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-arm64.img", - }, - }, - "ENT: Linux ARM64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-arm64.img.sha256", - }, - }, - "ENT: Linux ARM7": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-armv7.img", - }, - }, - "ENT: Linux ARM7 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-armv7.img.sha256", - }, - }, - "ENT: Linux ARM7 Ubuntu": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-armv7.img", - }, - }, - "ENT: Linux AR7 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-armv7.img.sha256", - }, - }, - "ENT: Linux AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-amd64.img", - }, - }, - "ENT: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-amd64.img.sha256", - }, - }, - "ENT: Linux ARM64 Ubuntu": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-arm64.img", - }, - }, - "ENT: Linux ARM64 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise-1.2.3-ubuntu-arm64.img.sha256", - }, - }, - "OSS: Linux ARM7": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-armv7.img", - }, - }, - "OSS: Linux ARM7 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-armv7.img.sha256", - }, - }, - "OSS: Linux ARM7 Ubuntu": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-armv7.img", - }, - }, - "OSS: Linux AR7 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-armv7.img.sha256", - }, - }, - "OSS: Linux AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-amd64.img", - }, - }, - "OSS: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-amd64.img.sha256", - }, - }, - "OSS: Linux AMD64 Ubuntu": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-amd64.img", - }, - }, - "OSS: Linux AMD64 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-amd64.img.sha256", - }, - }, - "OSS: Linux ARM64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-arm64.img", - }, - }, - "OSS: Linux ARM64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-arm64.img.sha256", - }, - }, - "OSS: Linux ARM64 Ubuntu": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-arm64.img", - }, - }, - "OSS: Linux ARM64 Ubuntu SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.ubuntu.docker.tar.gz.sha256", - output: []string{ - "artifacts/docker/1.2.3/grafana-oss-1.2.3-ubuntu-arm64.img.sha256", - }, - }, - "PRO: Linux AMD64": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_amd64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-amd64.img", - }, - }, - "PRO: Linux ARM64": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_arm64.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-arm64.img", - }, - }, - "PRO: Linux ARM7": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_arm-7.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-armv7.img", - }, - }, - "PRO: Linux AMD64 Ubuntu": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_amd64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-ubuntu-amd64.img", - }, - }, - "PRO: Linux ARM64 Ubuntu": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_arm64.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-ubuntu-arm64.img", - }, - }, - "PRO: Linux ARM7 Ubuntu": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_arm-7.ubuntu.docker.tar.gz", - output: []string{ - "artifacts/docker/1.2.3/grafana-enterprise2-1.2.3-ubuntu-armv7.img", - }, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_exe_test.go b/pkg/build/daggerbuild/scripts/move_packages_exe_test.go deleted file mode 100644 index 32499c805c7..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_exe_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -var exeMapping = map[string]m{ - "ENT": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.exe", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.exe", - }, - }, - "ENT SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.exe.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.exe.sha256", - }, - }, - "OSS": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.exe", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.exe", - }, - }, - "OSS SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.exe.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.exe.sha256", - }, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_msi_test.go b/pkg/build/daggerbuild/scripts/move_packages_msi_test.go deleted file mode 100644 index 77db73d4b58..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_msi_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -var msiMapping = map[string]m{ - "ENT": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.msi", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.msi", - }, - }, - "ENT SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.msi.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.msi.sha256", - }, - }, - "OSS": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.msi", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.msi", - }, - }, - "OSS SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.msi.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.msi.sha256", - }, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_npm_test.go b/pkg/build/daggerbuild/scripts/move_packages_npm_test.go deleted file mode 100644 index 146a1b1219b..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_npm_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -var npmMapping = map[string]m{ - "Grafana data": { - input: "file://dist/tag/grafana-10.2.0-pre/npm-packages", - output: []string{ - "artifacts/npm/v10.2.0-pre/npm-artifacts", - }, - env: map[string]string{"DRONE_TAG": "10.2.0-pre"}, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_rpm_test.go b/pkg/build/daggerbuild/scripts/move_packages_rpm_test.go deleted file mode 100644 index 22b1d8ac8a9..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_rpm_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package main - -var rpmMapping = map[string]m{ - "OSS: Linux AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.x86_64.rpm", - }, - }, - "OSS: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.x86_64.rpm.sha256", - }, - }, - "OSS: Linux ARM7": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.armhfp.rpm", - }, - }, - "OSS: Linux ARM7 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.armhfp.rpm.sha256", - }, - }, - "OSS: Linux aarch64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_aarch64.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.aarch64.rpm", - }, - }, - "OSS: Linux aarch64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3-1.aarch64.rpm.sha256", - }, - }, - "ENT: Linux AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.x86_64.rpm", - }, - }, - "ENT: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.x86_64.rpm.sha256", - }, - }, - "ENT: Linux ARM64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.aarch64.rpm", - }, - }, - "ENT: Linux ARM64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.aarch64.rpm.sha256", - }, - }, - "ENT: Linux ARM7": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.rpm", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.armhfp.rpm", - }, - }, - "ENT: Linux ARM7 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.rpm.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3-1.armhfp.rpm.sha256", - }, - }, - "PRO: Linux AMD64": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.rpm", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3~pre.4-1.x86_64.rpm", - }, - }, - "PRO: Linux AMD64 SHA256": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.rpm.sha256", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3~pre.4-1.x86_64.rpm.sha256", - }, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_storybook_test.go b/pkg/build/daggerbuild/scripts/move_packages_storybook_test.go deleted file mode 100644 index 6616d3027a2..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_storybook_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -var storybookMapping = map[string]m{ - "OSS": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64/storybook", - output: []string{ - "artifacts/storybook/v1.2.3", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, - "ENT": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64/storybook", - output: []string{ - "artifacts/storybook/v1.2.3", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, - "PRO": { - input: "gs://bucket/tag/grafana-pro_v1.2.3_102_linux_amd64/storybook", - output: []string{ - "artifacts/storybook/v1.2.3", - }, - env: map[string]string{"DRONE_TAG": "1.2.3"}, - }, -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_test.go b/pkg/build/daggerbuild/scripts/move_packages_test.go deleted file mode 100644 index 5b1d310f386..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_test.go +++ /dev/null @@ -1,215 +0,0 @@ -package main - -import ( - "sort" - "testing" - - "github.com/stretchr/testify/require" -) - -type m struct { - input string - output []string - env map[string]string -} - -var targzMapping = map[string]m{ - "ENT: Darwin AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_darwin_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.darwin-amd64.tar.gz", - }, - }, - "ENT: Darwin AMD64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_darwin_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.darwin-amd64.tar.gz.sha256", - }, - }, - "ENT: AMD64 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-amd64-musl.tar.gz", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-amd64.tar.gz", - }, - }, - "ENT: AMD64 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-amd64-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-amd64.tar.gz.sha256", - }, - }, - "ENT: ARM64 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-arm64-musl.tar.gz", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-arm64.tar.gz", - }, - }, - "ENT: ARM64 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-arm64-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-arm64.tar.gz.sha256", - }, - }, - "ENT: ARM6": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-6.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv6.tar.gz", - }, - }, - "ENT: ARM6 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-6.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv6.tar.gz.sha256", - }, - }, - "ENT: ARM7 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv7-musl.tar.gz", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv7.tar.gz", - }, - }, - "ENT: ARM7 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_linux_arm-7.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv7-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.linux-armv7.tar.gz.sha256", - }, - }, - "ENT: Windows AMD64": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.tar.gz", - }, - }, - "ENT: Windows AMD64 SHA256": { - input: "gs://bucket/tag/grafana-enterprise_v1.2.3_102_windows_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/enterprise/release/grafana-enterprise-1.2.3.windows-amd64.tar.gz.sha256", - }, - }, - "OSS: ARM6": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-6.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv6.tar.gz", - }, - }, - "OSS: ARM6 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-6.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv6.tar.gz.sha256", - }, - }, - "OSS: ARM7 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv7-musl.tar.gz", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv7.tar.gz", - }, - }, - "OSS: ARM7 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm-7.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv7-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-armv7.tar.gz.sha256", - }, - }, - "OSS: Windows AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.tar.gz", - }, - }, - "OSS: Windows AMD64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_windows_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.windows-amd64.tar.gz.sha256", - }, - }, - "OSS: Darwin AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3_102_darwin_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.darwin-amd64.tar.gz", - }, - }, - "OSS: Darwin AMD64 SHA256": { - input: "gs://bucket/tag/grafana_v1.2.3_102_darwin_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.darwin-amd64.tar.gz.sha256", - }, - }, - "OSS: Linux AMD64 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-amd64-musl.tar.gz", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-amd64.tar.gz", - }, - }, - "OSS: Linux AMD64 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-amd64-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-amd64.tar.gz.sha256", - }, - }, - "OSS: Linux ARM64 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.tar.gz", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-arm64-musl.tar.gz", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-arm64.tar.gz", - }, - }, - "OSS: Linux ARM64 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana_v1.2.3_102_linux_arm64.tar.gz.sha256", - output: []string{ - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-arm64-musl.tar.gz.sha256", - "artifacts/downloads/v1.2.3/oss/release/grafana-1.2.3.linux-arm64.tar.gz.sha256", - }, - }, - "ENT2: Linux AMD64 with MUSL copy": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.tar.gz", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3-pre.4.linux-amd64-musl.tar.gz", - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3-pre.4.linux-amd64.tar.gz", - }, - }, - "ENT2: Linux AMD64 SHA256 with MUSL copy": { - input: "gs://bucket/tag/grafana-pro_v1.2.3-pre.4_102_linux_amd64.tar.gz.sha256", - output: []string{ - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3-pre.4.linux-amd64-musl.tar.gz.sha256", - "artifacts/downloads-enterprise2/v1.2.3-pre.4/enterprise2/release/grafana-enterprise2-1.2.3-pre.4.linux-amd64.tar.gz.sha256", - }, - }, -} - -func TestGetHandler(t *testing.T) { - runTests(t, "TARGZ: ", targzMapping) - runTests(t, "DOCKER: ", dockerMapping) - runTests(t, "CDN: ", cdnMapping) - runTests(t, "ZIP: ", zipMapping) - runTests(t, "MSI: ", msiMapping) - runTests(t, "NPM: ", npmMapping) - runTests(t, "DEB: ", debMapping) - runTests(t, "RPM: ", rpmMapping) - runTests(t, "EXE: ", exeMapping) - runTests(t, "STORYBOOK: ", storybookMapping) -} - -func runTests(t *testing.T, namePrefix string, tests map[string]m) { - t.Helper() - for testname, testcase := range tests { - t.Run(namePrefix+testname, func(t *testing.T) { - for envName, envValue := range testcase.env { - t.Setenv(envName, envValue) - } - handler, _ := getHandler(testcase.input, Handlers) - output := handler(testcase.input) - sort.Strings(output) - require.Equal(t, testcase.output, output) - }) - } -} diff --git a/pkg/build/daggerbuild/scripts/move_packages_zip_test.go b/pkg/build/daggerbuild/scripts/move_packages_zip_test.go deleted file mode 100644 index af121e1e7f5..00000000000 --- a/pkg/build/daggerbuild/scripts/move_packages_zip_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -var zipMapping = map[string]m{ - "OSS: Windows AMD64": { - input: "gs://bucket/tag/grafana_v1.2.3-test.1_102_windows_amd64.zip", - output: []string{ - "artifacts/downloads/v1.2.3-test.1/oss/release/grafana-1.2.3-test.1.windows-amd64.zip", - }, - }, - "OSS: Windows AMD64 from file://": { - input: "file://bucket/tag/grafana_v1.2.3-test.1_102_windows_amd64.zip", - output: []string{ - "artifacts/downloads/v1.2.3-test.1/oss/release/grafana-1.2.3-test.1.windows-amd64.zip", - }, - }, - "OSS: Windows AMD64 main from file://": { - input: "file://bucket/tag/grafana_main_102_windows_amd64.zip", - output: []string{ - "artifacts/downloads/main/oss/release/grafana-main.windows-amd64.zip", - }, - }, -} diff --git a/pkg/build/docker/dockerconfig.go b/pkg/build/docker/dockerconfig.go deleted file mode 100644 index 7a971dc2ba5..00000000000 --- a/pkg/build/docker/dockerconfig.go +++ /dev/null @@ -1,15 +0,0 @@ -package docker - -import ( - "github.com/grafana/grafana/pkg/build/config" -) - -type Config struct { - Bucket string - Edition string - Tag string - Distribution []config.Distribution - Archs []config.Architecture - DockerHubRepo string - Security bool -} diff --git a/pkg/build/droneutil/docs.go b/pkg/build/droneutil/docs.go deleted file mode 100644 index 8bf3753936e..00000000000 --- a/pkg/build/droneutil/docs.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package droneutil provides utility functions for working with Drone. -package droneutil diff --git a/pkg/build/droneutil/event.go b/pkg/build/droneutil/event.go deleted file mode 100644 index 707b87383c2..00000000000 --- a/pkg/build/droneutil/event.go +++ /dev/null @@ -1,34 +0,0 @@ -package droneutil - -import ( - "fmt" - "os" - "strings" -) - -// Lookup is the equivalent of os.LookupEnv, but also accepts a list of strings rather than only checking os.Environ() -func Lookup(values []string, val string) (string, bool) { - for _, v := range values { - prefix := val + "=" - if strings.HasPrefix(v, prefix) { - return strings.TrimPrefix(v, prefix), true - } - } - - return "", false -} - -// GetDroneEvent looks for the "DRONE_BUILD_EVENT" in the provided env list and returns the value. -// if it was not found, then an error is returned. -func GetDroneEvent(env []string) (string, error) { - event, ok := Lookup(env, "DRONE_BUILD_EVENT") - if !ok { - return "", fmt.Errorf("failed to get DRONE_BUILD_EVENT environmental variable") - } - return event, nil -} - -// GetDroneEventFromEnv returns the value of DRONE_BUILD_EVENT from os.Environ() -func GetDroneEventFromEnv() (string, error) { - return GetDroneEvent(os.Environ()) -} diff --git a/pkg/build/droneutil/event_test.go b/pkg/build/droneutil/event_test.go deleted file mode 100644 index b69ce50fc54..00000000000 --- a/pkg/build/droneutil/event_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package droneutil_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/grafana/grafana/pkg/build/droneutil" -) - -func TestGetDroneEvent(t *testing.T) { - t.Run("Should return the Drone Event", func(t *testing.T) { - env := []string{"DRONE_BUILD_EVENT=pull_request"} - droneEvent, err := droneutil.GetDroneEvent(env) - require.NoError(t, err) - require.Equal(t, droneEvent, "pull_request") - }) - t.Run("Should return error, Drone Event env var is missing", func(t *testing.T) { - droneEvent, err := droneutil.GetDroneEvent([]string{}) - require.Error(t, err) - require.Empty(t, droneEvent) - }) -} - -func TestLookup(t *testing.T) { - env := []string{"", "EXAMPLE_KEY=value", "EXAMPLE_KEY"} - t.Run("A valid lookup should return a string and no error", func(t *testing.T) { - val, ok := droneutil.Lookup(env, "EXAMPLE_KEY") - require.True(t, ok) - require.Equal(t, val, "value") - }) - - t.Run("An invalid lookup should return an error", func(t *testing.T) { - _, ok := droneutil.Lookup(env, "EXAMPLE_KEY_DOES_NOT_EXIST") - require.False(t, ok) - }) -} diff --git a/pkg/build/env/fallback.go b/pkg/build/env/fallback.go deleted file mode 100644 index 7f4f31cb09e..00000000000 --- a/pkg/build/env/fallback.go +++ /dev/null @@ -1,40 +0,0 @@ -package env - -import ( - "fmt" - "os" - "strings" - - "github.com/urfave/cli/v2" -) - -// RequireListWithEnvFallback first checks the CLI for a flag with the required -// name. If this is empty, it falls back to taking the environment variable. -// Sadly, we cannot use cli.Flag.EnvVars for this due to it potentially leaking -// environment variables as default values in usage-errors. -func RequireListWithEnvFallback(cctx *cli.Context, name string, envName string) ([]string, error) { - result := cctx.StringSlice(name) - if len(result) == 0 { - for _, v := range strings.Split(os.Getenv(envName), ",") { - value := strings.TrimSpace(v) - if value != "" { - result = append(result, value) - } - } - } - if len(result) == 0 { - return nil, cli.Exit(fmt.Sprintf("Required flag (%s) or environment variable (%s) not set", name, envName), 1) - } - return result, nil -} - -func RequireStringWithEnvFallback(cctx *cli.Context, name string, envName string) (string, error) { - result := cctx.String(name) - if result == "" { - result = os.Getenv(envName) - } - if result == "" { - return "", cli.Exit(fmt.Sprintf("Required flag (%s) or environment variable (%s) not set", name, envName), 1) - } - return result, nil -} diff --git a/pkg/build/env/fallback_test.go b/pkg/build/env/fallback_test.go deleted file mode 100644 index 8871bb68a72..00000000000 --- a/pkg/build/env/fallback_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package env - -import ( - "flag" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - "github.com/urfave/cli/v2" -) - -const ( - flag1 = "flag1" - flag2 = "flag2" -) - -type flagObj struct { - name string - value string -} - -func TestRequireListWithEnvFallback(t *testing.T) { - var app = cli.NewApp() - tests := []struct { - testName string - ctx *cli.Context - name string - envName string - expected []string - expectedErr error - }{ - { - testName: "string slice present in context", - ctx: cli.NewContext(app, applyFlagSet(t, flag1, "a"), nil), - name: flag1, - envName: "", - expected: []string{"a"}, - expectedErr: nil, - }, - { - testName: "string slice present in env", - ctx: cli.NewContext(app, flag.NewFlagSet("test", 0), nil), - name: flag1, - envName: setEnv(t, flag1, "a"), - expected: []string{"a"}, - expectedErr: nil, - }, - { - testName: "string slice absent in both context and env", - ctx: cli.NewContext(app, flag.NewFlagSet("test", 0), nil), - name: flag1, - envName: "", - expected: []string(nil), - expectedErr: cli.Exit("Required flag (flag1) or environment variable () not set", 1), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - flagList, err := RequireListWithEnvFallback(tt.ctx, tt.name, tt.envName) - if tt.expectedErr != nil { - require.Error(t, err) - } - require.Equal(t, tt.expected, flagList) - }) - } -} - -func TestRequireStringWithEnvFallback(t *testing.T) { - var app = cli.NewApp() - tests := []struct { - testName string - ctx *cli.Context - name string - envName string - expected string - expectedErr error - }{ - { - testName: "string present in the context", - ctx: cli.NewContext(app, setFlags(t, flag.NewFlagSet("test", flag.ContinueOnError), flagObj{name: flag1, value: "a"}), nil), - name: flag1, - envName: "", - expected: "a", - expectedErr: nil, - }, - { - testName: "string present in env", - ctx: cli.NewContext(app, setFlags(t, flag.NewFlagSet("test", flag.ContinueOnError)), nil), - name: flag1, - envName: setEnv(t, flag1, "a"), - expected: "a", - expectedErr: nil, - }, - { - testName: "string absent from both context and env", - ctx: cli.NewContext(app, setFlags(t, flag.NewFlagSet("test", flag.ContinueOnError), flagObj{name: flag2, value: "b"}), nil), - name: flag1, - envName: "", - expected: "", - expectedErr: cli.Exit("Required flag (flag1) or environment variable () not set", 1), - }, - } - for _, tt := range tests { - t.Run(tt.testName, func(t *testing.T) { - flagString, err := RequireStringWithEnvFallback(tt.ctx, tt.name, tt.envName) - if tt.expectedErr != nil { - require.Error(t, err) - } - require.Equal(t, tt.expected, flagString) - }) - } -} - -func applyFlagSet(t *testing.T, aFlag, aValue string) *flag.FlagSet { - t.Helper() - var val cli.StringSlice - fl := cli.StringSliceFlag{Name: aFlag, EnvVars: []string{"FLAG"}, Value: &val} - set := flag.NewFlagSet("test", 0) - parseInput := []string{fmt.Sprintf("-%s", aFlag), aValue} - err := fl.Apply(set) - require.NoError(t, err) - err = set.Parse(parseInput) - require.NoError(t, err) - return set -} - -func setFlags(t *testing.T, flagSet *flag.FlagSet, flags ...flagObj) *flag.FlagSet { - t.Helper() - for _, f := range flags { - if f.name != "" { - flagSet.StringVar(&f.name, f.name, f.value, "") - } - } - return flagSet -} - -func setEnv(t *testing.T, key, value string) string { - t.Helper() - os.Clearenv() - - t.Setenv(key, value) - return key -} diff --git a/pkg/build/fsutil/copy_test.go b/pkg/build/fsutil/copy_test.go deleted file mode 100644 index 95cb8e838ae..00000000000 --- a/pkg/build/fsutil/copy_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package fsutil_test - -import ( - "os" - "runtime" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/grafana/grafana/pkg/build/fsutil" -) - -func TestCopyFile(t *testing.T) { - src, err := os.CreateTemp("", "") - require.NoError(t, err) - defer func() { - if err := os.RemoveAll(src.Name()); err != nil { - t.Log(err) - } - }() - - err = os.WriteFile(src.Name(), []byte("Contents"), 0600) - require.NoError(t, err) - - dst, err := os.CreateTemp("", "") - require.NoError(t, err) - defer func() { - if err := os.RemoveAll(dst.Name()); err != nil { - t.Log(err) - } - }() - - err = fsutil.CopyFile(src.Name(), dst.Name()) - require.NoError(t, err) -} - -func TestCopyFile_Permissions(t *testing.T) { - perms := os.FileMode(0700) - if runtime.GOOS == "windows" { - // Windows doesn't have file Unix style file permissions - // It seems you have either 0444 for read-only or 0666 for read-write - perms = os.FileMode(0666) - } - - src, err := os.CreateTemp("", "") - require.NoError(t, err) - - defer func() { - if err := os.RemoveAll(src.Name()); err != nil { - t.Log(err) - } - }() - - err = os.WriteFile(src.Name(), []byte("Contents"), perms) - require.NoError(t, err) - err = os.Chmod(src.Name(), perms) - require.NoError(t, err) - - dst, err := os.CreateTemp("", "") - require.NoError(t, err) - defer func() { - if err := os.RemoveAll(dst.Name()); err != nil { - t.Log(err) - } - }() - - err = fsutil.CopyFile(src.Name(), dst.Name()) - require.NoError(t, err) - - fi, err := os.Stat(dst.Name()) - require.NoError(t, err) - assert.Equal(t, perms, fi.Mode()&os.ModePerm) -} - -// Test case where destination directory doesn't exist. -func TestCopyFile_NonExistentDestDir(t *testing.T) { - src, err := os.CreateTemp("", "") - require.NoError(t, err) - defer func() { - if err := os.RemoveAll(src.Name()); err != nil { - t.Log(err) - } - }() - - err = fsutil.CopyFile(src.Name(), "non-existent/dest") - require.EqualError(t, err, "destination directory doesn't exist: \"non-existent\"") -} diff --git a/pkg/build/fsutil/copyfile.go b/pkg/build/fsutil/copyfile.go deleted file mode 100644 index eb7edbdf263..00000000000 --- a/pkg/build/fsutil/copyfile.go +++ /dev/null @@ -1,107 +0,0 @@ -package fsutil - -import ( - "fmt" - "io" - "log" - "os" - "path/filepath" -) - -// CopyFile copies a file from src to dst. -// -// If src and dst files exist, and are the same, then return success. Otherwise, attempt to create a hard link -// between the two files. If that fails, copy the file contents from src to dst. -func CopyFile(src, dst string) (err error) { - absSrc, err := filepath.Abs(src) - if err != nil { - return fmt.Errorf("failed to get absolute path of source file %q: %w", src, err) - } - sfi, err := os.Stat(src) - if err != nil { - err = fmt.Errorf("couldn't stat source file %q: %w", absSrc, err) - return - } - if !sfi.Mode().IsRegular() { - // Cannot copy non-regular files (e.g., directories, symlinks, devices, etc.) - return fmt.Errorf("non-regular source file %s (%q)", absSrc, sfi.Mode().String()) - } - dpath := filepath.Dir(dst) - exists, err := Exists(dpath) - if err != nil { - return err - } - if !exists { - err = fmt.Errorf("destination directory doesn't exist: %q", dpath) - return - } - - var dfi os.FileInfo - dfi, err = os.Stat(dst) - if err != nil { - if !os.IsNotExist(err) { - return - } - } else { - if !(dfi.Mode().IsRegular()) { - return fmt.Errorf("non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String()) - } - if os.SameFile(sfi, dfi) { - return copyPermissions(sfi.Name(), dfi.Name()) - } - } - - err = copyFileContents(src, dst) - return err -} - -// copyFileContents copies the contents of the file named src to the file named -// by dst. The file will be created if it does not already exist. If the -// destination file exists, all it's contents will be replaced by the contents -// of the source file. -func copyFileContents(src, dst string) (err error) { - //nolint:gosec - in, err := os.Open(src) - if err != nil { - return - } - defer func() { - if err := in.Close(); err != nil { - log.Println("error closing file", err) - } - }() - - //nolint:gosec - out, err := os.Create(dst) - if err != nil { - return - } - defer func() { - if cerr := out.Close(); cerr != nil && err == nil { - err = cerr - } - }() - - if _, err = io.Copy(out, in); err != nil { - return - } - - if err := out.Sync(); err != nil { - return err - } - - return copyPermissions(src, dst) -} - -func copyPermissions(src, dst string) error { - sfi, err := os.Lstat(src) - if err != nil { - return err - } - - if err := os.Chmod(dst, sfi.Mode()); err != nil { - return err - } - - return nil -} diff --git a/pkg/build/fsutil/exists_test.go b/pkg/build/fsutil/exists_test.go deleted file mode 100644 index f46297a0764..00000000000 --- a/pkg/build/fsutil/exists_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package fsutil_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/grafana/grafana/pkg/build/fsutil" -) - -func TestExists_NonExistent(t *testing.T) { - exists, err := fsutil.Exists("non-existent") - require.NoError(t, err) - - require.False(t, exists) -} diff --git a/pkg/build/fsutil/exsits.go b/pkg/build/fsutil/exsits.go deleted file mode 100644 index 23e09d20133..00000000000 --- a/pkg/build/fsutil/exsits.go +++ /dev/null @@ -1,16 +0,0 @@ -package fsutil - -import "os" - -// Exists determines whether a file/directory exists or not. -func Exists(fpath string) (bool, error) { - _, err := os.Stat(fpath) - if err != nil { - if !os.IsNotExist(err) { - return false, err - } - return false, nil - } - - return true, nil -} diff --git a/pkg/build/gcloud/auth.go b/pkg/build/gcloud/auth.go deleted file mode 100644 index ad68fbc5d17..00000000000 --- a/pkg/build/gcloud/auth.go +++ /dev/null @@ -1,65 +0,0 @@ -package gcloud - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "log" - "os" - "os/exec" - "strings" -) - -func GetDecodedKey() ([]byte, error) { - gcpKey := strings.TrimSpace(os.Getenv("GCP_KEY")) - if gcpKey == "" { - return nil, fmt.Errorf("the environment variable GCP_KEY must be set") - } - - gcpKeyB, err := base64.StdEncoding.DecodeString(gcpKey) - if err != nil { - // key is not always base64 encoded - validKey := []byte(gcpKey) - if json.Valid(validKey) { - return validKey, nil - } - return nil, fmt.Errorf("error decoding the gcp_key, err: %q", err) - } - - return gcpKeyB, nil -} - -func ActivateServiceAccount() error { - byteKey, err := GetDecodedKey() - if err != nil { - return err - } - - f, err := os.CreateTemp("", "*.json") - if err != nil { - return err - } - defer func() { - if err := os.Remove(f.Name()); err != nil { - log.Printf("error removing %s: %s", f.Name(), err) - } - }() - - defer func() { - if err := f.Close(); err != nil { - log.Println("error closing file:", err) - } - }() - - if _, err := f.Write(byteKey); err != nil { - return fmt.Errorf("failed to write GCP key file: %w", err) - } - keyArg := fmt.Sprintf("--key-file=%s", f.Name()) - //nolint:gosec - cmd := exec.Command("gcloud", "auth", "activate-service-account", keyArg) - - if output, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("failed to sign into GCP: %w\n%s", err, output) - } - return nil -} diff --git a/pkg/build/gcloud/storage/gsutil.go b/pkg/build/gcloud/storage/gsutil.go deleted file mode 100644 index 711728f4fb0..00000000000 --- a/pkg/build/gcloud/storage/gsutil.go +++ /dev/null @@ -1,490 +0,0 @@ -package storage - -import ( - "context" - "errors" - "fmt" - "io" - "log" - "mime" - "os" - "path" - "path/filepath" - "regexp" - "strings" - "sync" - "time" - - "cloud.google.com/go/storage" - "google.golang.org/api/iterator" - "google.golang.org/api/option" - - "github.com/grafana/grafana/pkg/build/fsutil" - "github.com/grafana/grafana/pkg/build/gcloud" -) - -var ( - // ErrorNilBucket is returned when a function is called where a bucket argument is expected and the bucket is nil. - ErrorNilBucket = errors.New("a bucket must be provided") -) - -const ( - // maxThreads specify the number of max threads that can run at the same time. - // Set to 1000, since the maximum number of simultaneous open files for the runners is 1024. - maxThreads = 1000 -) - -// Client wraps the gcloud storage Client with convenient helper functions. -// By using an embedded type we can still use the functions provided by storage.Client if we need to. -type Client struct { - storage.Client -} - -// File represents a file in Google Cloud Storage. -type File struct { - FullPath string - PathTrimmed string -} - -// New creates a new Client by checking for the Google Cloud SDK auth key and/or environment variable. -func New() (*Client, error) { - storageClient, err := newClient() - if err != nil { - return nil, err - } - - client := &Client{ - Client: *storageClient, - } - client.SetRetryer() - - return client, nil -} - -// SetRetryer adds a retry strategy for the googleapi client calls that fail. -func (client *Client) SetRetryer() { - client.SetRetry([]storage.RetryOption{ - storage.WithPolicy(storage.RetryAlways), - storage.WithErrorFunc(storage.ShouldRetry), - }...) -} - -// newClient initializes the google-cloud-storage (GCS) client. -// It first checks for the application-default_credentials.json file then the GCP_KEY environment variable. -func newClient() (*storage.Client, error) { - ctx := context.Background() - - byteKey, err := gcloud.GetDecodedKey() - if err != nil { - return nil, fmt.Errorf("failed to get gcp key, err: %w", err) - } - client, err := storage.NewClient(ctx, option.WithCredentialsJSON(byteKey)) - if err != nil { - log.Println("failed to login with GCP_KEY, trying with default application credentials...") - client, err = storage.NewClient(ctx) - if err != nil { - return nil, fmt.Errorf("failed to open Google Cloud Storage client: %w", err) - } - } - - return client, nil -} - -// CopyLocalDir copies a local directory 'dir' to the bucket 'bucket' at the path 'bucketPath'. -func (client *Client) CopyLocalDir(ctx context.Context, dir string, bucket *storage.BucketHandle, bucketPath string, trim bool) error { - if bucket == nil { - return ErrorNilBucket - } - - files, err := ListLocalFiles(dir) - if err != nil { - return err - } - log.Printf("Number or files to be copied over: %d\n", len(files)) - - errs := make([]error, 0, 10) - errsLock := sync.Mutex{} - - for _, chunk := range asChunks(files, maxThreads) { - var wg sync.WaitGroup - for _, f := range chunk { - wg.Add(1) - go func(file File) { - defer wg.Done() - err := client.Copy(ctx, file, bucket, bucketPath, trim) - if err != nil { - log.Printf("failed to copy objects, err: %s\n", err.Error()) - errsLock.Lock() - errs = append(errs, err) - errsLock.Unlock() - } - }(f) - } - wg.Wait() - } - - if len(errs) > 0 { - return fmt.Errorf("copy operation failed: %s", errs) - } - - return nil -} - -// Copy copies a single local file into the bucket at the provided path. -// trim variable should be set to true if the full object path is needed - false otherwise. -func (client *Client) Copy(ctx context.Context, file File, bucket *storage.BucketHandle, remote string, trim bool) (resultErr error) { - if bucket == nil { - return ErrorNilBucket - } - - localFile, err := os.Open(file.FullPath) - if err != nil { - return fmt.Errorf("failed to open file %s, err: %q", file.FullPath, err) - } - defer func() { - if err := localFile.Close(); err != nil { - log.Println("failed to close localfile", "err", err) - } - }() - - extension := strings.ToLower(path.Ext(file.FullPath)) - contentType := mime.TypeByExtension(extension) - - filePath := file.FullPath - if trim { - filePath = file.PathTrimmed - } - - objectPath := path.Join(remote, filePath) - - wc := bucket.Object(objectPath).NewWriter(ctx) - wc.ContentType = contentType - defer func() { - if err := wc.Close(); err != nil { - log.Println("failed to close writer", "err", err) - // Keep the original error intact if there was one: - if resultErr == nil { - resultErr = err - } - } - }() - - if _, err = io.Copy(wc, localFile); err != nil { - resultErr = fmt.Errorf("failed to copy to Cloud Storage: %w", err) - return - } - - return nil -} - -// CopyRemoteDir copies an entire directory 'from' from the bucket 'fromBucket' into the 'toBucket' at the path 'to'. -func (client *Client) CopyRemoteDir(ctx context.Context, fromBucket *storage.BucketHandle, from string, toBucket *storage.BucketHandle, to string) error { - if toBucket == nil || fromBucket == nil { - return ErrorNilBucket - } - - files, err := ListRemoteFiles(ctx, fromBucket, FilesFilter{Prefix: from}) - if err != nil { - return err - } - - var ch = make(chan File, len(files)) - var wg sync.WaitGroup - wg.Add(maxThreads) - - for i := 0; i < maxThreads; i++ { - go func() { - for { - file, ok := <-ch - if !ok { - wg.Done() - return - } - if err := client.RemoteCopy(ctx, file, fromBucket, toBucket, to); err != nil { - log.Printf("failed to copy files between buckets: err: %s\n", err.Error()) - return - } - } - }() - } - - for _, file := range files { - ch <- file - } - - close(ch) - wg.Wait() - - return nil -} - -// RemoteCopy will copy the file 'file' from the 'fromBucket' to the 'toBucket' at the path 'path'. -func (client *Client) RemoteCopy(ctx context.Context, file File, fromBucket, toBucket *storage.BucketHandle, path string) error { - // Should this be path.Join instead of filepath.Join? filepath.Join on Windows will produce `\\` separators instead of `/`. - var ( - src = fromBucket.Object(file.FullPath) - dstObject = filepath.Join(path, file.PathTrimmed) - dst = toBucket.Object(dstObject) - ) - - if _, err := dst.CopierFrom(src).Run(ctx); err != nil { - return fmt.Errorf("failed to copy object %s, to %s, err: %w", file.FullPath, dstObject, err) - } - - return nil -} - -// DeleteDir deletes a directory at 'path' from the bucket. -func (client *Client) DeleteDir(ctx context.Context, bucket *storage.BucketHandle, path string) error { - if bucket == nil { - return ErrorNilBucket - } - - files, err := ListRemoteFiles(ctx, bucket, FilesFilter{Prefix: path}) - if err != nil { - return err - } - - var ch = make(chan string, len(files)) - var wg sync.WaitGroup - wg.Add(maxThreads) - - for i := 0; i < maxThreads; i++ { - go func() { - for { - fullPath, ok := <-ch - if !ok { - wg.Done() - return - } - err := client.Delete(ctx, bucket, fullPath) - if err != nil && !errors.Is(err, storage.ErrObjectNotExist) { - log.Printf("failed to delete objects, err %s\n", err.Error()) - panic(err) - } - } - }() - } - - for _, file := range files { - ch <- file.FullPath - } - - close(ch) - wg.Wait() - - return nil -} - -// Delete deletes single item from the bucket at 'path'. -func (client *Client) Delete(ctx context.Context, bucket *storage.BucketHandle, path string) error { - object := bucket.Object(path) - if err := object.Delete(ctx); err != nil { - return fmt.Errorf("cannot delete %s, err: %w", path, err) - } - return nil -} - -// ListLocalFiles lists files in a local filesystem. -func ListLocalFiles(dir string) ([]File, error) { - var files []File - err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if !info.IsDir() { - files = append(files, File{ - FullPath: path, - // Strip the dir name from the filepath - PathTrimmed: strings.ReplaceAll(path, dir, ""), - }) - } - return nil - }) - - if err != nil { - return nil, fmt.Errorf("error walking path: %v", err) - } - - return files, nil -} - -type FilesFilter struct { - Prefix string - FileExts []string -} - -// ListRemoteFiles lists all the files in the directory (filtering by FilesFilter) and returns a File struct for each one. -func ListRemoteFiles(ctx context.Context, bucket *storage.BucketHandle, filter FilesFilter) ([]File, error) { - if bucket == nil { - return []File{}, ErrorNilBucket - } - - it := bucket.Objects(ctx, &storage.Query{ - Prefix: filter.Prefix, - }) - - var files []File - for { - attrs, err := it.Next() - if err != nil { - if errors.Is(err, iterator.Done) { - break - } - } - if err != nil { - return nil, fmt.Errorf("failed to iterate through bucket, err: %w", err) - } - - extMatch := len(filter.FileExts) == 0 - for _, ext := range filter.FileExts { - if ext == filepath.Ext(attrs.Name) { - extMatch = true - break - } - } - - if extMatch { - files = append(files, File{FullPath: attrs.Name, PathTrimmed: strings.TrimPrefix(attrs.Name, filter.Prefix)}) - } - } - - return files, nil -} - -// DownloadDirectory downloads files from bucket (filtering by FilesFilter) to destPath on disk. -func (client *Client) DownloadDirectory(ctx context.Context, bucket *storage.BucketHandle, destPath string, filter FilesFilter) error { - if bucket == nil { - return ErrorNilBucket - } - - files, err := ListRemoteFiles(ctx, bucket, filter) - if err != nil { - return err - } - - // return err if dir already exists - exists, err := fsutil.Exists(destPath) - if err != nil { - return err - } - if exists { - return fmt.Errorf("destination path %q already exists", destPath) - } - - err = os.MkdirAll(destPath, 0750) - if err != nil && !os.IsExist(err) { - return err - } - - for _, file := range files { - err = client.downloadFile(ctx, bucket, file.FullPath, file.PathTrimmed) - if err != nil { - return err - } - } - return nil -} - -// GetLatestMainBuild gets the latest main build which is successfully uploaded to the gcs bucket. -func GetLatestMainBuild(ctx context.Context, bucket *storage.BucketHandle, path string) (string, error) { - if bucket == nil { - return "", ErrorNilBucket - } - - query := &storage.Query{ - Prefix: path, - } - err := query.SetAttrSelection([]string{"Name", "Generation"}) - if err != nil { - return "", fmt.Errorf("failed to set attribute selector, err: %q", err) - } - it := bucket.Objects(ctx, query) - - var files []string - var oldGeneration int64 - for { - attrs, err := it.Next() - if errors.Is(err, iterator.Done) { - break - } - if err != nil { - return "", fmt.Errorf("failed to iterate through bucket, err: %w", err) - } - if attrs.Generation >= oldGeneration { - files = append([]string{attrs.Name}, files...) - oldGeneration = attrs.Generation - } else { - files = append(files, attrs.Name) - } - } - - var latestVersion string - for i := 0; i < len(files); i++ { - captureVersion := regexp.MustCompile(`(\d+\.\d+\.\d+-\d+)`) - if captureVersion.MatchString(files[i]) { - latestVersion = captureVersion.FindString(files[i]) - break - } - } - - return latestVersion, nil -} - -// downloadFile downloads an object to a file. -func (client *Client) downloadFile(ctx context.Context, bucket *storage.BucketHandle, objectName, destFileName string) error { - if bucket == nil { - return ErrorNilBucket - } - - ctx, cancel := context.WithTimeout(ctx, time.Second*10) - defer cancel() - - // nolint:gosec - f, err := os.Create(destFileName) - if err != nil { - return fmt.Errorf("os.Create: %v", err) - } - - rc, err := bucket.Object(objectName).NewReader(ctx) - if err != nil { - return fmt.Errorf("Object(%q).NewReader: %v", objectName, err) - } - defer func() { - if err := rc.Close(); err != nil { - log.Println("failed to close reader", "err", err) - } - }() - - if _, err := io.Copy(f, rc); err != nil { - return fmt.Errorf("io.Copy: %v", err) - } - - if err = f.Close(); err != nil { - return fmt.Errorf("f.Close: %v", err) - } - - return nil -} - -// asChunks will split the supplied []File into slices with a max size of `chunkSize` -// []string{"a", "b", "c"}, 1 => [][]string{[]string{"a"}, []string{"b"}, []string{"c"}} -// []string{"a", "b", "c"}, 2 => [][]string{[]string{"a", "b"}, []string{"c"}}. -func asChunks(files []File, chunkSize int) [][]File { - var fileChunks [][]File - - if len(files) == 0 { - return [][]File{} - } - - if len(files) > chunkSize && chunkSize > 0 { - for i := 0; i < len(files); i += chunkSize { - end := i + chunkSize - - if end > len(files) { - end = len(files) - } - fileChunks = append(fileChunks, files[i:end]) - } - } else { - fileChunks = [][]File{files} - } - return fileChunks -} diff --git a/pkg/build/gcloud/storage/gsutil_test.go b/pkg/build/gcloud/storage/gsutil_test.go deleted file mode 100644 index 9a8ae5cb6ad..00000000000 --- a/pkg/build/gcloud/storage/gsutil_test.go +++ /dev/null @@ -1,225 +0,0 @@ -package storage - -import ( - "context" - "os" - "path/filepath" - "testing" - - "cloud.google.com/go/storage" - "github.com/stretchr/testify/require" - "google.golang.org/api/option" -) - -func Test_asChunks(t *testing.T) { - type args struct { - files []File - chunkSize int - } - tcs := []struct { - name string - args args - expected [][]File - }{ - { - name: "Happy path #1", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - {FullPath: "/1"}, - {FullPath: "/2"}, - {FullPath: "/3"}, - }, - chunkSize: 5, - }, - expected: [][]File{ - {{FullPath: "/a"}, {FullPath: "/b"}, {FullPath: "/c"}, {FullPath: "/1"}, {FullPath: "/2"}}, - {{FullPath: "/3"}}, - }, - }, - { - name: "Happy path #2", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - {FullPath: "/1"}, - {FullPath: "/2"}, - {FullPath: "/3"}, - }, - chunkSize: 2, - }, - expected: [][]File{ - {{FullPath: "/a"}, {FullPath: "/b"}}, - {{FullPath: "/c"}, {FullPath: "/1"}}, - {{FullPath: "/2"}, {FullPath: "/3"}}, - }, - }, - { - name: "Happy path #3", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - chunkSize: 1, - }, - expected: [][]File{ - {{FullPath: "/a"}}, - {{FullPath: "/b"}}, - {{FullPath: "/c"}}, - }, - }, - { - name: "A chunkSize with 0 value returns the input as a single chunk", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - chunkSize: 0, - }, - expected: [][]File{ - { - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - }, - }, - { - name: "A chunkSize with negative value returns the input as a single chunk", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - chunkSize: -1, - }, - expected: [][]File{ - { - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - }, - }, - { - name: "A chunkSize greater than the size on input returns the input as a single chunk", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - chunkSize: 5, - }, - expected: [][]File{ - { - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - }, - }, - { - name: "A chunkSize equal the size on input returns the input as a single chunk", - args: args{ - files: []File{ - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - chunkSize: 3, - }, - expected: [][]File{ - { - {FullPath: "/a"}, - {FullPath: "/b"}, - {FullPath: "/c"}, - }, - }, - }, - { - name: "An empty input returns empty chunks", - args: args{ - files: []File{}, - chunkSize: 3, - }, - expected: [][]File{}, - }, - } - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - result := asChunks(tc.args.files, tc.args.chunkSize) - require.Equal(t, tc.expected, result) - }) - } -} - -func TestCopyLocalDir(t *testing.T) { - t.Parallel() - - tmpDir := t.TempDir() - testFiles := []string{"file1.txt", "file2.txt"} - for _, testFile := range testFiles { - path := filepath.Join(tmpDir, testFile) - require.NoError(t, os.WriteFile(path, []byte{}, 0600)) - } - - // If an upload fails then the whole copy operation should return an error. - t.Run("failure-should-error", func(t *testing.T) { - t.Parallel() - - // Assemble: - ctx := context.Background() - client := createAnonymousClient(t, ctx) - testBucket := client.Bucket("grafana-testing-repo") - - // Act: - err := client.CopyLocalDir(ctx, tmpDir, testBucket, "test-path", false) - - // Assert: - // This should fail as the client has no access to the bucket to upload to: - require.Error(t, err) - }) -} - -func TestCopyRemoteDir(t *testing.T) { - t.Parallel() - - t.Run("failure-should-error", func(t *testing.T) { - t.Parallel() - - // Assemble: - ctx := context.Background() - client := createAnonymousClient(t, ctx) - testFromBucket := client.Bucket("grafana-testing-repo") - testToBucket := client.Bucket("grafana-testing-repo") - - // Act: - err := client.CopyRemoteDir(ctx, testFromBucket, "test-from", testToBucket, "test-to") - - // Assert: - // This should fail as the client has no access to the bucket to copy from/to. Unfortunately, this does not yet - // cover if a single file fails to get transferred. - require.Error(t, err) - }) -} - -func createAnonymousClient(t *testing.T, ctx context.Context) *Client { - t.Helper() - storageClient, err := storage.NewClient(ctx, option.WithoutAuthentication()) - require.NoError(t, err) - client := &Client{ - Client: *storageClient, - } - require.NoError(t, err) - return client -} diff --git a/pkg/build/gcom/url.go b/pkg/build/gcom/url.go deleted file mode 100644 index e85c1039796..00000000000 --- a/pkg/build/gcom/url.go +++ /dev/null @@ -1,72 +0,0 @@ -package gcom - -import ( - "fmt" - "net/url" - "path" - "strings" - - "github.com/grafana/grafana/pkg/build/versions" -) - -func PackageName(grafana, distro, arch, version, ext string, musl bool, raspberryPi bool) string { - v := versions.ParseSemver(version) - - if raspberryPi { - grafana += "-rpi" - } - - versionString := strings.Join([]string{v.Major, v.Minor, v.Patch}, ".") - fmt.Println("Version string:", versionString) - if distro == "deb" { - if v.BuildMetadata != "" { - versionString += "+" + strings.ReplaceAll(v.BuildMetadata, "-", "~") - } - - if v.Prerelease != "" { - versionString += "~" + v.Prerelease - } - - return strings.Join([]string{grafana, versionString, arch}, "_") + "." + ext - } - - if distro == "rhel" { - if v.BuildMetadata != "" { - versionString += "+" + strings.ReplaceAll(v.BuildMetadata, "-", "~") - } - - if v.Prerelease != "" { - versionString += "~" + v.Prerelease - } - - versionString += "-1" - - // Notable difference between our deb naming and our RPM naming: the file ends with `.arch.ext`, not - // `_arch.ext`. - return strings.Join([]string{grafana, versionString}, "-") + "." + arch + "." + ext - } - - if v.Prerelease != "" { - versionString += "-" + v.Prerelease - } - - if v.BuildMetadata != "" { - versionString += "+" + v.BuildMetadata - } - - if musl { - arch += "-musl" - } - - // grafana-enterprise-1.2.3+example-01.linux-amd64.tar.gz - return fmt.Sprintf("%s-%s.%s-%s.%s", grafana, versionString, distro, arch, ext) -} - -func GetURL(baseURL *url.URL, version, grafana, distro, arch, ext string, musl, raspberryPi bool) *url.URL { - packageName := PackageName(grafana, distro, arch, version, ext, musl, raspberryPi) - return &url.URL{ - Host: baseURL.Host, - Scheme: baseURL.Scheme, - Path: path.Join(baseURL.Path, packageName), - } -} diff --git a/pkg/build/gcom/url_test.go b/pkg/build/gcom/url_test.go deleted file mode 100644 index 680a4326fd1..00000000000 --- a/pkg/build/gcom/url_test.go +++ /dev/null @@ -1,367 +0,0 @@ -package gcom_test - -import ( - "fmt" - "testing" - - "github.com/grafana/grafana/pkg/build/gcom" - "github.com/stretchr/testify/require" -) - -func TestPackageName(t *testing.T) { - type args struct { - Distro string - Arch string - Version string - Ext string - Musl bool - RaspberryPi bool - - Expect string - } - - cases := []args{ - { - RaspberryPi: true, - Distro: "deb", - Arch: "armhf", - Version: "1.2.3", - Ext: "deb", - Expect: "grafana-rpi_1.2.3_armhf.deb", - }, - { - Distro: "deb", - Arch: "arm64", - Version: "1.2.3", - Ext: "deb", - Expect: "grafana_1.2.3_arm64.deb", - }, - { - Distro: "rhel", - Arch: "aarch64", - Version: "1.2.3", - Ext: "rpm", - Expect: "grafana-1.2.3-1.aarch64.rpm", - }, - { - Distro: "rhel", - Arch: "aarch64", - Ext: "rpm.sha256", - Version: "1.2.3", - Expect: "grafana-1.2.3-1.aarch64.rpm.sha256", - }, - { - Distro: "rhel", - Ext: "rpm", - Version: "1.2.3", - Arch: "x86_64", - Expect: "grafana-1.2.3-1.x86_64.rpm", - }, - { - Distro: "rhel", - Ext: "rpm.sha256", - Version: "1.2.3", - Arch: "x86_64", - Expect: "grafana-1.2.3-1.x86_64.rpm.sha256", - }, - { - Distro: "darwin", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.darwin-amd64.tar.gz", - }, - { - Distro: "darwin", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.darwin-amd64.tar.gz.sha256", - }, - { - Distro: "darwin", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.darwin-arm64-musl.tar.gz", - Musl: true, - }, - { - Distro: "darwin", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.darwin-arm64-musl.tar.gz.sha256", - Musl: true, - }, - { - Distro: "darwin", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.darwin-arm64.tar.gz", - }, - { - Distro: "darwin", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.darwin-arm64.tar.gz.sha256", - }, - { - Distro: "linux", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.linux-amd64-musl.tar.gz", - Musl: true, - }, - { - Distro: "linux", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.linux-amd64-musl.tar.gz.sha256", - Musl: true, - }, - { - Distro: "linux", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.linux-amd64.tar.gz", - }, - { - Distro: "linux", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "amd64", - Expect: "grafana-1.2.3.linux-amd64.tar.gz.sha256", - }, - { - Distro: "linux", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.linux-arm64-musl.tar.gz", - Musl: true, - }, - { - Distro: "linux", - Ext: "tar.gz.sha256", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.linux-arm64-musl.tar.gz.sha256", - Musl: true, - }, - { - Distro: "linux", - Ext: "tar.gz", - Version: "1.2.3", - Arch: "arm64", - Expect: "grafana-1.2.3.linux-arm64.tar.gz", - }, - { - Ext: "tar.gz.sha256", - Version: "1.2.3", - Distro: "linux", - Arch: "arm64", - Expect: "grafana-1.2.3.linux-arm64.tar.gz.sha256", - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "linux", - Arch: "armv6", - Expect: "grafana-1.2.3.linux-armv6.tar.gz", - }, - { - Ext: "tar.gz.sha256", - Version: "1.2.3", - Distro: "linux", - Arch: "armv6", - Expect: "grafana-1.2.3.linux-armv6.tar.gz.sha256", - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "linux", - Arch: "armv7", - Expect: "grafana-1.2.3.linux-armv7-musl.tar.gz", - Musl: true, - }, - { - Ext: "tar.gz.sha256", - Version: "1.2.3", - Distro: "linux", - Arch: "armv7", - Expect: "grafana-1.2.3.linux-armv7-musl.tar.gz.sha256", - Musl: true, - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "linux", - Arch: "armv7", - Expect: "grafana-1.2.3.linux-armv7.tar.gz", - }, - { - Ext: "tar.gz.sha256", - Version: "1.2.3", - Distro: "linux", - Arch: "armv7", - Expect: "grafana-1.2.3.linux-armv7.tar.gz.sha256", - }, - { - Version: "1.2.3", - Arch: "amd64", - Ext: "exe", - Distro: "windows", - Expect: "grafana-1.2.3.windows-amd64.exe", - }, - { - Version: "1.2.3", - Arch: "amd64", - Distro: "windows", - Ext: "exe.sha256", - Expect: "grafana-1.2.3.windows-amd64.exe.sha256", - }, - { - Version: "1.2.3", - Arch: "amd64", - Distro: "windows", - Ext: "msi", - Expect: "grafana-1.2.3.windows-amd64.msi", - }, - { - Version: "1.2.3", - Arch: "amd64", - Distro: "windows", - Ext: "msi.sha256", - Expect: "grafana-1.2.3.windows-amd64.msi.sha256", - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "windows", - Expect: "grafana-1.2.3.windows-amd64.tar.gz", - Arch: "amd64", - }, - { - Version: "1.2.3", - Distro: "windows", - Arch: "amd64", - Ext: "tar.gz.sha256", - Expect: "grafana-1.2.3.windows-amd64.tar.gz.sha256", - }, - { - Version: "1.2.3", - Distro: "windows", - Expect: "grafana-1.2.3.windows-amd64.zip", - Ext: "zip", - Arch: "amd64", - }, - { - Version: "1.2.3", - Distro: "windows", - Expect: "grafana-1.2.3.windows-amd64.zip.sha256", - Ext: "zip.sha256", - Arch: "amd64", - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "windows", - Arch: "arm64", - Expect: "grafana-1.2.3.windows-arm64-musl.tar.gz", - Musl: true, - }, - { - Version: "1.2.3", - Ext: "tar.gz.sha256", - Distro: "windows", - Arch: "arm64", - Expect: "grafana-1.2.3.windows-arm64-musl.tar.gz.sha256", - Musl: true, - }, - { - Ext: "tar.gz", - Version: "1.2.3", - Distro: "windows", - Arch: "arm64", - Expect: "grafana-1.2.3.windows-arm64.tar.gz", - }, - { - Version: "1.2.3", - Ext: "tar.gz.sha256", - Distro: "windows", - Arch: "arm64", - Expect: "grafana-1.2.3.windows-arm64.tar.gz.sha256", - }, - { - RaspberryPi: true, - Version: "1.2.3", - Ext: "deb", - Arch: "armhf", - Distro: "deb", - Expect: "grafana-rpi_1.2.3_armhf.deb", - }, - { - RaspberryPi: true, - Version: "1.2.3", - Ext: "deb.sha256", - Distro: "deb", - Arch: "armhf", - Expect: "grafana-rpi_1.2.3_armhf.deb.sha256", - }, - { - Version: "1.2.3", - Ext: "deb", - Distro: "deb", - Expect: "grafana_1.2.3_amd64.deb", - Arch: "amd64", - }, - { - Version: "1.2.3", - Ext: "deb.sha256", - Distro: "deb", - Expect: "grafana_1.2.3_amd64.deb.sha256", - Arch: "amd64", - }, - { - Version: "1.2.3", - Ext: "deb", - Arch: "arm64", - Distro: "deb", - Expect: "grafana_1.2.3_arm64.deb", - }, - { - Version: "1.2.3", - Ext: "deb.sha256", - Arch: "arm64", - Distro: "deb", - Expect: "grafana_1.2.3_arm64.deb.sha256", - }, - { - Version: "1.2.3", - Ext: "deb", - Distro: "deb", - Arch: "armhf", - Expect: "grafana_1.2.3_armhf.deb", - }, - { - Version: "1.2.3", - Ext: "deb.sha256", - Arch: "armhf", - Distro: "deb", - Expect: "grafana_1.2.3_armhf.deb.sha256", - }, - } - - for i, v := range cases { - t.Run(fmt.Sprintf("[%d / %d] %s", i+1, len(cases), v.Expect), func(t *testing.T) { - n := gcom.PackageName("grafana", v.Distro, v.Arch, v.Version, v.Ext, v.Musl, v.RaspberryPi) - require.Equal(t, v.Expect, n) - }) - } -} diff --git a/pkg/build/git/git.go b/pkg/build/git/git.go deleted file mode 100644 index de1ac94559a..00000000000 --- a/pkg/build/git/git.go +++ /dev/null @@ -1,53 +0,0 @@ -package git - -import ( - "context" - "errors" - "fmt" - "regexp" - - "github.com/google/go-github/v70/github" -) - -const ( - MainBranch = "main" - HomeDir = "." - RepoOwner = "grafana" - OSSRepo = "grafana" - EnterpriseRepo = "grafana-enterprise" - EnterpriseCheckName = "Grafana Enterprise" - EnterpriseCheckDescription = "Downstream tests to ensure that your changes are compatible with Grafana Enterprise" -) - -var EnterpriseCheckLabels = []string{"enterprise-ok", "enterprise-failed", "enterprise-override"} - -var ( - ErrorNoDroneBuildLink = errors.New("no drone build link") -) - -type GitService interface { - DeleteRef(ctx context.Context, owner string, repo string, ref string) (*github.Response, error) -} - -type LabelsService interface { - ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *github.ListOptions) ([]*github.Label, *github.Response, error) - RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*github.Response, error) - AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error) -} - -type CommentService interface { - CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error) -} - -type StatusesService interface { - CreateStatus(ctx context.Context, owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, *github.Response, error) -} - -func PRCheckRegexp() *regexp.Regexp { - reBranch, err := regexp.Compile(`^prc-([0-9]+)-([A-Za-z0-9]+)\/(.+)$`) - if err != nil { - panic(fmt.Sprintf("Failed to compile regexp: %s", err)) - } - - return reBranch -} diff --git a/pkg/build/go.mod b/pkg/build/go.mod index 3012a2bab49..2c3ea9cebf7 100644 --- a/pkg/build/go.mod +++ b/pkg/build/go.mod @@ -8,114 +8,50 @@ go 1.24.6 replace github.com/docker/docker => github.com/moby/moby v27.5.1+incompatible require ( - cloud.google.com/go/storage v1.55.0 // @grafana/grafana-backend-group - github.com/Masterminds/semver/v3 v3.4.0 // @grafana/grafana-developer-enablement-squad - github.com/aws/aws-sdk-go v1.55.7 // @grafana/aws-datasources - github.com/docker/docker v28.1.1+incompatible // @grafana/grafana-developer-enablement-squad - github.com/drone/drone-cli v1.8.0 // @grafana/grafana-developer-enablement-squad - github.com/gogo/protobuf v1.3.2 // indirect; @grafana/alerting-backend - github.com/google/go-cmp v0.7.0 // @grafana/grafana-backend-group github.com/google/uuid v1.6.0 // indirect; @grafana/grafana-backend-group - github.com/googleapis/gax-go/v2 v2.14.2 // indirect; @grafana/grafana-backend-group - github.com/jmespath/go-jmespath v0.4.0 // indirect; @grafana/grafana-backend-group - github.com/stretchr/testify v1.10.0 // @grafana/grafana-backend-group - github.com/urfave/cli v1.22.16 // @grafana/grafana-backend-group github.com/urfave/cli/v2 v2.27.6 // @grafana/grafana-backend-group - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect; @grafana/plugins-platform-backend - go.opentelemetry.io/otel v1.37.0 // @grafana/grafana-backend-group + go.opentelemetry.io/otel v1.37.0 // indirect; @grafana/grafana-backend-group go.opentelemetry.io/otel/sdk v1.37.0 // indirect; @grafana/grafana-backend-group - go.opentelemetry.io/otel/trace v1.37.0 // @grafana/grafana-backend-group - golang.org/x/crypto v0.40.0 // indirect; @grafana/grafana-backend-group - golang.org/x/net v0.42.0 // indirect; @grafana/oss-big-tent @grafana/partner-datasources - golang.org/x/oauth2 v0.30.0 // @grafana/identity-access-team + go.opentelemetry.io/otel/trace v1.37.0 // indirect; @grafana/grafana-backend-group + golang.org/x/net v0.43.0 // indirect; @grafana/oss-big-tent @grafana/partner-datasources golang.org/x/sync v0.16.0 // @grafana/alerting-backend - golang.org/x/text v0.27.0 // indirect; @grafana/grafana-backend-group - golang.org/x/time v0.11.0 // indirect; @grafana/grafana-backend-group - google.golang.org/api v0.235.0 // @grafana/grafana-backend-group + golang.org/x/text v0.28.0 // indirect; @grafana/grafana-backend-group google.golang.org/grpc v1.74.2 // indirect; @grafana/plugins-platform-backend google.golang.org/protobuf v1.36.6 // indirect; @grafana/plugins-platform-backend - gopkg.in/yaml.v3 v3.0.1 // @grafana/alerting-backend ) require ( - cloud.google.com/go v0.121.1 // indirect - cloud.google.com/go/auth v0.16.1 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.7.0 // indirect - cloud.google.com/go/iam v1.5.2 // indirect - github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/bmatcuk/doublestar v1.3.4 // indirect - github.com/buildkite/yaml v2.1.0+incompatible // indirect github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/docker/go-connections v0.5.0 // indirect - github.com/docker/go-units v0.5.0 // indirect - github.com/drone-runners/drone-runner-docker v1.8.3 // indirect - github.com/drone/drone-go v1.7.1 // indirect - github.com/drone/envsubst v1.0.3 // indirect - github.com/drone/runner-go v1.12.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect github.com/go-logr/logr v1.4.3 // indirect; @grafana/grafana-app-platform-squad github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/go-querystring v1.1.0 // indirect - github.com/google/s2a-go v0.1.9 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - golang.org/x/sys v0.34.0 // indirect - google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect; @grafana/grafana-backend-group + golang.org/x/sys v0.35.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) require ( dagger.io/dagger v0.18.8 github.com/Masterminds/semver v1.5.0 - github.com/google/go-github/v70 v70.0.0 github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/urfave/cli/v3 v3.3.3 ) require ( - cel.dev/expr v0.24.0 // indirect - cloud.google.com/go/monitoring v1.24.2 // indirect github.com/99designs/gqlgen v0.17.73 // indirect - github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect github.com/Khan/genqlient v0.8.1 // indirect github.com/adrg/xdg v0.5.3 // indirect github.com/cenkalti/backoff/v5 v5.0.2 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect - github.com/containerd/log v0.1.0 // indirect - github.com/distribution/reference v0.6.0 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect - github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect - github.com/go-jose/go-jose/v4 v4.1.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/moby/docker-image-spec v1.3.1 // indirect - github.com/moby/term v0.5.0 // indirect - github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/sosodev/duration v1.3.1 // indirect - github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect github.com/vektah/gqlparser/v2 v2.5.27 // indirect - github.com/zeebo/errs v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.12.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.37.0 // indirect @@ -127,7 +63,6 @@ require ( go.opentelemetry.io/otel/sdk/log v0.12.2 // indirect go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect go.opentelemetry.io/proto/otlp v1.7.0 // indirect - gotest.tools/v3 v3.5.1 // indirect ) // Use fork of crewjam/saml with fixes for some issues until changes get merged into upstream diff --git a/pkg/build/go.sum b/pkg/build/go.sum index abb46b91775..d2257f2690b 100644 --- a/pkg/build/go.sum +++ b/pkg/build/go.sum @@ -1,254 +1,56 @@ -cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= -cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.121.1 h1:S3kTQSydxmu1JfLRLpKtxRPA7rSrYPRPEUmL/PavVUw= -cloud.google.com/go v0.121.1/go.mod h1:nRFlrHq39MNVWu+zESP2PosMWA0ryJw8KUBZ2iZpxbw= -cloud.google.com/go/auth v0.16.1 h1:XrXauHMd30LhQYVRHLGvJiYeczweKQXZxsTbV9TiguU= -cloud.google.com/go/auth v0.16.1/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI= -cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= -cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeOCw78U8ytSU= -cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo= -cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8= -cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE= -cloud.google.com/go/logging v1.13.0 h1:7j0HgAp0B94o1YRDqiqm26w4q1rDMH7XNRU34lJXHYc= -cloud.google.com/go/logging v1.13.0/go.mod h1:36CoKh6KA/M0PbhPKMq6/qety2DCAErbhXT62TuXALA= -cloud.google.com/go/longrunning v0.6.7 h1:IGtfDWHhQCgCjwQjV9iiLnUta9LBCo8R9QmAFsS/PrE= -cloud.google.com/go/longrunning v0.6.7/go.mod h1:EAFV3IZAKmM56TyiE6VAP3VoTzhZzySwI/YI1s/nRsY= -cloud.google.com/go/monitoring v1.24.2 h1:5OTsoJ1dXYIiMiuL+sYscLc9BumrL3CarVLL7dd7lHM= -cloud.google.com/go/monitoring v1.24.2/go.mod h1:x7yzPWcgDRnPEv3sI+jJGBkwl5qINf+6qY4eq0I9B4U= -cloud.google.com/go/storage v1.55.0 h1:NESjdAToN9u1tmhVqhXCaCwYBuvEhZLLv0gBr+2znf0= -cloud.google.com/go/storage v1.55.0/go.mod h1:ztSmTTwzsdXe5syLVS0YsbFxXuvEmEyZj7v7zChEmuY= -cloud.google.com/go/trace v1.11.6 h1:2O2zjPzqPYAHrn3OKl029qlqG6W8ZdYaOWRyr8NgMT4= -cloud.google.com/go/trace v1.11.6/go.mod h1:GA855OeDEBiBMzcckLPE2kDunIpC72N+Pq8WFieFjnI= dagger.io/dagger v0.18.8 h1:k3+DvD93Fy5SKijuPqFGvnQIBdJQJdfZtrGp4rqU1Xg= dagger.io/dagger v0.18.8/go.mod h1:FWhniTblKFaUK6emdtL229v9GUOgC5rqIWIzABIdJIc= -github.com/99designs/basicauth-go v0.0.0-20160802081356-2a93ba0f464d/go.mod h1:3cARGAK9CfW3HoxCy1a0G4TKrdiKke8ftOMEOHyySYs= github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg= github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg= -github.com/99designs/httpsignatures-go v0.0.0-20170731043157-88528bf4ca7e/go.mod h1:Xa6lInWHNQnuWoF0YPSsx+INFA9qk7/7pTjwb3PInkY= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 h1:ErKg/3iS1AKcTkf3yixlZ54f9U1rljCkQyEXWUnIUxc= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0/go.mod h1:yAZHSGnqScoU556rBOVkwLze6WP5N+U11RHuWaGVxwY= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 h1:fYE9p3esPxA/C0rQ0AHhP0drtPXDRhaWiwg1DPqO7IU= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0/go.mod h1:BnBReJLvVYx2CS/UHOgVz2BXKXD9wsQPxZug20nZhd0= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0 h1:OqVGm6Ei3x5+yZmSJG1Mh2NwHvpVmZ08CB5qJhT9Nuk= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.51.0/go.mod h1:SZiPHWGOOk3bl8tkevxkoiwPgsIl6CwrWcbwjfHZpdM= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 h1:6/0iUd0xrnX7qt+mLNRwg5c0PGv8wpE8K90ryANQwMI= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0= github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= -github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= -github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE= -github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= -github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= -github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= -github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/buildkite/yaml v2.1.0+incompatible h1:xirI+ql5GzfikVNDmt+yeiXpf/v1Gt03qXTtT5WXdr8= -github.com/buildkite/yaml v2.1.0+incompatible/go.mod h1:UoU8vbcwu1+vjZq01+KrpSeLBgQQIjL/H7Y6KwikUrI= github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls= -github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= -github.com/containerd/containerd v1.3.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= -github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4= -github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= -github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= -github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/drone-runners/drone-runner-docker v1.8.3 h1:uUnC45C1JMSLW+9uy6RoKG5ugzeXWN89pygs9BMLObY= -github.com/drone-runners/drone-runner-docker v1.8.3/go.mod h1:JR3pZeVZKKpkbTajiq0YtAx9WutkODdVKZGNR83kEwE= -github.com/drone/drone-cli v1.8.0 h1:tpp+GPonS87IKMZCGbIoa+zfDwiuJDL3NIC6S7neNrU= -github.com/drone/drone-cli v1.8.0/go.mod h1:zu6/7OpQjWBw/5VG0M3K4iJc6kSoTrjnY7CRLBrGH84= -github.com/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw= -github.com/drone/drone-go v1.7.1/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg= -github.com/drone/envsubst v1.0.2/go.mod h1:bkZbnc/2vh1M12Ecn7EYScpI4YGYU0etwLJICOWi8Z0= -github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= -github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= -github.com/drone/runner-go v1.12.0 h1:zUjDj9ylsJ4n4Mvy4znddq/Z4EBzcUXzTltpzokKtgs= -github.com/drone/runner-go v1.12.0/go.mod h1:vu4pPPYDoeN6vdYQAY01GGGsAIW4aLganJNaa8Fx8zE= -github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M= -github.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA= -github.com/envoyproxy/go-control-plane/envoy v1.32.4 h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A= -github.com/envoyproxy/go-control-plane/envoy v1.32.4/go.mod h1:Gzjc5k8JcJswLjAx1Zm+wSYE20UrLtt7JZMWiWQXQEw= -github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= -github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= -github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= -github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= -github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY= -github.com/go-jose/go-jose/v4 v4.1.0/go.mod h1:GG/vqmYm3Von2nYiB2vGTXzdoNKE5tix5tuc6iAd+sw= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/go-github/v70 v70.0.0 h1:/tqCp5KPrcvqCc7vIvYyFYTiCGrYvaWoYMGHSQbo55o= -github.com/google/go-github/v70 v70.0.0/go.mod h1:xBUZgo8MI3lUL/hwxl3hlceJW1U8MVnXP3zUyI+rhQY= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= -github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= -github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= -github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4= -github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= -github.com/googleapis/gax-go/v2 v2.14.2 h1:eBLnkZ9635krYIPD+ag1USrOAI0Nr0QYF3+/3GqO0k0= -github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= -github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/moby v27.5.1+incompatible h1:/pN59F/t3U7Q4FPzV88nzqf7Fp0qqCSL2KzhZaiKcKw= -github.com/moby/moby v27.5.1+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/natessilva/dag v0.0.0-20180124060714-7194b8dcc5c4/go.mod h1:cojhOHk1gbMeklOyDP2oKKLftefXoJreOQGOrXk+Z38= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= -github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= -github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE= -github.com/spiffe/go-spiffe/v2 v2.5.0/go.mod h1:P+NxobPc6wXhVtINNtFjNWGBTreew1GBUCwT2wPmb7g= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/urfave/cli v1.22.16 h1:MH0k6uJxdwdeWQTwhSO42Pwr4YLrNLwBtg1MRgTqPdQ= -github.com/urfave/cli v1.22.16/go.mod h1:EeJR6BKodywf4zciqrdw6hpCPk68JO9z5LazXZMn5Po= github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/urfave/cli/v3 v3.3.3 h1:byCBaVdIXuLPIDm5CYZRVG6NvT7tv1ECqdU4YzlEa3I= @@ -257,18 +59,8 @@ github.com/vektah/gqlparser/v2 v2.5.27 h1:RHPD3JOplpk5mP5JGX8RKZkt2/Vwj/PZv0HxTd github.com/vektah/gqlparser/v2 v2.5.27/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM= -github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0 h1:F7q2tNlCaHY9nMKHR6XH9/qkp8FktLnIcy6jJNyOCQw= -go.opentelemetry.io/contrib/detectors/gcp v1.36.0/go.mod h1:IbBN8uAIIx734PTonTPxAxnjc2pQTxWNkwfstZ+6H2k= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2 h1:06ZeJRe5BnYXceSM9Vya83XXVaNGe3H1QqsvqRANQq8= @@ -285,8 +77,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 h1:EtFWS go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0/go.mod h1:QjUEoiGCPkvFZ/MjK6ZZfNOS6mfVEVKYE99dFhuN2LI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 h1:bDMKF3RUSxshZ5OjOTi8rsHGaPKsAt76FaqgvIUySLc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0/go.mod h1:dDT67G/IkA46Mr2l9Uj7HsQVwsjASyV9SjGofsiUZDA= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.36.0 h1:rixTyDGXFxRy1xzhKrotaHy3/KXdPhlWARrCgK+eqUY= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.36.0/go.mod h1:dowW6UsM9MKbJq5JTz2AMVp3/5iW5I/TStsk8S+CfHw= go.opentelemetry.io/otel/log v0.12.2 h1:yob9JVHn2ZY24byZeaXpTVoPS6l+UrrxmxmPKohXTwc= go.opentelemetry.io/otel/log v0.12.2/go.mod h1:ShIItIxSYxufUMt+1H5a2wbckGli3/iCfuEbVZi/98E= go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= @@ -303,118 +93,27 @@ go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mx go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os= go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo= -go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY= -go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= -golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.235.0 h1:C3MkpQSRxS1Jy6AkzTGKKrpSCOd2WOGrezZ+icKSkKo= -google.golang.org/api v0.235.0/go.mod h1:QpeJkemzkFKe5VCE/PMv7GsUfn9ZF+u+q1Q7w6ckxTg= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= -google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 h1:oWVWY3NzT7KJppx2UKhKmzPq4SRe0LdCijVRwvGeikY= google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822/go.mod h1:h3c4v36UTKzUiuaOKQ6gr3S+0hovBtUrXzTG/i3+XEc= google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE= google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/build/grafana/variant.go b/pkg/build/grafana/variant.go deleted file mode 100644 index 89654722cf2..00000000000 --- a/pkg/build/grafana/variant.go +++ /dev/null @@ -1 +0,0 @@ -package grafana diff --git a/pkg/build/lerna/lerna.go b/pkg/build/lerna/lerna.go deleted file mode 100644 index 048c0dd374d..00000000000 --- a/pkg/build/lerna/lerna.go +++ /dev/null @@ -1,36 +0,0 @@ -package lerna - -import ( - "context" - "fmt" - "os" - "os/exec" - - "github.com/grafana/grafana/pkg/build/fsutil" -) - -func PackFrontendPackages(ctx context.Context, tag, grafanaDir, artifactsDir string) error { - exists, err := fsutil.Exists(artifactsDir) - if err != nil { - return err - } - if exists { - err = os.RemoveAll(artifactsDir) - if err != nil { - return err - } - } - // nolint:gosec - if err = os.MkdirAll(artifactsDir, 0755); err != nil { - return err - } - - // nolint:gosec - cmd := exec.CommandContext(ctx, "yarn", "lerna", "exec", "--no-private", "--", "yarn", "pack", "--out", fmt.Sprintf("../../npm-artifacts/%%s-%v.tgz", tag)) - cmd.Dir = grafanaDir - if output, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("command '%s' failed to run, output: %s, err: %q", cmd.String(), output, err) - } - - return nil -} diff --git a/pkg/build/metrics/publish.go b/pkg/build/metrics/publish.go deleted file mode 100644 index 4e686eb6dea..00000000000 --- a/pkg/build/metrics/publish.go +++ /dev/null @@ -1,71 +0,0 @@ -package metrics - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "net/http" - "strconv" - "time" -) - -type payload struct { - Name string `json:"name"` - Value int `json:"value"` - Interval int `json:"interval"` - MType string `json:"mtype"` - Time int64 `json:"time"` -} - -// Publish publishes a set of metrics. -func Publish(metrics map[string]string, apiKey string) error { - log.Println("Publishing metrics") - - t := time.Now().Unix() - data := []payload{} - for k, vS := range metrics { - v, err := strconv.Atoi(vS) - if err != nil { - return fmt.Errorf("key %q has value on invalid format: %q", k, vS) - } - data = append(data, payload{ - Name: k, - Value: v, - Interval: 60, - MType: "gauge", - Time: t, - }) - } - - buf := bytes.Buffer{} - enc := json.NewEncoder(&buf) - if err := enc.Encode(data); err != nil { - return err - } - - log.Printf("Publishing metrics to https://:@graphite-us-central1.grafana.net/metrics, JSON: %s", - buf.String()) - - u := fmt.Sprintf("https://6371:%s@graphite-us-central1.grafana.net/metrics", apiKey) - - //nolint:gosec - resp, err := http.Post(u, "application/json", &buf) - if err != nil { - return fmt.Errorf("metrics publishing failed: %w", err) - } - - defer func() { - if err := resp.Body.Close(); err != nil { - log.Println("Error closing HTTP body", err) - } - }() - - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return fmt.Errorf("metrics publishing failed with status code %d", resp.StatusCode) - } - - log.Printf("Metrics successfully published") - - return nil -} diff --git a/pkg/build/npm/npm.go b/pkg/build/npm/npm.go deleted file mode 100644 index 04bcc53b322..00000000000 --- a/pkg/build/npm/npm.go +++ /dev/null @@ -1,239 +0,0 @@ -package npm - -import ( - "context" - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/grafana/grafana/pkg/build/gcloud/storage" - "github.com/grafana/grafana/pkg/build/lerna" - "github.com/grafana/grafana/pkg/build/versions" -) - -const GrafanaDir = "." -const NpmArtifactDir = "./npm-artifacts" - -// TODO: could this be replaced by `yarn lerna list -p` ? -var packages = []string{ - "@grafana/ui", - "@grafana/data", - "@grafana/runtime", - "@grafana/e2e-selectors", - "@grafana/schema", - "@grafana/flamegraph", -} - -// PublishNpmPackages will publish local NPM packages to NPM registry. -func PublishNpmPackages(ctx context.Context, tag string) error { - version, err := versions.GetVersion(tag) - if err != nil { - return err - } - - log.Printf("Grafana version: %s", version.Version) - - if err := setNpmCredentials(); err != nil { - return err - } - - npmArtifacts, err := storage.ListLocalFiles(NpmArtifactDir) - if err != nil { - return err - } - for _, packedFile := range npmArtifacts { - // nolint:gosec - cmd := exec.CommandContext(ctx, "npm", "publish", packedFile.FullPath, "--tag", version.Channel) - cmd.Dir = GrafanaDir - if out, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("command '%s' failed to run, output: %s, err: %q", cmd.String(), out, err) - } - } - - return updateTag(ctx, version, tag) -} - -// StoreNpmPackages will store local NPM packages in GCS bucket `bucketName`. -func StoreNpmPackages(ctx context.Context, tag, bucketName string) error { - err := lerna.PackFrontendPackages(ctx, tag, GrafanaDir, NpmArtifactDir) - if err != nil { - return err - } - - gcs, err := storage.New() - if err != nil { - return err - } - - bucket := gcs.Bucket(bucketName) - bucketPath := fmt.Sprintf("artifacts/npm/%s/", tag) - if err = gcs.CopyLocalDir(ctx, NpmArtifactDir, bucket, bucketPath, true); err != nil { - return err - } - - log.Print("Successfully stored npm packages!") - return nil -} - -// FetchNpmPackages will store NPM packages stored in GCS bucket `bucketName` on local disk in `frontend.NpmArtifactDir`. -func FetchNpmPackages(ctx context.Context, tag, bucketName string) error { - gcs, err := storage.New() - if err != nil { - return err - } - - bucketPath := fmt.Sprintf("artifacts/npm/%s/", tag) - bucket := gcs.Bucket(bucketName) - err = gcs.DownloadDirectory(ctx, bucket, NpmArtifactDir, storage.FilesFilter{ - Prefix: bucketPath, - FileExts: []string{".tgz"}, - }) - if err != nil { - return err - } - return nil -} - -// updateTag will move next or latest npm dist-tags, if needed. -// -// Note: This function makes the assumption that npm dist-tags has already -// been updated and hence why move of dist-tags not always happens: -// -// If stable the dist-tag latest was used. -// If beta the dist-tag next was used. -// -// Scenarios: -// -// 1. Releasing a newer stable than the current stable -// Latest and next is 9.1.5. -// 9.1.6 is released, latest and next should point to 9.1.6. -// The next dist-tag is moved to point to 9.1.6. -// -// 2. Releasing during an active beta period: -// Latest and next is 9.1.6. -// 9.2.0-beta1 is released, the latest should stay on 9.1.6, next should point to 9.2.0-beta1 -// No move of dist-tags -// 9.1.7 is released, the latest should point to 9.1.7, next should stay to 9.2.0-beta1 -// No move of dist-tags -// Next week 9.2.0-beta2 is released, the latest should point to 9.1.7, next should point to 9.2.0-beta2 -// No move of dist-tags -// In two weeks 9.2.0 stable is released, the latest and next should point to 9.2.0. -// The next dist-tag is moved to point to 9.2.0. -// -// 3. Releasing an older stable than the current stable -// Latest and next is 9.2.0. -// Next 9.1.8 is released, latest should point to 9.2.0, next should point to 9.2.0 -// The latest dist-tag is moved to point to 9.2.0. -func updateTag(ctx context.Context, version *versions.Version, releaseVersion string) error { - if version.Channel != versions.Latest { - return nil - } - - latestStableVersion, err := getLatestStableVersion() - if err != nil { - return err - } - - betaVersion, err := getLatestBetaVersion() - if err != nil { - return err - } - - isLatest, err := versions.IsGreaterThanOrEqual(releaseVersion, latestStableVersion) - if err != nil { - return err - } - - isNewerThanLatestBeta, err := versions.IsGreaterThanOrEqual(releaseVersion, betaVersion) - if err != nil { - return err - } - - for _, pkg := range packages { - if !isLatest { - err = runMoveLatestNPMTagCommand(ctx, pkg, latestStableVersion) - if err != nil { - return err - } - } - - if isLatest && isNewerThanLatestBeta { - err = runMoveNextNPMTagCommand(ctx, pkg, version.Version) - if err != nil { - return err - } - } - } - - return nil -} - -func getLatestStableVersion() (string, error) { - return versions.GetLatestVersion(versions.LatestStableVersionURL) -} - -func getLatestBetaVersion() (string, error) { - return versions.GetLatestVersion(versions.LatestBetaVersionURL) -} - -func runMoveNextNPMTagCommand(ctx context.Context, pkg string, packageVersion string) error { - // nolint:gosec - cmd := exec.CommandContext(ctx, "npm", "dist-tag", "add", fmt.Sprintf("%s@%s", pkg, packageVersion), "next") - if out, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("command '%s' failed to run, output: %s, err: %q", cmd.String(), out, err) - } - - return nil -} - -func runMoveLatestNPMTagCommand(ctx context.Context, pkg string, latestStableVersion string) error { - // nolint:gosec - cmd := exec.CommandContext(ctx, "npm", "dist-tag", "add", fmt.Sprintf("%s@%s", pkg, latestStableVersion), "latest") - if out, err := cmd.CombinedOutput(); err != nil { - return fmt.Errorf("command '%s' failed to run, output: %s, err: %q", cmd.String(), out, err) - } - - return nil -} - -// setNpmCredentials Creates a .npmrc file in the users home folder and writes the -// necessary credentials to it for publishing packages to the NPM registry. -func setNpmCredentials() error { - npmToken := strings.TrimSpace(os.Getenv("NPM_TOKEN")) - if npmToken == "" { - return fmt.Errorf("npm token is not set") - } - - homeDir, err := os.UserHomeDir() - if err != nil { - return fmt.Errorf("failed to obtain home directory, err: %q", err) - } - - npmPath := filepath.Join(homeDir, ".npmrc") - registry := []byte(fmt.Sprintf("//registry.npmjs.org/:_authToken=%s", npmToken)) - if _, err = os.Stat(npmPath); os.IsNotExist(err) { - // nolint:gosec - f, err := os.Create(npmPath) - if err != nil { - return fmt.Errorf("couldn't create npmrc file, err: %q", err) - } - _, err = f.Write(registry) - if err != nil { - return fmt.Errorf("failed to write to file, err: %q", err) - } - defer func() { - if err := f.Close(); err != nil { - log.Printf("Failed to close file: %s", err.Error()) - } - }() - } else { - err = os.WriteFile(npmPath, registry, 0644) - if err != nil { - return fmt.Errorf("error writing to file, err: %q", err) - } - } - return nil -} diff --git a/pkg/build/packaging/artifacts.go b/pkg/build/packaging/artifacts.go deleted file mode 100644 index b1740b68c5f..00000000000 --- a/pkg/build/packaging/artifacts.go +++ /dev/null @@ -1,136 +0,0 @@ -package packaging - -import ( - "github.com/grafana/grafana/pkg/build/config" -) - -const ReleaseFolder = "release" -const MainFolder = "main" -const EnterpriseSfx = "-enterprise" -const CacheSettings = "Cache-Control:public, max-age=" - -type BuildArtifact struct { - // Distro can be "windows", "darwin", "deb", "rhel", or "linux" - Distro string - Arch string - // Ext is the file extension without the "." - Ext string - Musl bool - RaspberryPi bool - - // URL can be set optionally by another process - // Note: check other repos before determining this to be dead code - URL string -} - -type PublishConfig struct { - config.Config - - Edition config.Edition - ReleaseMode config.ReleaseMode - GrafanaAPIKey string - WhatsNewURL string - ReleaseNotesURL string - DryRun bool - TTL string - SimulateRelease bool -} - -var LinuxArtifacts = []BuildArtifact{ - { - Distro: "linux", - Arch: "arm64", - Ext: "tar.gz", - }, - { - Distro: "deb", - Arch: "amd64", - Ext: "deb", - }, - { - Distro: "rhel", - Arch: "x86_64", - Ext: "rpm", - }, - { - Distro: "linux", - Arch: "amd64", - Ext: "tar.gz", - }, -} - -var DarwinArtifacts = []BuildArtifact{ - { - Distro: "darwin", - Arch: "amd64", - Ext: "tar.gz", - }, -} - -var WindowsArtifacts = []BuildArtifact{ - { - Distro: "windows", - Arch: "amd64", - Ext: "zip", - }, - { - Distro: "windows", - Arch: "amd64", - Ext: "msi", - }, -} - -var ARMArtifacts = []BuildArtifact{ - { - Distro: "deb", - Arch: "arm64", - Ext: "deb", - }, - { - Distro: "rhel", - Arch: "aarch64", - Ext: "rpm", - }, - { - Distro: "deb", - Arch: "armhf", - Ext: "deb", - RaspberryPi: false, - }, - { - Distro: "deb", - Arch: "armhf", - RaspberryPi: true, - Ext: "deb", - }, - { - Distro: "linux", - Arch: "armv6", - Ext: "tar.gz", - }, - { - Distro: "linux", - Arch: "armv7", - Ext: "tar.gz", - }, - { - Distro: "linux", - Arch: "arm64", - Ext: "tar.gz", - }, - { - Distro: "linux", - Arch: "amd64", - Ext: "tar.gz", - }, -} - -func join(a []BuildArtifact, b ...[]BuildArtifact) []BuildArtifact { - for i := range b { - a = append(a, b[i]...) - } - - return a -} - -var ArtifactConfigs = join(LinuxArtifacts, DarwinArtifacts, WindowsArtifacts, ARMArtifacts) diff --git a/pkg/build/validation/docs.go b/pkg/build/validation/docs.go deleted file mode 100644 index 8cd6793833a..00000000000 --- a/pkg/build/validation/docs.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package validation provides functions and types for validating Grafana releases in both the pre-release and post-release phases. -package validation diff --git a/pkg/build/validation/validation.go b/pkg/build/validation/validation.go deleted file mode 100644 index bc01ed189b7..00000000000 --- a/pkg/build/validation/validation.go +++ /dev/null @@ -1,13 +0,0 @@ -package validation - -type ArtifactType int - -const ( - ArtifactTypeDockerHub ArtifactType = iota - ArtifactTypeGCSObject -) - -type Artifact struct { - Type ArtifactType - URL string -} diff --git a/pkg/build/versions/parse.go b/pkg/build/versions/parse.go deleted file mode 100644 index cf53f6230d4..00000000000 --- a/pkg/build/versions/parse.go +++ /dev/null @@ -1,35 +0,0 @@ -package versions - -import ( - "regexp" - "strings" -) - -var semverRegex = regexp.MustCompile(`^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) - -type Semver struct { - Major string - Minor string - Patch string - Prerelease string - BuildMetadata string -} - -func ParseSemver(version string) Semver { - version = strings.TrimPrefix(version, "v") - matches := semverRegex.FindStringSubmatch(version) - results := make(map[string]string) - for i, name := range semverRegex.SubexpNames() { - if i != 0 && name != "" { - results[name] = matches[i] - } - } - - return Semver{ - Major: results["major"], - Minor: results["minor"], - Patch: results["patch"], - Prerelease: results["prerelease"], - BuildMetadata: results["buildmetadata"], - } -} diff --git a/pkg/build/versions/version.go b/pkg/build/versions/version.go deleted file mode 100644 index 240c750bf68..00000000000 --- a/pkg/build/versions/version.go +++ /dev/null @@ -1,167 +0,0 @@ -package versions - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "regexp" - "strconv" - - "github.com/Masterminds/semver/v3" -) - -var ( - reGrafanaTag = regexp.MustCompile(`^v(\d+\.\d+\.\d+$)`) - reGrafanaTagPreview = regexp.MustCompile(`^v(\d+\.\d+\.\d+-preview)`) - reGrafanaTagCustom = regexp.MustCompile(`^v(\d+\.\d+\.\d+-\w+)`) - reGrafanaTagSecurity = regexp.MustCompile(`^v(\d+\.\d+\.\d+\+\w+\-\d+)`) -) - -const ( - Latest = "latest" - Next = "next" - Test = "test" - Security = "security" -) - -type Version struct { - Version string - Channel string -} - -type VersionFromAPI struct { - Version string `json:"version"` -} - -type LatestGcomAPI = string - -const ( - LatestStableVersionURL LatestGcomAPI = "https://grafana.com/api/grafana/versions/stable" - LatestBetaVersionURL LatestGcomAPI = "https://grafana.com/api/grafana/versions/beta" -) - -func GetLatestVersion(url LatestGcomAPI) (string, error) { - // nolint:gosec - resp, err := http.Get(url) - if err != nil { - return "", err - } - defer func() { - if err := resp.Body.Close(); err != nil { - log.Printf("Failed to close body: %s", err.Error()) - } - }() - - if resp.StatusCode != http.StatusOK { - return "", fmt.Errorf("server returned non 200 status code: %d", resp.StatusCode) - } - - body, err := io.ReadAll(resp.Body) - if err != nil { - return "", err - } - - var apiResponse VersionFromAPI - err = json.Unmarshal(body, &apiResponse) - if err != nil { - return "", err - } - - return apiResponse.Version, nil -} - -// IsGreaterThanOrEqual semantically checks whether newVersion is greater than or equal to stableVersion. -func IsGreaterThanOrEqual(newVersion, stableVersion string) (bool, error) { - v1SemVer, err := semver.NewVersion(newVersion) - if err != nil { - return isGreaterThanOrEqualFourDigit(newVersion, stableVersion) - } - - v2SemVer, err := semver.NewVersion(stableVersion) - if err != nil { - return isGreaterThanOrEqualFourDigit(newVersion, stableVersion) - } - - comp := v1SemVer.Compare(v2SemVer) - switch comp { - case -1: - return false, nil - case 1, 0: - return true, nil - default: - return true, fmt.Errorf("unknown comparison value between scemantic versions, err: %q", err) - } -} - -var fourDigitRe = regexp.MustCompile(`(\d+\.\d+\.\d+)\.(\d+)`) - -func parseFourDigit(version string) (*semver.Version, int, error) { - matches := fourDigitRe.FindStringSubmatch(version) - if len(matches) < 2 { - semVer, err := semver.NewVersion(version) - if err != nil { - return nil, 0, err - } - return semVer, 0, nil - } - semVer, err := semver.NewVersion(matches[1]) - if err != nil { - return nil, 0, err - } - i, err := strconv.Atoi(matches[2]) - if err != nil { - return nil, 0, err - } - - return semVer, i, nil -} - -func isGreaterThanOrEqualFourDigit(newVersion, stableVersion string) (bool, error) { - newVersionSemVer, newVersionSemVerNo, err := parseFourDigit(newVersion) - if err != nil { - return false, err - } - - stableVersionSemVer, stableVersionSemVerNo, err := parseFourDigit(stableVersion) - if err != nil { - return false, err - } - - if stableVersionSemVer.Original() != newVersionSemVer.Original() { - return IsGreaterThanOrEqual(newVersionSemVer.Original(), stableVersionSemVer.Original()) - } - - return newVersionSemVerNo >= stableVersionSemVerNo, nil -} - -func GetVersion(tag string) (*Version, error) { - var version Version - switch { - case reGrafanaTag.MatchString(tag): - version = Version{ - Version: reGrafanaTag.FindStringSubmatch(tag)[1], - Channel: Latest, - } - case reGrafanaTagPreview.MatchString(tag): - version = Version{ - Version: reGrafanaTagPreview.FindStringSubmatch(tag)[1], - Channel: Next, - } - case reGrafanaTagCustom.MatchString(tag): - version = Version{ - Version: reGrafanaTagCustom.FindStringSubmatch(tag)[1], - Channel: Test, - } - case reGrafanaTagSecurity.MatchString(tag): - version = Version{ - Version: reGrafanaTagSecurity.FindStringSubmatch(tag)[1], - Channel: Security, - } - default: - return nil, fmt.Errorf("%s not a supported Grafana version, exitting", tag) - } - - return &version, nil -} diff --git a/pkg/build/versions/version_test.go b/pkg/build/versions/version_test.go deleted file mode 100644 index 2ff950e5008..00000000000 --- a/pkg/build/versions/version_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package versions - -import ( - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestIsGreaterThanOrEqual(t *testing.T) { - testCases := []struct { - newVersion string - stableVersion string - expected bool - }{ - {newVersion: "9.0.0", stableVersion: "8.0.0", expected: true}, - {newVersion: "6.0.0", stableVersion: "6.0.0", expected: true}, - {newVersion: "7.0.0", stableVersion: "8.0.0", expected: false}, - {newVersion: "8.5.0-preview1", stableVersion: "8.0.0", expected: true}, - {newVersion: "8.5.0", stableVersion: "8.5.0-preview1", expected: true}, - {newVersion: "9.0.0.1", stableVersion: "9.0.0", expected: true}, - {newVersion: "9.0.0.2", stableVersion: "9.0.0.1", expected: true}, - {newVersion: "9.1.0", stableVersion: "9.0.0.1", expected: true}, - {newVersion: "9.1-0-preview1", stableVersion: "9.0.0.1", expected: true}, - {newVersion: "9.0.0.1", stableVersion: "9.0.1.1", expected: false}, - {newVersion: "9.0.1.1", stableVersion: "9.0.0.1", expected: true}, - {newVersion: "9.0.0.1", stableVersion: "9.0.0.1", expected: true}, - {newVersion: "7.0.0.1", stableVersion: "8.0.0", expected: false}, - {newVersion: "9.1-0-preview1", stableVersion: "9.1-0-preview2", expected: false}, - {newVersion: "9.1-0-preview3", stableVersion: "9.1-0-preview2", expected: true}, - } - - for _, tc := range testCases { - name := fmt.Sprintf("newVersion %s greater than or equal stableVersion %s = %v", tc.newVersion, tc.stableVersion, tc.expected) - t.Run(name, func(t *testing.T) { - result, err := IsGreaterThanOrEqual(tc.newVersion, tc.stableVersion) - require.NoError(t, err) - require.Equal(t, tc.expected, result) - }) - } -} - -func TestGetLatestVersion(t *testing.T) { - t.Run("it returns a version", func(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - response := VersionFromAPI{ - Version: "8.4.0", - } - jsonRes, err := json.Marshal(&response) - require.NoError(t, err) - _, err = w.Write(jsonRes) - require.NoError(t, err) - })) - version, err := GetLatestVersion(server.URL) - require.NoError(t, err) - require.Equal(t, "8.4.0", version) - }) - - t.Run("it handles non 200 responses", func(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - w.WriteHeader(http.StatusInternalServerError) - })) - _, err := GetLatestVersion(server.URL) - require.Error(t, err) - }) -} diff --git a/pkg/build/wire/go.mod b/pkg/build/wire/go.mod index a26d501eb78..1dbb83c5b34 100644 --- a/pkg/build/wire/go.mod +++ b/pkg/build/wire/go.mod @@ -6,10 +6,10 @@ require ( github.com/google/go-cmp v0.7.0 github.com/google/subcommands v1.2.0 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 - golang.org/x/tools v0.35.0 + golang.org/x/tools v0.36.0 ) require ( - golang.org/x/mod v0.26.0 // indirect + golang.org/x/mod v0.27.0 // indirect golang.org/x/sync v0.16.0 // indirect ) diff --git a/pkg/build/wire/go.sum b/pkg/build/wire/go.sum index fb5c52b3f8c..54bfd049a5f 100644 --- a/pkg/build/wire/go.sum +++ b/pkg/build/wire/go.sum @@ -4,9 +4,9 @@ github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= diff --git a/pkg/codegen/go.mod b/pkg/codegen/go.mod index c215182743a..55a4d6ee4da 100644 --- a/pkg/codegen/go.mod +++ b/pkg/codegen/go.mod @@ -9,7 +9,7 @@ require ( github.com/grafana/cog v0.0.37 github.com/grafana/cuetsy v0.1.11 github.com/matryer/is v1.4.1 - golang.org/x/tools v0.35.0 + golang.org/x/tools v0.36.0 ) require ( @@ -46,10 +46,10 @@ require ( github.com/ugorji/go/codec v1.2.11 // indirect github.com/xlab/treeprint v1.2.0 // indirect github.com/yalue/merged_fs v1.3.0 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/text v0.28.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/codegen/go.sum b/pkg/codegen/go.sum index 8ee24b96514..9afab1f859e 100644 --- a/pkg/codegen/go.sum +++ b/pkg/codegen/go.sum @@ -98,16 +98,16 @@ github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= github.com/yalue/merged_fs v1.3.0 h1:qCeh9tMPNy/i8cwDsQTJ5bLr6IRxbs6meakNE5O+wyY= github.com/yalue/merged_fs v1.3.0/go.mod h1:WqqchfVYQyclV2tnR7wtRhBddzBvLVR83Cjw9BKQw0M= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/plugins/codegen/go.mod b/pkg/plugins/codegen/go.mod index 088304f6522..2aa1c140a0b 100644 --- a/pkg/plugins/codegen/go.mod +++ b/pkg/plugins/codegen/go.mod @@ -42,11 +42,11 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/xlab/treeprint v1.2.0 // indirect github.com/yalue/merged_fs v1.3.0 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/text v0.27.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + golang.org/x/tools v0.36.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/plugins/codegen/go.sum b/pkg/plugins/codegen/go.sum index 709efab9dd3..cd78ae32b2d 100644 --- a/pkg/plugins/codegen/go.sum +++ b/pkg/plugins/codegen/go.sum @@ -92,20 +92,20 @@ github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= github.com/yalue/merged_fs v1.3.0 h1:qCeh9tMPNy/i8cwDsQTJ5bLr6IRxbs6meakNE5O+wyY= github.com/yalue/merged_fs v1.3.0/go.mod h1:WqqchfVYQyclV2tnR7wtRhBddzBvLVR83Cjw9BKQw0M= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/pkg/promlib/go.mod b/pkg/promlib/go.mod index ac034b92ba2..6e294ad34ae 100644 --- a/pkg/promlib/go.mod +++ b/pkg/promlib/go.mod @@ -118,12 +118,12 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/text v0.27.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect google.golang.org/api v0.235.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect diff --git a/pkg/promlib/go.sum b/pkg/promlib/go.sum index cfdc045debc..a478d60c720 100644 --- a/pkg/promlib/go.sum +++ b/pkg/promlib/go.sum @@ -353,21 +353,21 @@ go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -386,12 +386,12 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -399,8 +399,8 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/services/store/testdata/public_testdata.golden.jsonc b/pkg/services/store/testdata/public_testdata.golden.jsonc index d18191f2d39..a37239596c2 100644 --- a/pkg/services/store/testdata/public_testdata.golden.jsonc +++ b/pkg/services/store/testdata/public_testdata.golden.jsonc @@ -1,5 +1,5 @@ // 🌟 This was machine generated. Do not edit. 🌟 -// +// // Frame[0] { // "type": "directory-listing", // "typeVersion": [ @@ -10,7 +10,7 @@ // "HasMore": false // } // } -// Name: +// Name: // Dimensions: 3 Fields by 3 Rows // +----------------------------+----------------------+---------------+ // | Name: name | Name: mediaType | Name: size | @@ -21,8 +21,8 @@ // | example-with-style.geojson | application/geo+json | 3332 | // | usa-states.geojson | application/geo+json | 89263 | // +----------------------------+----------------------+---------------+ -// -// +// +// // 🌟 This was machine generated. Do not edit. 🌟 { "status": 200, @@ -87,4 +87,4 @@ } } ] -} +} \ No newline at end of file diff --git a/scripts/drone/dagger.star b/scripts/drone/dagger.star deleted file mode 100644 index 3f02f7282bb..00000000000 --- a/scripts/drone/dagger.star +++ /dev/null @@ -1,9 +0,0 @@ -""" -Utilities / functions for working with dagger pipelines -""" - -def with_dagger_install(commands = [], dagger_version = ""): - return [ - "wget -qO- https://github.com/dagger/dagger/releases/download/{}/dagger_{}_linux_amd64.tar.gz | tar zx -C /bin".format(dagger_version, dagger_version), - "apk add docker", - ] + commands diff --git a/scripts/drone/env-var-check.sh b/scripts/drone/env-var-check.sh deleted file mode 100755 index adfbe88f4ce..00000000000 --- a/scripts/drone/env-var-check.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# ensure DRONE_SERVER and DRONE_TOKEN env variables are set -if [ -z "$DRONE_SERVER" ]; then - echo "DRONE_SERVER environment variable is not set." - exit 1 -fi - -if [ -z "$DRONE_TOKEN" ]; then - echo "DRONE_TOKEN environment variable is not set." - exit 1 -fi \ No newline at end of file diff --git a/scripts/drone/events/cron.star b/scripts/drone/events/cron.star deleted file mode 100644 index 6f9e524139b..00000000000 --- a/scripts/drone/events/cron.star +++ /dev/null @@ -1,179 +0,0 @@ -""" -This module provides functions for cronjob pipelines and steps used within. -""" - -load( - "scripts/drone/utils/images.star", - "images", -) -load("scripts/drone/vault.star", "from_secret") - -aquasec_trivy_image = "aquasec/trivy:0.21.0" - -def cronjobs(): - return [ - scan_docker_image_pipeline("latest"), - scan_docker_image_pipeline("main"), - scan_docker_image_pipeline("latest-ubuntu"), - scan_docker_image_pipeline("main-ubuntu"), - scan_build_test_publish_docker_image_pipeline(), - ] - -def authenticate_gcr_step(): - return { - "name": "authenticate-gcr", - "image": "docker:dind", - "commands": ["echo $${GCR_CREDENTIALS} | docker login -u _json_key --password-stdin https://us.gcr.io"], - "environment": { - "GCR_CREDENTIALS": from_secret("gcr_credentials"), - }, - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}, {"name": "config", "path": "/root/.docker/"}], - } - -def cron_job_pipeline(cronName, name, steps): - return { - "kind": "pipeline", - "type": "docker", - "platform": { - "os": "linux", - "arch": "amd64", - }, - "name": name, - "trigger": { - "event": "cron", - "cron": cronName, - }, - "clone": { - "retries": 3, - }, - "steps": steps, - "volumes": [ - { - "name": "docker", - "host": { - "path": "/var/run/docker.sock", - }, - }, - { - "name": "config", - "temp": {}, - }, - ], - } - -def scan_docker_image_pipeline(tag): - """Generates a cronjob pipeline for nightly scans of grafana Docker images. - - Args: - tag: determines which image tag is scanned. - - Returns: - Drone cronjob pipeline. - """ - docker_image = "grafana/grafana:{}".format(tag) - - return cron_job_pipeline( - cronName = "nightly", - name = "scan-" + docker_image + "-image", - steps = [ - authenticate_gcr_step(), - scan_docker_image_unknown_low_medium_vulnerabilities_step(docker_image), - scan_docker_image_high_critical_vulnerabilities_step(docker_image), - slack_job_failed_step("grafana-backend-ops", docker_image), - ], - ) - -def scan_build_test_publish_docker_image_pipeline(): - """Generates a cronjob pipeline for nightly scans of grafana Docker images. - - Returns: - Drone cronjob pipeline. - """ - - return cron_job_pipeline( - cronName = "nightly", - name = "scan-build-test-and-publish-docker-images", - steps = [ - authenticate_gcr_step(), - scan_docker_image_unknown_low_medium_vulnerabilities_step("all"), - scan_docker_image_high_critical_vulnerabilities_step("all"), - slack_job_failed_step("grafana-backend-ops", "build-images"), - ], - ) - -def scan_docker_image_unknown_low_medium_vulnerabilities_step(docker_image): - """Generates a step for scans of Grafana Docker images. - - Args: - docker_image: determines which image is scanned. - - Returns: - Drone cronjob step . - """ - - cmds = [] - if docker_image == "all": - for key in images: - cmds = cmds + ["trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM " + images[key]] - else: - cmds = ["trivy image --exit-code 0 --severity UNKNOWN,LOW,MEDIUM " + docker_image] - return { - "name": "scan-unknown-low-medium-vulnerabilities", - "image": aquasec_trivy_image, - "commands": cmds, - "depends_on": ["authenticate-gcr"], - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}, {"name": "config", "path": "/root/.docker/"}], - } - -def scan_docker_image_high_critical_vulnerabilities_step(docker_image): - """Generates a step for scans of Grafana Docker images. - - Args: - docker_image: determines which image is scanned. - - Returns: - Drone cronjob step . - """ - - cmds = [] - if docker_image == "all": - for key in images: - cmds = cmds + ["trivy --exit-code 1 --severity HIGH,CRITICAL " + images[key]] - else: - cmds = ["trivy image --exit-code 1 --severity HIGH,CRITICAL " + docker_image] - return { - "name": "scan-high-critical-vulnerabilities", - "image": aquasec_trivy_image, - "commands": cmds, - "depends_on": ["authenticate-gcr"], - "environment": { - "GOOGLE_APPLICATION_CREDENTIALS": from_secret("gcr_credentials_json"), - }, - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}, {"name": "config", "path": "/root/.docker/"}], - } - -def slack_job_failed_step(channel, image): - return { - "name": "slack-notify-failure", - "image": images["plugins_slack"], - "settings": { - "webhook": from_secret("slack_webhook_backend"), - "channel": channel, - "template": "Nightly docker image scan job for " + - image + - " failed: {{build.link}}", - }, - "when": {"status": "failure"}, - } - -def post_to_grafana_com_step(): - return { - "name": "post-to-grafana-com", - "image": images["publish"], - "environment": { - "GRAFANA_COM_API_KEY": from_secret("grafana_api_key"), - "GCP_KEY": from_secret("gcp_key"), - }, - "depends_on": ["compile-build-cmd"], - "commands": ["./bin/build publish grafana-com --edition oss"], - } diff --git a/scripts/drone/events/main.star b/scripts/drone/events/main.star deleted file mode 100644 index 35f60141760..00000000000 --- a/scripts/drone/events/main.star +++ /dev/null @@ -1,61 +0,0 @@ -""" -This module returns all the pipelines used in the event of pushes to the main branch. -""" - -load( - "scripts/drone/pipelines/build.star", - "build_e2e", -) -load( - "scripts/drone/pipelines/docs.star", - "docs_pipelines", - "trigger_docs_main", -) -load( - "scripts/drone/pipelines/trigger_downstream.star", - "enterprise_downstream_pipeline", -) -load( - "scripts/drone/utils/utils.star", - "failure_template", - "notify_pipeline", -) - -ver_mode = "main" -trigger = { - "event": [ - "push", - ], - "branch": "main", - "paths": { - "exclude": [ - "*.md", - "docs/**", - "latest.json", - ], - }, - "repo": [ - "grafana/grafana", - ], -} - -def main_pipelines(): - # This is how we should define any new pipelines. At some point we should update existing ones. - # Let's make an effort to reduce the amount of string constants in "depends_on" lists. - pipelines = [ - docs_pipelines(ver_mode, trigger_docs_main()), - build_e2e(trigger, ver_mode), - enterprise_downstream_pipeline(), - notify_pipeline( - name = "main-notify", - slack_channel = "grafana-ci-notifications", - trigger = dict(trigger, status = ["failure"]), - depends_on = [ - "main-build-e2e-publish", - ], - template = failure_template, - secret = "slack_webhook", - ), - ] - - return pipelines diff --git a/scripts/drone/events/pr.star b/scripts/drone/events/pr.star deleted file mode 100644 index 29a456329cb..00000000000 --- a/scripts/drone/events/pr.star +++ /dev/null @@ -1,87 +0,0 @@ -""" -This module returns all pipelines used in the event of a pull request. -It also includes a function generating a PR trigger from a list of included and excluded paths. -""" - -load( - "scripts/drone/pipelines/build.star", - "build_e2e", -) -load( - "scripts/drone/pipelines/docs.star", - "docs_pipelines", - "trigger_docs_pr", -) -load( - "scripts/drone/pipelines/verify_drone.star", - "verify_drone", -) -load( - "scripts/drone/pipelines/verify_starlark.star", - "verify_starlark", -) - -ver_mode = "pr" -trigger = { - "event": [ - "pull_request", - ], - "paths": { - "exclude": [ - "*.md", - "docs/**", - "latest.json", - ], - }, -} - -def pr_pipelines(): - return [ - verify_drone( - get_pr_trigger( - include_paths = ["scripts/drone/**", ".drone.yml", ".drone.star"], - ), - ver_mode, - ), - verify_starlark( - get_pr_trigger( - include_paths = ["scripts/drone/**", ".drone.star"], - ), - ver_mode, - ), - build_e2e(trigger, ver_mode), - docs_pipelines(ver_mode, trigger_docs_pr()), - ] - -def get_pr_trigger(include_paths = None, exclude_paths = None): - """Generates a trigger filter from the lists of included and excluded path patterns. - - This function is primarily intended to generate a trigger for code changes - as the patterns 'docs/**' and '*.md' are always excluded. - - Args: - include_paths: a list of path patterns using the same syntax as gitignore. - Changes affecting files matching these path patterns trigger the pipeline. - exclude_paths: a list of path patterns using the same syntax as gitignore. - Changes affecting files matching these path patterns do not trigger the pipeline. - - Returns: - Drone trigger. - """ - paths_ex = ["docs/**", "*.md"] - paths_in = [] - if include_paths: - for path in include_paths: - paths_in.extend([path]) - if exclude_paths: - for path in exclude_paths: - paths_ex.extend([path]) - return { - "event": [ - "pull_request", - ], - "paths": { - "exclude": paths_ex, - "include": paths_in, - }, - } diff --git a/scripts/drone/events/release.star b/scripts/drone/events/release.star deleted file mode 100644 index d71f01f3581..00000000000 --- a/scripts/drone/events/release.star +++ /dev/null @@ -1,279 +0,0 @@ -""" -This module returns all the pipelines used in the event of a release along with supporting functions. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", - "github_app_step_volumes", -) -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "publish_grafanacom_step", - "publish_linux_packages_step", - "verify_grafanacom_step", - "yarn_install_step", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) -load( - "scripts/drone/vault.star", - "from_secret", - "gcp_grafanauploads_base64", - "npm_token", - "prerelease_bucket", - "rgm_gcp_key_base64", -) - -ver_mode = "release" -semver_regex = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" - -def retrieve_npm_packages_step(): - return { - "name": "retrieve-npm-packages", - "image": images["publish"], - "depends_on": [ - "compile-build-cmd", - "yarn-install", - ], - "failure": "ignore", - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads_base64), - "PRERELEASE_BUCKET": from_secret(prerelease_bucket), - }, - "commands": ["./bin/build artifacts npm retrieve --tag ${DRONE_TAG}"], - } - -def release_pr_step(depends_on = []): - return { - "name": "create-release-pr", - "image": images["curl"], - "depends_on": depends_on, - "environment": { - "GH_CLI_URL": "https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_linux_amd64.tar.gz", - }, - "commands": [ - "export GITHUB_TOKEN=$(cat /github-app/token)", - "apk add perl", - "v_target=`echo $${{TAG}} | perl -pe 's/{}/v\\1.\\2.x/'`".format(semver_regex), - # Install gh CLI - "curl -L $${GH_CLI_URL} | tar -xz --strip-components=1 -C /usr", - # Run the release-pr workflow - "gh workflow run " + - "-f dry_run=$${DRY_RUN} " + - "-f version=$${TAG} " + - # If the submitter has set a target branch, then use that, otherwise use the default - "-f target=$${v_target} " + - "-f latest=$${LATEST} " + - "--repo=grafana/grafana release-pr.yml", - ], - "volumes": github_app_step_volumes(), - } - -def release_npm_packages_step(): - return { - "name": "release-npm-packages", - "image": images["node"], - "depends_on": [ - "compile-build-cmd", - "retrieve-npm-packages", - ], - "failure": "ignore", - "environment": { - "NPM_TOKEN": from_secret(npm_token), - }, - "commands": ["./bin/build artifacts npm release --tag ${DRONE_TAG}"], - } - -def publish_artifacts_step(): - return { - "name": "publish-artifacts", - "image": images["publish"], - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads_base64), - "PRERELEASE_BUCKET": from_secret("prerelease_bucket"), - }, - "commands": [ - "./bin/build artifacts packages --artifacts-editions=oss --tag $${DRONE_TAG} --src-bucket $${PRERELEASE_BUCKET}", - ], - "depends_on": ["compile-build-cmd"], - } - -def publish_storybook_step(): - return { - "name": "publish-storybook", - "image": images["publish"], - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads_base64), - "PRERELEASE_BUCKET": from_secret("prerelease_bucket"), - }, - "commands": [ - "./bin/build artifacts storybook --tag ${DRONE_TAG}", - ], - "depends_on": ["compile-build-cmd"], - } - -def publish_artifacts_pipelines(mode): - """Published artifacts after they've been stored and tested in prerelease buckets. - - Args: - mode: public or security. - Defaults to ''. - - Returns: - List of Drone pipelines. - """ - trigger = { - "event": ["promote"], - "target": [mode], - } - steps = [ - compile_build_cmd(), - publish_artifacts_step(), - publish_storybook_step(), - github_app_generate_token_step(), - release_pr_step(depends_on = ["publish-artifacts", github_app_generate_token_step()["name"]]), - ] - - return [ - pipeline( - name = "create-release-pr", - trigger = { - "event": ["promote"], - "target": "release-pr", - }, - steps = [ - release_pr_step(), - ], - volumes = github_app_pipeline_volumes(), - ), - pipeline( - name = "publish-artifacts-{}".format(mode), - trigger = trigger, - steps = steps, - environment = {"EDITION": "oss"}, - volumes = github_app_pipeline_volumes(), - ), - ] - -def publish_packages_pipeline(): - """Generates pipelines used for publishing packages for OSS. - - Returns: - List of Drone pipelines. One for each of OSS and enterprise packages. - """ - - trigger = { - "event": ["promote"], - "target": ["public"], - } - oss_steps = [ - compile_build_cmd(), - publish_linux_packages_step(package_manager = "deb"), - publish_linux_packages_step(package_manager = "rpm"), - publish_grafanacom_step(ver_mode = "release"), - verify_grafanacom_step(), - ] - - deps = [ - "publish-artifacts-public", - "publish-docker-public", - ] - - return [ - pipeline( - name = "verify-grafanacom-artifacts", - trigger = { - "event": ["promote"], - "target": "verify-grafanacom-artifacts", - }, - steps = [ - verify_grafanacom_step(depends_on = []), - ], - ), - pipeline( - name = "publish-packages", - trigger = trigger, - steps = oss_steps, - depends_on = deps, - environment = {"EDITION": "oss"}, - ), - pipeline( - name = "publish-grafanacom", - trigger = { - "event": ["promote"], - "target": "publish-grafanacom", - }, - steps = [ - compile_build_cmd(), - publish_grafanacom_step(ver_mode = "release", depends_on = ["compile-build-cmd"]), - ], - ), - ] - -def publish_npm_pipelines(): - trigger = { - "event": ["promote"], - "target": ["public"], - } - steps = [ - compile_build_cmd(), - yarn_install_step(), - retrieve_npm_packages_step(), - release_npm_packages_step(), - ] - - return [ - pipeline( - name = "publish-npm-packages-public", - trigger = trigger, - steps = steps, - environment = {"EDITION": "oss"}, - ), - ] - -def verify_release_pipeline( - name = "verify-prerelease-assets", - bucket = from_secret(prerelease_bucket), - gcp_key = from_secret(rgm_gcp_key_base64), - version = "${DRONE_TAG}", - trigger = {}, - depends_on = [ - "release-build-e2e-publish", - ]): - """ - Runs a script that 'gsutil stat's every artifact that should have been produced by the pre-release process. - - Returns: - A single Drone pipeline that runs the script. - """ - step = { - "name": "gsutil-stat", - "depends_on": ["clone"], - "image": images["cloudsdk"], - "environment": { - "BUCKET": bucket, - "GCP_KEY": gcp_key, - }, - "commands": [ - "apt-get update && apt-get install -yq gettext", - "printenv GCP_KEY | base64 -d > /tmp/key.json", - "gcloud auth activate-service-account --key-file=/tmp/key.json", - "./scripts/list-release-artifacts.sh {} | xargs -n1 gsutil stat >> /tmp/stat.log".format(version), - "! cat /tmp/stat.log | grep \"No URLs matched\"", - ], - } - return pipeline( - depends_on = depends_on, - name = name, - trigger = trigger, - steps = [step], - ) diff --git a/scripts/drone/events/rrc-patch.star b/scripts/drone/events/rrc-patch.star deleted file mode 100644 index 5b888e5b21c..00000000000 --- a/scripts/drone/events/rrc-patch.star +++ /dev/null @@ -1,47 +0,0 @@ -""" -This module returns all the pipelines used in the event of pushes to an RRC branch. -""" - -load( - "scripts/drone/steps/lib.star", - "enterprise_downstream_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -ver_mode = "rrc" -trigger = { - "ref": { - "include": [ - "refs/tags/rrc*", - ], - }, - "branch": [ - "instant", - "fast", - "steady", - "slow", - ], -} - -def rrc_patch_pipelines(): - pipelines = [ - rrc_enterprise_downstream_pipeline(trigger = trigger), - ] - - return pipelines - -def rrc_enterprise_downstream_pipeline(trigger): - # Triggers a downstream pipeline in the grafana-enterprise repository for the rrc branch - environment = {"EDITION": "oss"} - steps = [ - enterprise_downstream_step(ver_mode = ver_mode), - ] - return pipeline( - name = "rrc-trigger-downstream", - trigger = trigger, - steps = steps, - environment = environment, - ) diff --git a/scripts/drone/pipelines/aws_marketplace.star b/scripts/drone/pipelines/aws_marketplace.star deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/scripts/drone/pipelines/build.star b/scripts/drone/pipelines/build.star deleted file mode 100644 index e08891078ca..00000000000 --- a/scripts/drone/pipelines/build.star +++ /dev/null @@ -1,170 +0,0 @@ -"""This module contains the comprehensive build pipeline.""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "build_frontend_package_step", - "build_storybook_step", - "build_test_plugins_step", - "cloud_plugins_e2e_tests_step", - "compile_build_cmd", - "download_grabpl_step", - "e2e_tests_artifacts", - "enterprise_downstream_step", - "frontend_metrics_step", - "grafana_server_step", - "identify_runner_step", - "playwright_e2e_report_post_link", - "playwright_e2e_report_upload", - "playwright_e2e_tests_step", - "publish_images_step", - "release_canary_npm_packages_step", - "store_storybook_step", - "test_a11y_frontend_step", - "trigger_oss", - "update_package_json_version", - "upload_cdn_step", - "upload_packages_step", - "verify_gen_cue_step", - "verify_gen_jsonnet_step", - "yarn_install_step", -) -load( - "scripts/drone/steps/rgm.star", - "rgm_artifacts_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -# This function isn't actually unused but I don't know why the linter thinks it is... -# @unused -def build_e2e(trigger, ver_mode): - """Perform e2e building, testing, and publishing. - - Args: - trigger: controls which events can trigger the pipeline execution. - ver_mode: used in the naming of the pipeline. Either 'pr' or 'main'. - - Returns: - Drone pipeline. - """ - - environment = {"EDITION": "oss"} - init_steps = [ - github_app_generate_token_step(), - identify_runner_step(), - download_grabpl_step(), - compile_build_cmd(), - verify_gen_cue_step(), - verify_gen_jsonnet_step(), - yarn_install_step(), - ] - - build_steps = [] - - create_packages = rgm_artifacts_step( - artifacts = [ - "targz:grafana:linux/amd64", - "targz:grafana:linux/arm64", - "targz:grafana:linux/arm/v7", - "docker:grafana:linux/amd64", - "docker:grafana:linux/amd64:ubuntu", - "docker:grafana:linux/arm64", - "docker:grafana:linux/arm64:ubuntu", - "docker:grafana:linux/arm/v7", - "docker:grafana:linux/arm/v7:ubuntu", - ], - file = "packages.txt", - tag_format = "{{ .version_base }}-{{ .buildID }}-{{ .arch }}", - ubuntu_tag_format = "{{ .version_base }}-{{ .buildID }}-ubuntu-{{ .arch }}", - ) - - publish_docker = publish_images_step( - depends_on = [create_packages["name"]], - docker_repo = "grafana", - trigger = trigger_oss, - ver_mode = ver_mode, - ) - - if ver_mode == "pr": - build_steps.extend( - [ - build_frontend_package_step(), - enterprise_downstream_step(ver_mode = ver_mode), - ], - ) - else: - # The only other event or "ver_mode" where this is used is 'main' - update_package_json = update_package_json_version() - create_packages["depends_on"] = [update_package_json["name"]] - - build_steps.extend([ - update_package_json, - build_frontend_package_step(depends_on = ["update-package-json-version"]), - ]) - - build_steps.extend( - [ - create_packages, - publish_docker, - build_test_plugins_step(), - grafana_server_step(), - # Note: Main E2E test suites (dashboards, panels, smoke-tests, various) have been migrated to GitHub Actions - # Only keeping tests that are not yet covered by GitHub Actions - cloud_plugins_e2e_tests_step( - "cloud-plugins-suite", - cloud = "azure", - trigger = trigger_oss, - ), - playwright_e2e_tests_step(), - playwright_e2e_report_upload(), - playwright_e2e_report_post_link(), - e2e_tests_artifacts(), # Collects artifacts from remaining E2E tests - build_storybook_step(ver_mode = ver_mode), - test_a11y_frontend_step(ver_mode = ver_mode), - ], - ) - - if ver_mode == "main": - build_steps.extend( - [ - store_storybook_step(trigger = trigger_oss, ver_mode = ver_mode), - frontend_metrics_step(trigger = trigger_oss), - publish_images_step( - depends_on = [create_packages["name"]], - docker_repo = "grafana-oss", - trigger = trigger_oss, - ver_mode = ver_mode, - ), - release_canary_npm_packages_step(trigger = trigger_oss), - upload_packages_step( - depends_on = [create_packages["name"]], - trigger = trigger_oss, - ver_mode = ver_mode, - ), - upload_cdn_step( - depends_on = [create_packages["name"]], - trigger = trigger_oss, - ver_mode = ver_mode, - ), - ], - ) - - publish_suffix = "" - if ver_mode == "main": - publish_suffix = "-publish" - - return pipeline( - name = "{}-build-e2e{}".format(ver_mode, publish_suffix), - environment = environment, - services = [], - steps = init_steps + build_steps, - trigger = trigger, - volumes = github_app_pipeline_volumes(), - ) diff --git a/scripts/drone/pipelines/docs.star b/scripts/drone/pipelines/docs.star deleted file mode 100644 index 7b1f63642bc..00000000000 --- a/scripts/drone/pipelines/docs.star +++ /dev/null @@ -1,84 +0,0 @@ -""" -This module returns all the pipelines used in the event of documentation changes along with supporting functions. -""" - -load( - "scripts/drone/steps/lib.star", - "build_docs_website_step", - "identify_runner_step", - "verify_gen_cue_step", - "yarn_install_step", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -docs_paths = { - "include": [ - "*.md", - "docs/**", - "packages/**/*.md", - "latest.json", - ], -} - -def docs_pipelines(ver_mode, trigger): - environment = {"EDITION": "oss"} - steps = [ - identify_runner_step(), - yarn_install_step(), - lint_docs(), - build_docs_website_step(), - verify_gen_cue_step(), - ] - - return pipeline( - name = "{}-docs".format(ver_mode), - trigger = trigger, - services = [], - steps = steps, - environment = environment, - ) - -def lint_docs(): - return { - "name": "lint-docs", - "image": images["node"], - "depends_on": [ - "yarn-install", - ], - "environment": { - "NODE_OPTIONS": "--max_old_space_size=8192", - }, - "commands": [ - "yarn run prettier:checkDocs", - ], - } - -def trigger_docs_main(): - return { - "branch": "main", - "event": [ - "push", - ], - "repo": [ - "grafana/grafana", - ], - "paths": docs_paths, - } - -def trigger_docs_pr(): - return { - "event": [ - "pull_request", - ], - "repo": [ - "grafana/grafana", - ], - "paths": docs_paths, - } diff --git a/scripts/drone/pipelines/github.star b/scripts/drone/pipelines/github.star deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/scripts/drone/pipelines/publish_images.star b/scripts/drone/pipelines/publish_images.star deleted file mode 100644 index a947d05d0b4..00000000000 --- a/scripts/drone/pipelines/publish_images.star +++ /dev/null @@ -1,130 +0,0 @@ -""" -This module returns the pipeline used for publishing Docker images and its steps. -""" - -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "download_grabpl_step", - "fetch_images_step", - "identify_runner_step", - "publish_images_step", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) -load( - "scripts/drone/vault.star", - "from_secret", -) - -def publish_image_public_step(): - """Returns a step which publishes images - - Returns: - A drone step which publishes Docker images for a public release. - """ - command = """ - bash -c ' - IMAGE_TAG=$(echo "$${TAG}" | sed -e "s/+/-/g") - debug= - if [[ -n $${DRY_RUN} ]]; then debug=echo; fi - docker login -u $${DOCKER_USER} -p $${DOCKER_PASSWORD} - - # Push the grafana-image-tags images - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 - $$debug docker push grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Create the grafana manifests - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG} \ - grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - - $$debug docker manifest create grafana/grafana:$${IMAGE_TAG}-ubuntu \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - # Push the grafana manifests - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG} - $$debug docker manifest push grafana/grafana:$${IMAGE_TAG}-ubuntu - - # if LATEST is set, then also create & push latest - if [[ -n $${LATEST} ]]; then - $$debug docker manifest create grafana/grafana:latest \ - grafana/grafana-image-tags:$${IMAGE_TAG}-amd64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-arm64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-armv7 - $$debug docker manifest create grafana/grafana:latest-ubuntu \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-amd64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-arm64 \ - grafana/grafana-image-tags:$${IMAGE_TAG}-ubuntu-armv7 - - $$debug docker manifest push grafana/grafana:latest - $$debug docker manifest push grafana/grafana:latest-ubuntu - - fi'""" - return { - "environment": { - "DOCKER_USER": from_secret("docker_username"), - "DOCKER_PASSWORD": from_secret("docker_password"), - }, - "name": "publish-images-grafana", - "image": images["docker"], - "depends_on": ["fetch-images"], - "commands": [ - "apk add bash", - command, - ], - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}], - } - -def publish_image_pipelines_public(): - """Generates the pipeline used for publising public Docker images. - - Returns: - Drone pipeline - """ - return [ - pipeline( - name = "publish-docker-public", - trigger = { - "event": ["promote"], - "target": ["public"], - }, - steps = [ - identify_runner_step(), - download_grabpl_step(), - compile_build_cmd(), - fetch_images_step(), - publish_image_public_step(), - publish_images_step("release", "grafana-oss"), - ], - environment = {"EDITION": "oss"}, - ), - pipeline( - name = "manually-publish-docker-public", - trigger = { - "event": ["promote"], - "target": ["publish-docker-public"], - }, - steps = [ - identify_runner_step(), - download_grabpl_step(), - compile_build_cmd(), - fetch_images_step(), - publish_image_public_step(), - ], - environment = {"EDITION": "oss"}, - ), - ] diff --git a/scripts/drone/pipelines/trigger_downstream.star b/scripts/drone/pipelines/trigger_downstream.star deleted file mode 100644 index 698e3af027d..00000000000 --- a/scripts/drone/pipelines/trigger_downstream.star +++ /dev/null @@ -1,46 +0,0 @@ -""" -This module returns the pipeline used for triggering a downstream pipeline for Grafana Enterprise. -""" - -load( - "scripts/drone/steps/lib.star", - "enterprise_downstream_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -trigger = { - "event": [ - "push", - ], - "branch": "main", - "paths": { - "exclude": [ - "*.md", - "docs/**", - "latest.json", - ], - }, - "repo": [ - "grafana/grafana", - ], -} - -def enterprise_downstream_pipeline(): - environment = {"EDITION": "oss"} - steps = [ - enterprise_downstream_step(ver_mode = "main"), - ] - deps = [ - "main-build-e2e-publish", - ] - return pipeline( - name = "main-trigger-downstream", - trigger = trigger, - services = [], - steps = steps, - depends_on = deps, - environment = environment, - ) diff --git a/scripts/drone/pipelines/verify_drone.star b/scripts/drone/pipelines/verify_drone.star deleted file mode 100644 index 366b702bd08..00000000000 --- a/scripts/drone/pipelines/verify_drone.star +++ /dev/null @@ -1,29 +0,0 @@ -""" -This module returns the pipeline used for verifying Drone configuration. -""" - -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "identify_runner_step", - "lint_drone_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def verify_drone(trigger, ver_mode): - environment = {"EDITION": "oss"} - steps = [ - identify_runner_step(), - compile_build_cmd(), - lint_drone_step(), - ] - return pipeline( - name = "{}-verify-drone".format(ver_mode), - trigger = trigger, - services = [], - steps = steps, - environment = environment, - ) diff --git a/scripts/drone/pipelines/verify_starlark.star b/scripts/drone/pipelines/verify_starlark.star deleted file mode 100644 index e939cd598ef..00000000000 --- a/scripts/drone/pipelines/verify_starlark.star +++ /dev/null @@ -1,27 +0,0 @@ -""" -This module returns a Drone pipeline that verifies all Starlark files are linted. -""" - -load( - "scripts/drone/steps/lib.star", - "identify_runner_step", - "lint_starlark_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def verify_starlark(trigger, ver_mode): - environment = {"EDITION": "oss"} - steps = [ - identify_runner_step(), - lint_starlark_step(), - ] - return pipeline( - name = "{}-verify-starlark".format(ver_mode), - trigger = trigger, - services = [], - steps = steps, - environment = environment, - ) diff --git a/scripts/drone/rgm.star b/scripts/drone/rgm.star deleted file mode 100644 index 604df62766e..00000000000 --- a/scripts/drone/rgm.star +++ /dev/null @@ -1,382 +0,0 @@ -""" -'rgm' pipelines are pipelines that use dagger (located in 'pkg/build/daggerbuild') -""" - -load( - "scripts/drone/dagger.star", - "with_dagger_install", -) -load( - "scripts/drone/events/release.star", - "verify_release_pipeline", -) -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", - "github_app_step_volumes", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", - "with_deps", -) -load( - "scripts/drone/variables.star", - "dagger_version", -) -load( - "scripts/drone/vault.star", - "from_secret", - "npm_token", - "rgm_cdn_destination", - "rgm_dagger_token", - "rgm_destination", - "rgm_downloads_destination", - "rgm_gcp_key_base64", - "rgm_storybook_destination", -) - -docs_paths = { - "exclude": [ - "*.md", - "docs/**", - "packages/**/*.md", - "latest.json", - ], -} - -tag_trigger = { - "event": { - "exclude": [ - "promote", - ], - }, - "ref": { - "include": [ - "refs/tags/v*", - ], - "exclude": [ - "refs/tags/*-cloud*", - ], - }, -} - -main_trigger = { - "event": [ - "push", - ], - "branch": "main", - "paths": docs_paths, - "repo": [ - "grafana/grafana", - ], -} - -nightly_trigger = { - "event": { - "include": [ - "cron", - ], - }, - "cron": { - "include": [ - "nightly-release", - ], - }, -} - -version_branch_trigger = {"ref": ["refs/heads/v[0-9]*"]} - -def rgm_env_secrets(env): - """Adds the rgm secret ENV variables to the given env arg - - Args: - env: A map of environment varables. This function will adds the necessary secrets to it (and potentially overwrite them). - Returns: - Drone step. - """ - env["DESTINATION"] = from_secret(rgm_destination) - env["STORYBOOK_DESTINATION"] = from_secret(rgm_storybook_destination) - env["CDN_DESTINATION"] = from_secret(rgm_cdn_destination) - env["DOWNLOADS_DESTINATION"] = from_secret(rgm_downloads_destination) - - env["GCP_KEY_BASE64"] = from_secret(rgm_gcp_key_base64) - env["_EXPERIMENTAL_DAGGER_CLOUD_TOKEN"] = from_secret(rgm_dagger_token) - env["GPG_PRIVATE_KEY"] = from_secret("packages_gpg_private_key") - env["GPG_PUBLIC_KEY"] = from_secret("packages_gpg_public_key") - env["GPG_PASSPHRASE"] = from_secret("packages_gpg_passphrase") - env["DOCKER_USERNAME"] = from_secret("docker_username") - env["DOCKER_PASSWORD"] = from_secret("docker_password") - env["NPM_TOKEN"] = from_secret(npm_token) - env["GCOM_API_KEY"] = from_secret("grafana_api_key") - return env - -def rgm_run(name, script): - """Returns a pipeline that does a full build & package of Grafana. - - Args: - name: The name of the pipeline step. - script: The script in the container to run. - Returns: - Drone step. - """ - env = { - "ALPINE_BASE": images["alpine"], - "UBUNTU_BASE": images["ubuntu"], - } - rgm_run_step = { - "name": name, - "image": images["go"], - "pull": "always", - "commands": with_dagger_install([ - "export GRAFANA_DIR=$$(pwd)", - "export GITHUB_TOKEN=$(cat /github-app/token)", - "./pkg/build/daggerbuild/scripts/{}".format(script), - ], dagger_version), - "environment": rgm_env_secrets(env), - # The docker socket is a requirement for running dagger programs - # In the future we should find a way to use dagger without mounting the docker socket. - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}] + github_app_step_volumes(), - } - - return [ - rgm_run_step, - ] - -def rgm_copy(src, dst): - """Copies file from/to GCS. - - Args: - src: source of the files. - dst: destination of the files. - - Returns: - Drone step. - """ - commands = [ - "printenv GCP_KEY_BASE64 | base64 -d > /tmp/key.json", - "gcloud auth activate-service-account --key-file=/tmp/key.json", - "gcloud storage cp -r {} {}".format(src, dst), - ] - - return { - "name": "rgm-copy", - "image": "google/cloud-sdk:alpine", - "commands": commands, - "environment": rgm_env_secrets({}), - } - -def rgm_publish_packages(bucket = "grafana-packages"): - """Publish deb and rpm packages. - - Args: - bucket: target bucket to publish the packages. - - Returns: - Drone steps. - """ - steps = [] - for package_manager in ["deb", "rpm"]: - steps.append({ - "name": "publish-{}".format(package_manager), - # See https://github.com/grafana/deployment_tools/blob/master/docker/package-publish/README.md for docs on that image - "image": images["package_publish"], - "privileged": True, - "settings": { - "access_key_id": from_secret("packages_access_key_id"), - "secret_access_key": from_secret("packages_secret_access_key"), - "service_account_json": from_secret("packages_service_account"), - "target_bucket": bucket, - "gpg_passphrase": from_secret("packages_gpg_passphrase"), - "gpg_public_key": from_secret("packages_gpg_public_key"), - "gpg_private_key": from_secret("packages_gpg_private_key"), - "package_path": "file:///drone/src/dist/*.{}".format(package_manager), - }, - }) - - return steps - -def rgm_main(): - # Runs a package / build process (with some distros) when commits are merged to main - return pipeline( - name = "rgm-main-prerelease", - trigger = main_trigger, - steps = rgm_run("rgm-build", "drone_build_main.sh"), - ) - -def rgm_tag(): - # Runs a package / build process (with all distros) when a tag is made - return pipeline( - name = "rgm-tag-prerelease", - trigger = tag_trigger, - steps = rgm_run("rgm-build", "drone_build_tag_grafana.sh"), - ) - -def rgm_version_branch(): - # Runs a package / build proces (with all distros) when a commit lands on a version branch - return pipeline( - name = "rgm-version-branch-prerelease", - trigger = version_branch_trigger, - steps = rgm_run("rgm-build", "drone_build_tag_grafana.sh"), - ) - -def rgm_nightly_build(): - """Nightly build pipeline. - - Returns: - Drone pipeline. - """ - src = "$${DRONE_WORKSPACE}/dist/*" - dst = "$${DESTINATION}/$${DRONE_BUILD_EVENT}" - copy_step = rgm_copy(src, dst) - if not dst.startswith("gs://"): - copy_step["commands"].insert(0, "mkdir -p {}".format(dst)) - - copy_steps = with_deps([copy_step], ["rgm-build"]) - - return pipeline( - name = "rgm-nightly-build", - trigger = nightly_trigger, - steps = rgm_run("rgm-build", "drone_build_nightly_grafana.sh") + copy_steps, - ) - -def rgm_nightly_publish(): - """Nightly publish pipeline. - - Returns: - Drone pipeline. - """ - src = "$${DESTINATION}/$${DRONE_BUILD_EVENT}/*_$${DRONE_BUILD_NUMBER}_*" - dst = "$${DRONE_WORKSPACE}/dist" - - publish_steps = with_deps(rgm_run("rgm-publish", "drone_publish_nightly_grafana.sh"), ["rgm-copy"]) - package_steps = with_deps(rgm_publish_packages(), ["rgm-publish"]) - copy_step = rgm_copy(src, dst) - if not dst.startswith("gs://"): - copy_step["commands"].insert(0, "mkdir -p {}".format(dst)) - return pipeline( - name = "rgm-nightly-publish", - trigger = nightly_trigger, - steps = [copy_step] + publish_steps + package_steps, - depends_on = ["rgm-nightly-build"], - ) - -def rgm_nightly_pipeline(): - return [ - rgm_nightly_build(), - rgm_nightly_publish(), - ] - -def rgm_tag_pipeline(): - build = rgm_tag() - - return [ - build, - verify_release_pipeline( - trigger = tag_trigger, - name = "rgm-tag-verify-prerelease-assets", - bucket = "grafana-prerelease", - depends_on = [ - build["name"], - ], - ), - ] - -def rgm_version_branch_pipeline(): - return [ - rgm_version_branch(), - verify_release_pipeline( - trigger = version_branch_trigger, - name = "rgm-prerelease-verify-prerelease-assets", - bucket = "grafana-prerelease", - depends_on = [ - "rgm-version-branch-prerelease", - ], - ), - ] - -def rgm_main_pipeline(): - return [ - rgm_main(), - ] - -def rgm_promotion_pipeline(): - """Promotion build pipeline. - - Returns: - Drone pipeline. - """ - promotion_trigger = { - "event": ["promote"], - "target": "upload-packages", - } - - env = { - "ALPINE_BASE": images["alpine"], - "UBUNTU_BASE": images["ubuntu"], - } - - # Expected promotion args: - # * GRAFANA_REF = commit hash, branch name, or tag name - # * ENTERPRISE_REF = commit hash, branch name, or tag name. If not building an enterprise artifact, then this can be - # left empty. - # * ARTIFACTS = comma delimited list of artifacts (ex: "targz:grafana:linux/amd64,rpm:grafana:linux/amd64") - # * VERSION = version string of Grafana that is being built (ex: v10.0.0) - # * UPLOAD_TO = Google Cloud Storage URL to upload the built artifacts to. (ex: gs://some-bucket/path) - build_step = { - "name": "rgm-build", - "image": images["go"], - "pull": "always", - "commands": with_dagger_install([ - "export GITHUB_TOKEN=$(cat /github-app/token)", - "dagger run --silent go run ./pkg/build/cmd artifacts " + - "-a $${ARTIFACTS} " + - "--grafana-ref=$${GRAFANA_REF} " + - "--enterprise-ref=$${ENTERPRISE_REF} " + - "--grafana-repo=$${GRAFANA_REPO} " + - "--build-id=$${DRONE_BUILD_NUMBER} " + - "--version=$${VERSION}", - ], dagger_version), - "environment": rgm_env_secrets(env), - # The docker socket is a requirement for running dagger programs - # In the future we should find a way to use dagger without mounting the docker socket. - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}] + github_app_step_volumes(), - } - - generate_token_step = github_app_generate_token_step() - publish_step = rgm_copy("dist/*", "$${UPLOAD_TO}") - build_step["depends_on"] = [ - generate_token_step["name"], - ] - - publish_step["depends_on"] = [ - build_step["name"], - ] - - steps = [ - generate_token_step, - build_step, - publish_step, - ] - - return [ - pipeline( - name = "rgm-promotion", - trigger = promotion_trigger, - steps = steps, - volumes = github_app_step_volumes() + github_app_pipeline_volumes(), - ), - ] - -def rgm(): - return ( - rgm_main_pipeline() + - rgm_tag_pipeline() + - rgm_version_branch_pipeline() + - rgm_promotion_pipeline() - ) diff --git a/scripts/drone/steps/github.star b/scripts/drone/steps/github.star deleted file mode 100644 index 2325ba83a57..00000000000 --- a/scripts/drone/steps/github.star +++ /dev/null @@ -1,42 +0,0 @@ -""" -This module is used to interface with the GitHub App to extract temporary installation tokens. -""" - -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/vault.star", - "from_secret", - "github_app_app_id", - "github_app_app_installation_id", - "github_app_private_key", -) - -def github_app_step_volumes(): - return [ - {"name": "github-app", "path": "/github-app"}, - ] - -def github_app_pipeline_volumes(): - return [ - {"name": "github-app", "temp": {}}, - ] - -def github_app_generate_token_step(): - return { - "name": "github-app-generate-token", - "image": images["github_app_secret_writer"], - "environment": { - "GITHUB_APP_ID": from_secret(github_app_app_id), - "GITHUB_APP_INSTALLATION_ID": from_secret(github_app_app_installation_id), - "GITHUB_APP_PRIVATE_KEY": from_secret(github_app_private_key), - }, - "commands": [ - "echo $(/usr/bin/github-app-external-token) > /github-app/token", - ], - "volumes": github_app_step_volumes(), - # forks or those without access would cause it to fail, but we can safely ignore it since there'll be no token. - "failure": "ignore", - } diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star deleted file mode 100644 index 746c183767e..00000000000 --- a/scripts/drone/steps/lib.star +++ /dev/null @@ -1,1189 +0,0 @@ -""" -This module is a library of Drone steps and other pipeline components. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_step_volumes", -) -load( - "scripts/drone/steps/rgm.star", - "rgm_build_backend_step", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/variables.star", - "grabpl_version", -) -load( - "scripts/drone/vault.star", - "from_secret", - "gcp_grafanauploads", - "gcp_grafanauploads_base64", - "gcp_upload_artifacts_key", - "npm_token", - "prerelease_bucket", -) - -trigger_oss = { - "repo": [ - "grafana/grafana", - ], -} - -def yarn_install_step(): - return { - "name": "yarn-install", - "image": images["node"], - "commands": [ - "yarn install --immutable || yarn install --immutable", - ], - "depends_on": [], - } - -def wire_install_step(): - return { - "name": "wire-install", - "image": images["go"], - "commands": [ - "apk add --update make", - "make gen-go", - ], - "depends_on": [ - "verify-gen-cue", - ], - } - -def identify_runner_step(): - return { - "name": "identify-runner", - "image": images["alpine"], - "commands": [ - "echo $DRONE_RUNNER_NAME", - ], - } - -def enterprise_setup_step(source = "${DRONE_SOURCE_BRANCH}", canFail = True, isPromote = False): - """Setup the enterprise source into the ./grafana-enterprise directory. - - Args: - source: controls which revision of grafana-enterprise is checked out, if it exists. The name 'source' derives from the 'source branch' of a pull request. - canFail: controls whether the step can fail. This is useful for pull requests where the enterprise source may not exist. - isPromote: controls whether or not this step is being used in a promote pipeline. If it is, then the clone enterprise step will not check if the pull request is a fork. - Returns: - Drone step. - """ - step = clone_enterprise_step_pr(source = source, target = "${DRONE_TARGET_BRANCH}", canFail = canFail, location = "../grafana-enterprise", isPromote = isPromote) - step["commands"] += [ - "cd ../", - "ln -s src grafana", - "cd ./grafana-enterprise", - "./build.sh", - ] - - return step - -def clone_enterprise_step_pr(source = "${DRONE_COMMIT}", target = "main", canFail = False, location = "grafana-enterprise", isPromote = False): - """Clone the enterprise source into the ./grafana-enterprise directory. - - Args: - source: controls which revision of grafana-enterprise is checked out, if it exists. The name 'source' derives from the 'source branch' of a pull request. - target: controls which revision of grafana-enterprise is checked out, if it 'source' does not exist. The name 'target' derives from the 'target branch' of a pull request. If this does not exist, then 'main' will be checked out. - canFail: controls whether or not this step is allowed to fail. If it fails and this is true, then the pipeline will continue. canFail is used in pull request pipelines where enterprise may be cloned but may not clone in forks. - location: the path where grafana-enterprise is cloned. - isPromote: controls whether or not this step is being used in a promote pipeline. If it is, then the step will not check if the pull request is a fork. - Returns: - Drone step. - """ - - if isPromote: - check = [] - else: - check = [ - 'is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork)', - 'if [ "$is_fork" != false ]; then return 1; fi', # Only clone if we're confident that 'fork' is 'false'. Fail if it's also empty. - ] - - step = { - "name": "clone-enterprise", - "image": images["git"], - "commands": [ - "apk add --update curl jq bash", - "GITHUB_TOKEN=$(cat /github-app/token)", - ] + check + [ - 'git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ' + location, - "cd {}".format(location), - 'if git checkout {0}; then echo "checked out {0}"; elif git checkout {1}; then echo "git checkout {1}"; else git checkout main; fi'.format(source, target), - ], - "depends_on": [ - github_app_generate_token_step()["name"], - ], - "volumes": github_app_step_volumes(), - } - - if canFail: - step["failure"] = "ignore" - - return step - -def download_grabpl_step(): - return { - "name": "grabpl", - "image": images["curl"], - "commands": [ - "mkdir -p bin", - "curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/{}/grabpl".format( - grabpl_version, - ), - "chmod +x bin/grabpl", - ], - } - -def lint_drone_step(): - return { - "name": "lint-drone", - "image": images["curl"], - "commands": [ - "./bin/build verify-drone", - ], - "depends_on": [ - "compile-build-cmd", - ], - } - -def lint_starlark_step(): - return { - "name": "lint-starlark", - "image": images["go"], - "commands": [ - "go install github.com/bazelbuild/buildtools/buildifier@latest", - "buildifier --lint=warn -mode=check -r .", - ], - "depends_on": [], - } - -def enterprise_downstream_step(ver_mode): - """Triggers a downstream pipeline in the grafana-enterprise repository. - - Args: - ver_mode: indirectly controls the revision used for downstream pipelines. - It also used to allow the step to fail for pull requests without blocking merging. - - Returns: - Drone step. - """ - repo = "grafana/grafana-enterprise@" - if ver_mode == "pr" or ver_mode == "rrc": - repo += "${DRONE_SOURCE_BRANCH}" - else: - repo += "main" - - step = { - "name": "trigger-enterprise-downstream", - "image": images["drone_downstream"], - "settings": { - "server": "https://drone.grafana.net", - "token": from_secret("drone_token"), - "repositories": [ - repo, - ], - "params": [ - "SOURCE_BUILD_NUMBER=${DRONE_COMMIT}", - "SOURCE_COMMIT=${DRONE_COMMIT}", - ], - }, - } - - if ver_mode == "pr": - step.update({"failure": "ignore"}) - step["settings"]["params"].append("OSS_PULL_REQUEST=${DRONE_PULL_REQUEST}") - - if ver_mode == "rrc": - step["settings"]["params"].append("SOURCE_TAG=${DRONE_TAG}") - - return step - -def validate_modfile_step(): - return { - "name": "validate-modfile", - "image": images["go"], - "commands": [ - "go run scripts/modowners/modowners.go check go.mod", - ], - } - -def validate_openapi_spec_step(): - return { - "name": "validate-openapi-spec", - "image": images["go"], - "commands": [ - "apk add --update make", - "make swagger-validate", - ], - } - -def dockerize_step(name, hostname, port, canFail = False): - step = { - "name": name, - "image": images["dockerize"], - "commands": [ - "dockerize -wait tcp://{}:{} -timeout 120s".format(hostname, port), - ], - } - - if canFail: - step["failure"] = "ignore" - - return step - -def build_storybook_step(ver_mode): - return { - "name": "build-storybook", - "image": images["node"], - "depends_on": [ - # Best to ensure that this step doesn't mess with what's getting built and packaged - "rgm-package", - "build-frontend-packages", - ], - "environment": { - "NODE_OPTIONS": "--max_old_space_size=4096", - }, - "commands": [ - "yarn storybook:build", - "./bin/build verify-storybook", - ], - "when": get_trigger_storybook(ver_mode), - } - -def store_storybook_step(ver_mode, trigger = None): - """Publishes the Grafana UI components storybook. - - Args: - ver_mode: controls whether a release or canary version is published. - trigger: a Drone trigger for the step. - Defaults to None. - - Returns: - Drone step. - """ - commands = [] - if ver_mode == "release": - commands.extend( - [ - "./bin/build store-storybook --deployment latest", - "./bin/build store-storybook --deployment ${DRONE_TAG}", - ], - ) - - else: - # main pipelines should deploy storybook to grafana-storybook/canary public bucket - commands = [ - "./bin/build store-storybook --deployment canary", - ] - - step = { - "name": "store-storybook", - "image": images["publish"], - "depends_on": [ - "build-storybook", - ] + - end_to_end_tests_deps(), - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads), - "PRERELEASE_BUCKET": from_secret(prerelease_bucket), - }, - "commands": commands, - "when": get_trigger_storybook(ver_mode), - } - if trigger and ver_mode in ("release-branch", "main"): - # no dict merge operation available, https://github.com/harness/drone-cli/pull/220 - when_cond = { - "repo": [ - "grafana/grafana", - ], - "paths": { - "include": [ - "packages/grafana-ui/**", - ], - }, - } - step = dict(step, when = when_cond) - return step - -def e2e_tests_artifacts(): - # Note: This function is kept for backward compatibility but now only handles - # artifacts from the remaining E2E tests that haven't been migrated to GitHub Actions - return { - "name": "e2e-tests-artifacts-upload", - "image": images["cloudsdk"], - "depends_on": [ - # Note: Main E2E tests have been migrated to GitHub Actions - # Only depend on remaining Drone E2E tests - "end-to-end-tests-cloud-plugins-suite-azure", - "playwright-plugin-e2e", - github_app_generate_token_step()["name"], - ], - "failure": "ignore", - "when": { - "status": [ - "success", - "failure", - ], - }, - "environment": { - "GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY": from_secret(gcp_upload_artifacts_key), - "E2E_TEST_ARTIFACTS_BUCKET": "releng-pipeline-artifacts-dev", - }, - "commands": [ - "export GITHUB_TOKEN=$(cat /github-app/token)", - # if no videos found do nothing (may be fewer videos now that main tests are in GitHub Actions) - "if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'no e2e videos found from remaining tests'; exit 0; fi", - "apt-get update", - "apt-get install -yq zip", - "printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json", - "gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json", - # we want to only include files in e2e folder that end with .spec.ts.mp4 - 'find ./e2e -type f -name "*spec.ts.mp4" | zip e2e/videos.zip -@', - "gsutil cp e2e/videos.zip gs://$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip", - "export E2E_ARTIFACTS_VIDEO_ZIP=https://storage.googleapis.com/$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip", - 'echo "E2E Test artifacts uploaded to: $${E2E_ARTIFACTS_VIDEO_ZIP}"', - 'curl -X POST https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA} -H "Authorization: token $${GITHUB_TOKEN}" -d ' + - '"{\\"state\\":\\"success\\",\\"target_url\\":\\"$${E2E_ARTIFACTS_VIDEO_ZIP}\\", \\"description\\": \\"Click on the details to download e2e recording videos\\", \\"context\\": \\"e2e_artifacts\\"}"', - ], - "volumes": github_app_step_volumes(), - } - -def playwright_e2e_report_upload(): - return { - "name": "playwright-e2e-report-upload", - "image": images["cloudsdk"], - "depends_on": [ - "playwright-plugin-e2e", - ], - "failure": "ignore", - "when": { - "status": [ - "success", - "failure", - ], - }, - "environment": { - "GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY": from_secret(gcp_upload_artifacts_key), - }, - "commands": [ - "apt-get update", - "apt-get install -yq zip", - "printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json", - "gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json", - "gsutil cp -r ./playwright-report/. gs://releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report", - "export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html", - 'echo "E2E Playwright report uploaded to: \n $${E2E_PLAYWRIGHT_REPORT_URL}"', - ], - } - -def playwright_e2e_report_post_link(): - return { - "name": "playwright-e2e-report-post-link", - "image": images["curl"], - "depends_on": [ - "playwright-e2e-report-upload", - github_app_generate_token_step()["name"], - ], - "failure": "ignore", - "when": { - "status": [ - "success", - "failure", - ], - }, - "commands": [ - "GITHUB_TOKEN=$(cat /github-app/token)", - # if the trace doesn't folder exists, it means that there are no failed tests. - "if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi", - # if it exists, we will post a comment on the PR with the link to the report - "export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html", - "curl -L " + - "-X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments " + - '-H "Accept: application/vnd.github+json" ' + - '-H "Authorization: Bearer $${GITHUB_TOKEN}" ' + - '-H "X-GitHub-Api-Version: 2022-11-28" -d ' + - '"{\\"body\\":\\"❌ Failed to run Playwright plugin e2e tests.

Click [here]($${E2E_PLAYWRIGHT_REPORT_URL}) to browse the Playwright report and trace viewer.
For information on how to run Playwright tests locally, refer to the [Developer guide](https://github.com/grafana/grafana/blob/main/contribute/developer-guide.md#to-run-the-playwright-tests). \\"}"', - ], - "volumes": github_app_step_volumes(), - } - -def upload_cdn_step(ver_mode, trigger = None, depends_on = ["grafana-server"]): - """Uploads CDN assets using the Grafana build tool. - - Args: - ver_mode: only uses the step trigger when ver_mode == 'release-branch' or 'main' - trigger: a Drone trigger for the step. - Defaults to None. - depends_on: drone steps that this step depends on - - Returns: - Drone step. - """ - - step = { - "name": "upload-cdn-assets", - "image": images["publish"], - "depends_on": depends_on, - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads), - "PRERELEASE_BUCKET": from_secret(prerelease_bucket), - }, - "commands": [ - "./bin/build upload-cdn --edition oss", - ], - } - if trigger and ver_mode in ("release-branch", "main"): - step = dict(step, when = trigger) - return step - -def build_backend_step(distros = "linux/amd64,linux/arm64"): - """Build the backend code using the Grafana build tool. - - Args: - distros: a list of distributes to be built. For a full list, see `go tool dist list`. - - Returns: - Drone step. - """ - - return rgm_build_backend_step(distros) - -def build_frontend_step(): - """Build the frontend code to ensure it's compilable - - Returns: - Drone step. - """ - return { - "name": "build-frontend", - "image": images["node"], - "environment": { - "NODE_OPTIONS": "--max_old_space_size=8192", - }, - "depends_on": [ - "compile-build-cmd", - "yarn-install", - ], - "commands": [ - "yarn build", - ], - } - -def build_test_plugins_step(): - """Build the test plugins used in e2e tests - - Returns: - Drone step. - """ - return { - "name": "build-test-plugins", - "image": images["node"], - "environment": { - "NODE_OPTIONS": "--max_old_space_size=8192", - }, - "depends_on": [ - "yarn-install", - ], - "commands": [ - "yarn e2e:plugin:build", - ], - } - -def update_package_json_version(): - """Updates the packages/ to use a version that has the build ID in it: 10.0.0pre -> 10.0.0-5432pre - - Returns: - Drone step that updates the 'version' key in package.json - """ - - return { - "name": "update-package-json-version", - "image": images["node"], - "depends_on": [ - "yarn-install", - ], - "commands": [ - "apk add --update jq", - "new_version=$(cat package.json | jq -r .version | sed s/pre/${DRONE_BUILD_NUMBER}/g)", - "echo \"New version: $new_version\"", - "yarn run lerna version $new_version --exact --no-git-tag-version --no-push --force-publish -y", - "yarn install --mode=update-lockfile", - ], - } - -def build_frontend_package_step(depends_on = []): - """Build the frontend packages using the Grafana build tool. - - Args: - depends_on: a list of step names (strings) that must complete before this step runs. - - Returns: - Drone step. - """ - - cmds = [ - "apk add --update jq bash", # bash is needed for the validate-npm-packages.sh script since it has a 'bash' - # shebang. - "yarn packages:build", - "yarn packages:pack", - "./scripts/validate-npm-packages.sh", - ] - - return { - "name": "build-frontend-packages", - "image": images["node"], - "environment": { - "NODE_OPTIONS": "--max_old_space_size=8192", - }, - "depends_on": [ - "yarn-install", - ] + depends_on, - "commands": cmds, - } - -def build_plugins_step(ver_mode): - if ver_mode != "pr": - env = { - "GRAFANA_API_KEY": from_secret("grafana_api_key"), - } - else: - env = None - return { - "name": "build-plugins", - "image": images["node"], - "environment": env, - "depends_on": [ - "yarn-install", - ], - "commands": [ - "apk add --update findutils", # Replaces the busybox 'find' with the GNU one. - "yarn plugins:build", - ], - } - -def betterer_frontend_step(): - """Run betterer on frontend code. - - Returns: - Drone step. - """ - - return { - "name": "betterer-frontend", - "image": images["node"], - "depends_on": [ - "yarn-install", - ], - "commands": [ - "apk add --update git bash", - "yarn betterer:ci", - ], - } - -def verify_i18n_step(): - extract_error_message = "\nExtraction failed. Make sure that you have no dynamic translation phrases, such as 't(\\`preferences.theme.\\$${themeID}\\`, themeName)' and that no translation key is used twice. Search the output for '[warning]' to find the offending file." - uncommited_error_message = "\nTranslation extraction has not been committed. Please run 'make i18n-extract', commit the changes and push again." - return { - "name": "verify-i18n", - "image": images["node_deb"], - "depends_on": [ - "yarn-install", - ], - "commands": [ - "make i18n-extract || (echo \"{}\" && false)".format(extract_error_message), - # Verify that translation extraction has been committed - ''' - file_diff=$(git diff --dirstat public/locales) - if [ -n "$file_diff" ]; then - echo $file_diff - echo "{}" - exit 1 - fi - '''.format(uncommited_error_message), - ], - } - -def verify_api_clients_step(): - uncommited_error_message = "\nAPI client generation has not been committed. Please run 'yarn generate-apis', commit the changes and push again." - return { - "name": "verify-api-clients", - "image": images["node_deb"], - "depends_on": [ - "yarn-install", - ], - "commands": [ - "yarn generate-apis", - # Verify that client generation has been run and committed - ''' - file_diff=$(git diff ':!conf') - if [ -n "$file_diff" ]; then - echo $file_diff - echo "{}" - exit 1 - fi - '''.format(uncommited_error_message), - ], - } - -def test_a11y_frontend_step(ver_mode, port = 3001): - """Runs automated accessiblity tests against the frontend. - - Args: - ver_mode: controls whether the step is blocking or just reporting. - If ver_mode == 'pr', the step causes the pipeline to fail. - port: which port to grafana-server is expected to be listening on. - Defaults to 3001. - - Returns: - Drone step. - """ - commands = [ - # Note - this runs in a container running node 14, which does not support the -y option to npx - "npx wait-on@7.0.1 http://$HOST:$PORT", - "pa11y-ci --config e2e/pa11yci.conf.js", - ] - failure = "ignore" - no_thresholds = "true" - if ver_mode == "pr": - failure = "always" - no_thresholds = "false" - - return { - "name": "test-a11y-frontend", - # TODO which image should be used? - "image": images["docker_puppeteer"], - "depends_on": [ - "grafana-server", - ], - "environment": { - "GRAFANA_MISC_STATS_API_KEY": from_secret("grafana_misc_stats_api_key"), - "HOST": "grafana-server", - "PORT": port, - "NO_THRESHOLDS": no_thresholds, - }, - "failure": failure, - "commands": commands, - } - -def frontend_metrics_step(trigger = None): - """Reports frontend metrics to Grafana Cloud. - - Args: - trigger: a Drone trigger for the step. - Defaults to None. - - Returns: - Drone step. - """ - - step = { - "name": "publish-frontend-metrics", - "image": images["node"], - "depends_on": [ - "test-a11y-frontend", - ], - "environment": { - "GRAFANA_MISC_STATS_API_KEY": from_secret("grafana_misc_stats_api_key"), - }, - "failure": "ignore", - "commands": [ - "apk add --update bash grep git", - "./scripts/ci-frontend-metrics.sh ./grafana/public/build | ./bin/build publish-metrics $$GRAFANA_MISC_STATS_API_KEY", - ], - } - if trigger: - step = dict(step, when = trigger) - return step - -def grafana_server_step(): - """Runs the grafana-server binary as a service. - - Returns: - Drone step. - """ - environment = { - "GF_SERVER_HTTP_PORT": "3001", - "GF_SERVER_ROUTER_LOGGING": "1", - "GF_APP_MODE": "development", - } - - return { - "name": "grafana-server", - "image": images["alpine"], - "detach": True, - "depends_on": [ - "rgm-package", - ], - "environment": environment, - "commands": [ - "apk add --update tar bash", - "mkdir grafana", - "tar --strip-components=1 -xvf ./dist/*amd64.tar.gz -C grafana", - "cp -r devenv scripts tools grafana && cd grafana && ./scripts/grafana-server/start-server", - ], - } - -def e2e_tests_step(suite, port = 3001, tries = None): - cmd = "./bin/build e2e-tests --port {} --suite {}".format(port, suite) - if tries: - cmd += " --tries {}".format(tries) - return { - "name": "end-to-end-tests-{}".format(suite), - "image": images["cypress"], - "depends_on": [ - "grafana-server", - "build-test-plugins", - ], - "environment": { - "HOST": "grafana-server", - }, - "commands": [ - cmd, - ], - } - -def start_storybook_step(): - return { - "name": "start-storybook", - "image": images["node"], - "depends_on": [ - "yarn-install", - ], - "commands": [ - "yarn storybook --quiet", - ], - "detach": True, - } - -def cloud_plugins_e2e_tests_step(suite, cloud, trigger = None): - """Run cloud plugins end-to-end tests. - - Args: - suite: affects the pipeline name. - TODO: check if this actually affects step behavior. - cloud: used to determine cloud provider specific tests. - trigger: a Drone trigger for the step. - Defaults to None. - - Returns: - Drone step. - """ - environment = {} - when = {} - if trigger: - when = trigger - if cloud == "azure": - environment = { - "CYPRESS_CI": "true", - "HOST": "grafana-server", - "AZURE_SP_APP_ID": from_secret("azure_sp_app_id"), - "AZURE_SP_PASSWORD": from_secret("azure_sp_app_pw"), - "AZURE_TENANT": from_secret("azure_tenant"), - } - when = dict( - when, - paths = { - "include": [ - "pkg/tsdb/azuremonitor/**", - "public/app/plugins/datasource/azuremonitor/**", - "e2e/cloud-plugins-suite/azure-monitor.spec.ts", - ], - }, - ) - branch = "${DRONE_SOURCE_BRANCH}".replace("/", "-") - step = { - "name": "end-to-end-tests-{}-{}".format(suite, cloud), - "image": "us-docker.pkg.dev/grafanalabs-dev/docker-oss-plugin-partnerships-dev/e2e-14.3.2:1.0.0", - "depends_on": [ - "grafana-server", - github_app_generate_token_step()["name"], - ], - "environment": environment, - "commands": [ - "GITHUB_TOKEN=$(cat /github-app/token)", - "cd /", - "./cpp-e2e/scripts/ci-run.sh {} {}".format(cloud, branch), - ], - "volumes": github_app_step_volumes(), - } - step = dict(step, when = when) - return step - -def playwright_e2e_tests_step(): - return { - "environment": { - "PORT": "3001", - "HOST": "grafana-server", - "PROV_DIR": "/grafana/scripts/grafana-server/tmp/conf/provisioning", - }, - "name": "playwright-plugin-e2e", - "image": images["node_deb"], - "depends_on": [ - "grafana-server", - "build-test-plugins", - ], - "commands": [ - "npx wait-on@7.0.1 http://$HOST:$PORT", - "yarn playwright install --with-deps chromium", - "GRAFANA_URL=http://$HOST:$PORT yarn e2e:playwright --grep @plugins", - ], - } - -def build_docs_website_step(): - return { - "name": "build-docs-website", - # Use latest revision here, since we want to catch if it breaks - "image": images["docs"], - "pull": "always", - "commands": [ - "mkdir -p /hugo/content/docs/grafana/latest", - "echo -e '---\\nredirectURL: /docs/grafana/latest/\\ntype: redirect\\nversioned: true\\n---\\n' > /hugo/content/docs/grafana/_index.md", - "cp -r docs/sources/* /hugo/content/docs/grafana/latest/", - "cd /hugo && make prod", - ], - } - -def fetch_images_step(): - return { - "name": "fetch-images", - "image": images["cloudsdk"], - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads), - "DOCKER_USER": from_secret("docker_username"), - "DOCKER_PASSWORD": from_secret("docker_password"), - }, - "commands": ["./bin/build artifacts docker fetch --edition oss"], - "depends_on": ["compile-build-cmd"], - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}], - } - -def publish_images_step(ver_mode, docker_repo, trigger = None, depends_on = ["rgm-build-docker"]): - """Generates a step for publishing public Docker images with grabpl. - - Args: - ver_mode: controls whether the image needs to be built or retrieved from a previous build. - If ver_mode == 'release', the previously built image is fetched instead of being built again. - docker_repo: the Docker image name. - It is combined with the 'grafana/' library prefix. - trigger: a Drone trigger for the pipeline. - Defaults to None. - depends_on: drone steps that this step depends on - - Returns: - Drone step. - """ - name = docker_repo - docker_repo = "grafana/{}".format(docker_repo) - - environment = { - "GCP_KEY": from_secret(gcp_grafanauploads), - "DOCKER_USER": from_secret("docker_username"), - "DOCKER_PASSWORD": from_secret("docker_password"), - "GITHUB_APP_ID": "329617", - "GITHUB_APP_INSTALLATION_ID": "37346161", - "GITHUB_APP_PRIVATE_KEY": from_secret("delivery-bot-app-private-key"), - } - - cmd = "./bin/grabpl artifacts docker publish --dockerhub-repo {}".format( - docker_repo, - ) - - deps = depends_on - if ver_mode == "release": - deps = ["fetch-images"] - cmd += " --version-tag ${DRONE_TAG}" - - if ver_mode == "pr": - environment = { - "DOCKER_USER": from_secret("docker_username"), - "DOCKER_PASSWORD": from_secret("docker_password"), - "GITHUB_APP_ID": "329617", - "GITHUB_APP_INSTALLATION_ID": "37346161", - "GITHUB_APP_PRIVATE_KEY": from_secret("delivery-bot-app-private-key"), - } - - step = { - "name": "publish-images-{}".format(name), - "image": images["cloudsdk"], - "environment": environment, - "commands": [cmd], - "depends_on": deps, - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}], - } - if trigger and ver_mode in ("release-branch", "main"): - step = dict(step, when = trigger) - if ver_mode == "pr": - step = dict(step, failure = "ignore") - - return step - -def release_canary_npm_packages_step(trigger = None): - """Releases canary NPM packages. - - Args: - trigger: a Drone trigger for the step. - Defaults to None. - - Returns: - Drone step. - """ - step = { - "name": "release-canary-npm-packages", - "image": images["node"], - "depends_on": end_to_end_tests_deps() + ["build-frontend-packages"], - "environment": { - "NPM_TOKEN": from_secret(npm_token), - }, - "commands": [ - "apk add --update bash git", - "./scripts/publish-npm-packages.sh --dist-tag 'canary' --registry 'https://registry.npmjs.org'", - ], - } - - if trigger: - step = dict( - step, - when = dict( - trigger, - paths = { - "include": [ - "packages/**", - ], - }, - ), - ) - - return step - -def upload_packages_step( - ver_mode, - trigger = None, - depends_on = [ - # Note: Main E2E tests have been migrated to GitHub Actions - # Updated dependencies to only include remaining Drone E2E tests - "end-to-end-tests-cloud-plugins-suite-azure", - "playwright-plugin-e2e", - ]): - """Upload packages to object storage. - - Args: - ver_mode: when ver_mode == 'main', inhibit upload of enterprise - edition packages when executed. - trigger: a Drone trigger for the step. - Defaults to None. - depends_on: drone steps that this step depends on - - Returns: - Drone step. - """ - step = { - "name": "upload-packages", - "image": images["publish"], - "depends_on": depends_on, - "environment": { - "GCP_KEY": from_secret(gcp_grafanauploads_base64), - "PRERELEASE_BUCKET": from_secret("prerelease_bucket"), - }, - "commands": [ - "./bin/build upload-packages --edition oss", - ], - } - if trigger and ver_mode in ("release-branch", "main"): - step = dict(step, when = trigger) - return step - -def publish_grafanacom_step(ver_mode, depends_on = ["publish-linux-packages-deb", "publish-linux-packages-rpm"]): - """Publishes Grafana packages to grafana.com. - - Args: - ver_mode: if ver_mode == 'main', pass the DRONE_BUILD_NUMBER environment - variable as the value for the --build-id option. - TODO: is this actually used by the grafanacom subcommand? I think it might - just use the environment variable directly. - depends_on: what other steps this one depends on (strings) - - Returns: - Drone step. - """ - if ver_mode == "release": - cmd = "./bin/build publish grafana-com --edition oss ${DRONE_TAG}" - elif ver_mode == "main": - build_no = "${DRONE_BUILD_NUMBER}" - cmd = "./bin/build publish grafana-com --edition oss --build-id {}".format( - build_no, - ) - else: - fail("Unexpected version mode {}".format(ver_mode)) - - return { - "name": "publish-grafanacom", - "image": images["publish"], - "depends_on": depends_on, - "environment": { - "GRAFANA_COM_API_KEY": from_secret("grafana_api_key"), - "GCP_KEY": from_secret(gcp_grafanauploads_base64), - }, - "commands": [ - cmd, - ], - } - -def verify_grafanacom_step(depends_on = ["publish-grafanacom"]): - return { - "name": "verify-grafanacom", - "image": images["node"], - "commands": [ - # Download and install `curl` and `bash` - both of which aren't available inside of the `node:{version}-alpine` docker image. - "apk add curl bash", - - # There may be a slight lag between when artifacts are uploaded to Google Storage, - # and when they become available on the website. This `for` loop sould account for that discrepancy. - # We attempt the verification up to 5 times. If successful, exit the loop with a success (0) status. - # If any attempt fails, but it's not the final attempt, wait 60 seconds before the next attempt. - # If the 5th (final) attempt fails, exit with error (1) status. - """ - for i in {1..5}; do - if ./scripts/drone/verify-grafanacom.sh; then - exit 0 - elif [ $i -eq 5 ]; then - exit 1 - else - sleep 60 - fi - done - """, - ], - "depends_on": depends_on, - } - -def publish_linux_packages_step(package_manager = "deb"): - return { - "name": "publish-linux-packages-{}".format(package_manager), - # See https://github.com/grafana/deployment_tools/blob/master/docker/package-publish/README.md for docs on that image - "image": images["package_publish"], - "depends_on": ["compile-build-cmd"], - "privileged": True, - "settings": { - "access_key_id": from_secret("packages_access_key_id"), - "secret_access_key": from_secret("packages_secret_access_key"), - "service_account_json": from_secret("packages_service_account"), - "target_bucket": "grafana-packages", - "deb_distribution": "auto", - "gpg_passphrase": from_secret("packages_gpg_passphrase"), - "gpg_public_key": from_secret("packages_gpg_public_key"), - "gpg_private_key": from_secret("packages_gpg_private_key"), - "package_path": "gs://grafana-prerelease/artifacts/downloads/*${{DRONE_TAG}}/oss/**.{}".format( - package_manager, - ), - }, - } - -# This retry will currently continue for 30 minutes until fail, unless successful. -def retry_command(command, attempts = 60, delay = 30): - return [ - "for i in $(seq 1 %d); do" % attempts, - " if %s; then" % command, - ' echo "Command succeeded on attempt $i"', - " break", - " else", - ' echo "Attempt $i failed"', - " if [ $i -eq %d ]; then" % attempts, - " echo 'All attempts failed'", - " exit 1", - " fi", - ' echo "Waiting %d seconds before next attempt..."' % delay, - " sleep %d" % delay, - " fi", - "done", - ] - -def verify_gen_cue_step(): - return { - "name": "verify-gen-cue", - "image": images["go"], - "depends_on": [], - "commands": [ - "# It is required that code generated from Thema/CUE be committed and in sync with its inputs.", - "# The following command will fail if running code generators produces any diff in output.", - "apk add --update make", - "CODEGEN_VERIFY=1 make gen-cue", - ], - } - -def verify_gen_jsonnet_step(): - return { - "name": "verify-gen-jsonnet", - "image": images["go"], - "depends_on": [], - "commands": [ - "# It is required that generated jsonnet is committed and in sync with its inputs.", - "# The following command will fail if running code generators produces any diff in output.", - "apk add --update make", - "CODEGEN_VERIFY=1 make gen-jsonnet", - ], - } - -def end_to_end_tests_deps(): - # Note: Main E2E tests have been migrated to GitHub Actions - # Only return dependencies for E2E tests that still run in Drone - return [ - "end-to-end-tests-cloud-plugins-suite-azure", - "playwright-plugin-e2e", - ] - -def compile_build_cmd(): - dependencies = [] - - return { - "name": "compile-build-cmd", - "image": images["go"], - "commands": [ - "go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd", - ], - "depends_on": dependencies, - "environment": { - "CGO_ENABLED": 0, - }, - } - -def get_trigger_storybook(ver_mode): - """Generate a Drone trigger for UI changes that affect the Grafana UI storybook. - - Args: - ver_mode: affects whether the trigger is event tags or changed files. - - Returns: - Drone trigger. - """ - trigger_storybook = "" - if ver_mode == "release": - trigger_storybook = {"event": ["tag"]} - else: - trigger_storybook = { - "paths": { - "include": [ - "packages/grafana-ui/**", - ], - }, - } - return trigger_storybook - -def slack_step(channel, template, secret): - return { - "name": "slack", - "image": images["plugins_slack"], - "settings": { - "webhook": from_secret(secret), - "channel": channel, - "template": template, - }, - } diff --git a/scripts/drone/steps/rgm.star b/scripts/drone/steps/rgm.star deleted file mode 100644 index 8114dceca39..00000000000 --- a/scripts/drone/steps/rgm.star +++ /dev/null @@ -1,103 +0,0 @@ -""" -Individual steps that use 'grafana-build' to replace existing individual steps. -These aren't used in releases. -""" - -load( - "scripts/drone/dagger.star", - "with_dagger_install", -) -load( - "scripts/drone/utils/images.star", - "images", -) -load( - "scripts/drone/variables.star", - "dagger_version", -) -load( - "scripts/drone/vault.star", - "from_secret", - "rgm_dagger_token", -) - -def artifacts_cmd(artifacts = []): - cmd = "go run ./pkg/build/cmd artifacts " - - for artifact in artifacts: - cmd += "-a {} ".format(artifact) - - return cmd - -# rgm_artifacts_step will create artifacts using the '/src/build artifacts' command. -def rgm_artifacts_step( - name = "rgm-package", - artifacts = ["targz:grafana:linux/amd64", "targz:grafana:linux/arm64"], - file = "packages.txt", - depends_on = ["yarn-install"], - tag_format = "{{ .version }}-{{ .arch }}", - ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}", - verify = "false"): - cmd = artifacts_cmd(artifacts = artifacts) - - return { - "name": name, - "image": images["go"], - "pull": "always", - "depends_on": depends_on, - "environment": { - "_EXPERIMENTAL_DAGGER_CLOUD_TOKEN": from_secret(rgm_dagger_token), - }, - "commands": with_dagger_install([ - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --version", - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*'", - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all", - cmd + - "--yarn-cache=$$YARN_CACHE_FOLDER " + - "--build-id=$$DRONE_BUILD_NUMBER " + - "--ubuntu-base=ubuntu-base " + - "--alpine-base=alpine-base " + - "--tag-format='{}' ".format(tag_format) + - "--ubuntu-tag-format='{}' ".format(ubuntu_tag_format) + - "--verify='{}' ".format(verify) + - "--grafana-dir=$$PWD > {}".format(file), - "find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i", - ], dagger_version), - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}], - } - -# rgm_build_backend will create compile the grafana backend for various platforms. -def rgm_build_backend_step(artifacts = ["backend:grafana:linux/amd64", "backend:grafana:linux/arm64"]): - return rgm_artifacts_step(name = "rgm-build-backend", artifacts = artifacts, depends_on = []) - -def rgm_build_docker_step(depends_on = ["yarn-install"], file = "docker.txt", tag_format = "{{ .version }}-{{ .arch }}", ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}"): - return { - "name": "rgm-build-docker", - "image": images["go"], - "pull": "always", - "environment": { - "_EXPERIMENTAL_DAGGER_CLOUD_TOKEN": from_secret(rgm_dagger_token), - }, - "commands": with_dagger_install([ - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --version", - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*'", - "docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all", - "go run ./pkg/build/cmd artifacts " + - "-a docker:grafana:linux/amd64 " + - "-a docker:grafana:linux/amd64:ubuntu " + - "-a docker:grafana:linux/arm64 " + - "-a docker:grafana:linux/arm64:ubuntu " + - "-a docker:grafana:linux/arm/v7 " + - "-a docker:grafana:linux/arm/v7:ubuntu " + - "--yarn-cache=$$YARN_CACHE_FOLDER " + - "--build-id=$$DRONE_BUILD_NUMBER " + - "--ubuntu-base=ubuntu-base " + - "--alpine-base=alpine-base " + - "--tag-format='{}' ".format(tag_format) + - "--grafana-dir=$$PWD " + - "--ubuntu-tag-format='{}' > {}".format(ubuntu_tag_format, file), - "find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i", - ], dagger_version), - "volumes": [{"name": "docker", "path": "/var/run/docker.sock"}], - "depends_on": depends_on, - } diff --git a/scripts/drone/utils/images.star b/scripts/drone/utils/images.star deleted file mode 100644 index 02b03169ed6..00000000000 --- a/scripts/drone/utils/images.star +++ /dev/null @@ -1,30 +0,0 @@ -""" -This module contains all the docker images that are used to build test and publish Grafana. -""" - -load( - "scripts/drone/variables.star", - "golang_version", - "nodejs_version", -) - -images = { - "docker": "docker:27-cli", - "git": "alpine/git:2.40.1", - "go": "golang:{}-alpine".format(golang_version), - "node": "node:{}-alpine".format(nodejs_version), - "node_deb": "node:{}-bookworm".format(nodejs_version[:2]), - "cloudsdk": "google/cloud-sdk:431.0.0", - "publish": "grafana/grafana-ci-deploy:1.3.3", - "alpine": "alpine:3.21.3", - "ubuntu": "ubuntu:22.04", - "curl": "byrnedo/alpine-curl:0.1.8", - "plugins_slack": "plugins/slack", - "package_publish": "us.gcr.io/kubernetes-dev/package-publish:latest", - "drone_downstream": "grafana/drone-downstream", - "docker_puppeteer": "grafana/docker-puppeteer:1.1.0", - "docs": "grafana/docs-base:latest", - "cypress": "cypress/included:14.3.2", - "dockerize": "jwilder/dockerize:0.6.1", - "github_app_secret_writer": "us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59", -} diff --git a/scripts/drone/utils/utils.star b/scripts/drone/utils/utils.star deleted file mode 100644 index 4cc7aac6e49..00000000000 --- a/scripts/drone/utils/utils.star +++ /dev/null @@ -1,140 +0,0 @@ -""" -This module contains utility functions for generating Drone pipelines. -""" - -load( - "scripts/drone/steps/lib.star", - "slack_step", -) -load( - "scripts/drone/vault.star", - "gar_pull_secret", - "gcr_pull_secret", -) - -failure_template = "Build {{build.number}} failed for commit: : {{build.link}}\nBranch: \nAuthor: {{build.author}}" - -def pipeline( - name, - trigger, - steps, - services = [], - platform = "linux", - depends_on = [], - environment = None, - volumes = []): - """Generate a Drone Docker pipeline with commonly used values. - - In addition to the parameters provided, it configures: - - the use of an image pull secret - - a retry count for cloning - - a volume 'docker' that can be used to access the Docker socket - - Args: - name: controls the pipeline name. - trigger: a Drone trigger for the pipeline. - steps: the Drone steps for the pipeline. - services: auxiliary services used during the pipeline. - Defaults to []. - platform: abstracts platform specific configuration primarily for different Drone behavior on Windows. - Defaults to 'linux'. - depends_on: list of pipelines that must have succeeded before this pipeline can start. - Defaults to []. - environment: environment variables passed through to pipeline steps. - Defaults to None. - volumes: additional volumes available to be mounted by pipeline steps. - Defaults to []. - - Returns: - Drone pipeline - """ - if platform != "windows": - platform_conf = { - "platform": {"os": "linux", "arch": "amd64"}, - # A shared cache is used on the host - # To avoid issues with parallel builds, we run this repo on single build agents - "node": {"type": "no-parallel"}, - } - else: - platform_conf = { - "platform": { - "os": "windows", - "arch": "amd64", - "version": "1809", - }, - } - - docker_mount_path = "/var/run/docker.sock" - if platform == "windows": - docker_mount_path = "//./pipe/docker_engine/" - - pipeline = { - "kind": "pipeline", - "type": "docker", - "name": name, - "trigger": trigger, - "services": services, - "steps": steps, - "clone": { - "retries": 3, - }, - "volumes": [ - { - "name": "docker", - "host": { - "path": docker_mount_path, - }, - }, - ], - "depends_on": depends_on, - "image_pull_secrets": [gcr_pull_secret, gar_pull_secret], - } - if environment: - pipeline.update( - { - "environment": environment, - }, - ) - - pipeline["volumes"].extend(volumes) - pipeline.update(platform_conf) - - return pipeline - -def notify_pipeline( - name, - slack_channel, - trigger, - depends_on = [], - template = None, - secret = None): - trigger = dict(trigger) - return { - "kind": "pipeline", - "type": "docker", - "platform": { - "os": "linux", - "arch": "amd64", - }, - "name": name, - "trigger": trigger, - "steps": [ - slack_step(slack_channel, template, secret), - ], - "clone": { - "retries": 3, - }, - "depends_on": depends_on, - } - -# TODO: this overrides any existing dependencies because we're following the existing logic -# it should append to any existing dependencies -def with_deps(steps, deps = []): - for step in steps: - step["depends_on"] = deps - return steps - -def ignore_failure(steps): - for step in steps: - step["failure"] = "ignore" - return steps diff --git a/scripts/drone/variables.star b/scripts/drone/variables.star deleted file mode 100644 index 7c45f17b75f..00000000000 --- a/scripts/drone/variables.star +++ /dev/null @@ -1,10 +0,0 @@ -""" -global variables -""" - -grabpl_version = "v3.1.2" -golang_version = "1.24.6" - -# nodejs_version should match what's in ".nvmrc", but without the v prefix. -nodejs_version = "22.16.0" -dagger_version = "v0.18.8" diff --git a/scripts/drone/vault.star b/scripts/drone/vault.star deleted file mode 100644 index 05f3617d01f..00000000000 --- a/scripts/drone/vault.star +++ /dev/null @@ -1,166 +0,0 @@ -""" -This module returns functions for generating Drone secrets fetched from Vault. -""" -gcr_pull_secret = "gcr" -gar_pull_secret = "gar" -drone_token = "drone_token" -prerelease_bucket = "prerelease_bucket" -gcp_upload_artifacts_key = "gcp_upload_artifacts_key" -gcp_grafanauploads = "gcp_grafanauploads" -gcp_grafanauploads_base64 = "gcp_grafanauploads_base64" -gcp_download_build_container_assets_key = "gcp_download_build_container_assets_key" - -azure_sp_app_id = "azure_sp_app_id" -azure_sp_app_pw = "azure_sp_app_pw" -azure_tenant = "azure_tenant" - -github_app_app_id = "github-app-app-id" -github_app_app_installation_id = "github-app-installation-id" -github_app_private_key = "github-app-private-key" - -rgm_gcp_key_base64 = "gcp_key_base64" -rgm_destination = "destination" -rgm_storybook_destination = "rgm_storybook_destination" -rgm_cdn_destination = "rgm_cdn_destination" -rgm_downloads_destination = "rgm_downloads_destination" -rgm_dagger_token = "dagger_token" - -docker_username = "docker_username" -docker_password = "docker_password" - -npm_token = "npm_token" - -def from_secret(secret): - return {"from_secret": secret} - -def vault_secret(name, path, key): - return { - "kind": "secret", - "name": name, - "get": { - "path": path, - "name": key, - }, - } - -def secrets(): - return [ - vault_secret(github_app_app_id, "ci/data/repo/grafana/grafana/github-app", "app-id"), - vault_secret(github_app_app_installation_id, "ci/data/repo/grafana/grafana/github-app", "app-installation-id"), - vault_secret(github_app_private_key, "ci/data/repo/grafana/grafana/github-app", "private-key"), - vault_secret(gcp_grafanauploads, "infra/data/ci/grafana-release-eng/grafanauploads", "credentials.json"), - vault_secret(gcp_grafanauploads_base64, "infra/data/ci/grafana-release-eng/grafanauploads", "credentials_base64"), - vault_secret("grafana_api_key", "infra/data/ci/grafana-release-eng/grafanacom", "api_key"), - vault_secret(gcr_pull_secret, "secret/data/common/gcr", ".dockerconfigjson"), - vault_secret(gar_pull_secret, "secret/data/common/gar", ".dockerconfigjson"), - vault_secret(drone_token, "infra/data/ci/drone", "machine-user-token"), - vault_secret(prerelease_bucket, "infra/data/ci/grafana/prerelease", "bucket"), - vault_secret(docker_username, "ci/data/common/dockerhub", "username"), - vault_secret(docker_password, "ci/data/common/dockerhub", "password"), - vault_secret( - gcp_upload_artifacts_key, - "infra/data/ci/grafana/releng/artifacts-uploader-service-account", - "credentials.json", - ), - vault_secret( - gcp_download_build_container_assets_key, - "infra/data/ci/grafana/assets-downloader-build-container-service-account", - "credentials.json", - ), - vault_secret( - azure_sp_app_id, - "infra/data/ci/datasources/cpp-azure-resourcemanager-credentials", - "application_id", - ), - vault_secret( - azure_sp_app_pw, - "infra/data/ci/datasources/cpp-azure-resourcemanager-credentials", - "application_secret", - ), - vault_secret( - azure_tenant, - "infra/data/ci/datasources/cpp-azure-resourcemanager-credentials", - "tenant_id", - ), - vault_secret( - npm_token, - "infra/data/ci/grafana-release-eng/npm", - "token", - ), - # Package publishing - vault_secret( - "packages_gpg_public_key", - "infra/data/ci/packages-publish/gpg", - "public-key-b64", - ), - vault_secret( - "packages_gpg_private_key", - "infra/data/ci/packages-publish/gpg", - "private-key-b64", - ), - vault_secret( - "packages_gpg_passphrase", - "infra/data/ci/packages-publish/gpg", - "passphrase", - ), - vault_secret( - "packages_service_account", - "infra/data/ci/packages-publish/service-account", - "credentials.json", - ), - vault_secret( - "packages_access_key_id", - "infra/data/ci/packages-publish/bucket-credentials", - "AccessID", - ), - vault_secret( - "packages_secret_access_key", - "infra/data/ci/packages-publish/bucket-credentials", - "Secret", - ), - vault_secret( - "static_asset_editions", - "infra/data/ci/grafana-release-eng/artifact-publishing", - "static_asset_editions", - ), - vault_secret( - rgm_gcp_key_base64, - "infra/data/ci/grafana-release-eng/rgm", - "gcp_service_account_prod_base64", - ), - vault_secret( - rgm_destination, - "infra/data/ci/grafana-release-eng/rgm", - "destination_prod", - ), - vault_secret( - rgm_storybook_destination, - "infra/data/ci/grafana-release-eng/rgm", - "storybook_destination", - ), - vault_secret( - rgm_cdn_destination, - "infra/data/ci/grafana-release-eng/rgm", - "cdn_destination", - ), - vault_secret( - rgm_downloads_destination, - "infra/data/ci/grafana-release-eng/rgm", - "downloads_destination", - ), - vault_secret( - rgm_dagger_token, - "infra/data/ci/grafana-release-eng/rgm", - "dagger_token", - ), - vault_secret( - "delivery-bot-app-private-key", - "ci/data/repo/grafana/grafana/delivery-bot-app", - "PRIVATE_KEY", - ), - vault_secret( - "gcr_credentials", - "secret/data/common/gcr", - "service-account", - ), - ] diff --git a/scripts/drone/verify-grafanacom.sh b/scripts/drone/verify-grafanacom.sh deleted file mode 100755 index b2950f8529c..00000000000 --- a/scripts/drone/verify-grafanacom.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -version=${1:-$TAG} - -# Construct the URL based on the provided version and edition -if [ "$EDITION" = "enterprise" ]; then - url="https://grafana.com/api/downloads/grafana-enterprise/versions/$version" -else - url="https://grafana.com/api/downloads/grafana/versions/$version" -fi - -# Make a request to the GCOM API to retrieve the artifacts for the specified version. Exit if the request fails. -if ! artifacts=$(curl "$url"); then - echo "Failed to retrieve artifact URLs from Grafana.com API. Please check the API key, authentication, edition, and version." - exit 1 -fi - -# Use Node.js to parse the JSON response and extract the download URLs -url_string=$(node -e " - const artifacts = JSON.parse(JSON.stringify($artifacts)); - const downloadUrls = artifacts.packages.map((package) => package.links.find((link) => link.rel === 'download').href); - console.log(downloadUrls.join(' ')); -") - -# Convert the url_string to a Bash array -read -r -a urls <<< "$url_string" - -# If empty, no artifact URLs were found for the specified version. Exit with an error. -if [ ${#urls[@]} -eq 0 ]; then - echo "No artifact URLs found for version $version. Please check the provided version." - exit 1 -fi - -# Iterate over the URLs and check the status code of each. If any URL does not return a 200 status code, add it to the failed_urls string. -failed_urls="" -for url in "${urls[@]}"; do - status_code=$(curl -L -s -o /dev/null -w "%{http_code}" "$url") - if [ "$status_code" -ne 200 ]; then - failed_urls+="$url\n" - fi -done - -# If any URLs failed, print them and exit with an error. -if [ -n "$failed_urls" ]; then - echo "The following URLs did not return a 200 status code:" - echo "$failed_urls" - exit 1 -else - echo "All URLs returned a 200 status code. Download links are valid for version $version." - exit 0 -fi