diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 5e8d8c21..00000000 --- a/.drone.yml +++ /dev/null @@ -1,341 +0,0 @@ ---- -image_pull_secrets: -- docker_config_json -kind: pipeline -name: build -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine - name: runner identification -- commands: - - make deps - - ./scripts/enforce-clean - depends_on: - - runner identification - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: deps -- commands: - - make lint - depends_on: - - deps - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: lint -- commands: - - git fetch origin --tags - - git status --porcelain --untracked-files=no - - git diff --no-ext-diff --quiet - - ./scripts/version - - ./scripts/generate-tags > .tags - - make build - depends_on: - - deps - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: build -- commands: - - make test - depends_on: - - lint - - build - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: test -- commands: [] - depends_on: - - build - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker build (linux/amd64) - settings: - build_args: - - TARGETPLATFORM=linux/amd64 - - TARGETOS=linux - - TARGETARCH=amd64 - dry_run: "true" - repo: grafana/synthetic-monitoring-agent - target: release -- commands: [] - depends_on: - - build - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker build (linux/arm64/v8) - settings: - build_args: - - TARGETPLATFORM=linux/arm64/v8 - - TARGETOS=linux - - TARGETARCH=arm64 - - TARGETVARIANT=v8 - dry_run: "true" - repo: grafana/synthetic-monitoring-agent - target: release -- commands: [] - depends_on: - - build - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker build (with browser) (linux/amd64) - settings: - build_args: - - TARGETPLATFORM=linux/amd64 - - TARGETOS=linux - - TARGETARCH=amd64 - dry_run: "true" - repo: grafana/synthetic-monitoring-agent - target: with-browser -- commands: - - "true" - depends_on: - - docker build (linux/amd64) - - docker build (with browser) (linux/amd64) - - docker build (linux/arm64/v8) - image: alpine - name: docker build -- commands: [] - depends_on: - - test - - docker build - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker publish to gcr.io (linux/amd64) - settings: - config: - from_secret: docker_config_json - dry_run: "false" - repo: us.gcr.io/kubernetes-dev/synthetic-monitoring-agent - target: release - when: - ref: - - refs/heads/main - - refs/tags/v*.*.* -- commands: [] - depends_on: - - test - - docker build - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker publish to docker (linux/amd64) - settings: - dry_run: "false" - password: - from_secret: docker_password - repo: grafana/synthetic-monitoring-agent - target: release - username: - from_secret: docker_username - when: - ref: - - refs/tags/v*.*.* -- commands: - - "true" - depends_on: - - docker publish to gcr.io (linux/amd64) - image: alpine - name: docker publish (dev) - when: - ref: - - refs/heads/main - - refs/tags/v*.*.* -- commands: - - "true" - depends_on: - - docker publish to gcr.io (linux/amd64) - - docker publish to docker (linux/amd64) - image: alpine - name: docker publish (release) - when: - ref: - - refs/tags/v*.*.* -- commands: - - ./scripts/generate-tags browser > .tags - depends_on: - - docker publish (release) - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: docker publish (with browser) tags -- commands: [] - depends_on: - - docker publish (with browser) tags - environment: - DOCKER_BUILDKIT: "1" - image: plugins/docker - name: docker publish (with browser) to docker (linux/amd64) - settings: - dry_run: "false" - password: - from_secret: docker_password - repo: grafana/synthetic-monitoring-agent - target: with-browser - username: - from_secret: docker_username - when: - ref: - - refs/tags/v*.*.* -- commands: - - "true" - depends_on: - - docker publish (with browser) to docker (linux/amd64) - image: alpine - name: docker publish (with browser) (release) - when: - ref: - - refs/tags/v*.*.* -- commands: [] - depends_on: - - docker publish (release) - image: us.gcr.io/kubernetes-dev/drone/plugins/argo-cli - name: trigger argo workflow (release) - settings: - add_ci_labels: true - command: 'submit --from workflowtemplate/deploy-synthetic-monitoring-agent --name - deploy-synthetic-monitoring-agent-release-$(./scripts/version) --parameter mode=release - --parameter dockertag=$(./scripts/version) --parameter commit=${DRONE_COMMIT} - --parameter commit_author=${DRONE_COMMIT_AUTHOR} --parameter commit_link=${DRONE_COMMIT_LINK} ' - namespace: synthetic-monitoring-cd - token: - from_secret: argo_token - when: - ref: - - refs/tags/v*.*.* -trigger: - ref: - - refs/heads/main - - refs/pull/** - - refs/tags/v*.*.* -type: docker ---- -image_pull_secrets: -- docker_config_json -kind: pipeline -name: release -services: -- image: jrei/systemd-debian:12 - name: systemd-debian - privileged: true - volumes: - - name: cgroup - path: /sys/fs/cgroup -- image: jrei/systemd-centos:8 - name: systemd-centos - privileged: true - volumes: - - name: cgroup - path: /sys/fs/cgroup -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine - name: runner identification -- commands: - - git fetch --tags - image: docker:git - name: fetch -- commands: - - printf "%s" "$NFPM_SIGNING_KEY" > $NFPM_SIGNING_KEY_FILE - environment: - NFPM_SIGNING_KEY: - from_secret: gpg_private_key - NFPM_SIGNING_KEY_FILE: /drone/src/release-private-key.key - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: write-key -- commands: - - make release-snapshot - environment: - NFPM_DEFAULT_PASSPHRASE: - from_secret: gpg_passphrase - NFPM_SIGNING_KEY_FILE: /drone/src/release-private-key.key - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: test release -- commands: - - ./scripts/package/verify-deb-install.sh - image: docker - name: test deb package - privileged: true - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - ./scripts/package/verify-rpm-install.sh - image: docker - name: test rpm package - privileged: true - volumes: - - name: docker - path: /var/run/docker.sock -- commands: - - make release - environment: - GITHUB_TOKEN: - from_secret: gh_token - NFPM_DEFAULT_PASSPHRASE: - from_secret: gpg_passphrase - NFPM_SIGNING_KEY_FILE: /drone/src/release-private-key.key - image: ghcr.io/grafana/grafana-build-tools:v0.31.1 - name: release - when: - ref: - - refs/tags/v*.*.* -trigger: - ref: - - refs/pull/** - - refs/tags/v*.*.* - repo: - - grafana/* -type: docker -volumes: -- host: - path: /sys/fs/cgroup - name: cgroup -- host: - path: /var/run/docker.sock - name: docker ---- -get: - name: username - path: infra/data/ci/docker_hub -kind: secret -name: docker_username ---- -get: - name: password - path: infra/data/ci/docker_hub -kind: secret -name: docker_password ---- -get: - name: .dockerconfigjson - path: infra/data/ci/gcr-admin -kind: secret -name: docker_config_json ---- -get: - name: token - path: infra/data/ci/argo-workflows/trigger-service-account -kind: secret -name: argo_token ---- -get: - name: pat - path: infra/data/ci/github/grafanabot -kind: secret -name: gh_token ---- -get: - name: passphrase - path: infra/data/ci/packages-publish/gpg -kind: secret -name: gpg_passphrase ---- -get: - name: private-key - path: infra/data/ci/packages-publish/gpg -kind: secret -name: gpg_private_key ---- -kind: signature -hmac: ebba11ba346f14c3e83c6ed062a09e816f74e904269e3191d9863961f86c27d8 - -... diff --git a/README.md b/README.md index 6cb27d27..cd4f837c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://drone.grafana.net/api/badges/grafana/synthetic-monitoring-agent/status.svg)](https://drone.grafana.net/grafana/synthetic-monitoring-agent) +[![Build Status](https://github.com/grafana/synthetic-monitoring-agent/actions/workflows/build_and_publish_main.yaml/badge.svg)](https://github.com/grafana/synthetic-monitoring-agent/actions/workflows/build_and_publish_main.yaml) [![go.mod Go version](https://img.shields.io/github/go-mod/go-version/grafana/synthetic-monitoring-agent.svg)](https://github.com/grafana/synthetic-monitoring-agent) [![Go Report Card](https://goreportcard.com/badge/github.com/grafana/synthetic-monitoring-agent)](https://goreportcard.com/report/github.com/grafana/synthetic-monitoring-agent) [![Go Reference](https://pkg.go.dev/badge/github.com/grafana/synthetic-monitoring-agent.svg)](https://pkg.go.dev/github.com/grafana/synthetic-monitoring-agent) diff --git a/scripts/configs/drone/README.md b/scripts/configs/drone/README.md deleted file mode 100644 index 09eb213e..00000000 --- a/scripts/configs/drone/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Drone's Configuration - -The configuration is signed to prevent tampering from non-Grafana employees ([ref](https://github.com/grafana/deployment_tools/blob/master/docs/platform/drone/signing.md)). - -To modify the Drone definition: - -1. Modify the `drone.jsonnet` file. The `drone.yml` file is generated -2. [Export your Drone token here](https://drone.grafana.net/account) -3. Generate with the `make drone` command diff --git a/scripts/configs/drone/go-tools-image.libsonnet b/scripts/configs/drone/go-tools-image.libsonnet deleted file mode 100644 index f3bc9da1..00000000 --- a/scripts/configs/drone/go-tools-image.libsonnet +++ /dev/null @@ -1 +0,0 @@ -'ghcr.io/grafana/grafana-build-tools:v0.31.1' diff --git a/scripts/configs/drone/main.jsonnet b/scripts/configs/drone/main.jsonnet deleted file mode 100644 index 9a4dfcc5..00000000 --- a/scripts/configs/drone/main.jsonnet +++ /dev/null @@ -1,359 +0,0 @@ -local go_tools_image = (import 'go-tools-image.libsonnet'); - -local step(name, commands, image=go_tools_image) = { - name: name, - commands: commands, - image: image, -}; - -local pipeline(name, steps=[]) = { - kind: 'pipeline', - type: 'docker', - name: name, - image_pull_secrets: [ 'docker_config_json' ], - steps: [ step('runner identification', [ 'echo $DRONE_RUNNER_NAME' ], 'alpine') ] + steps, - trigger+: { - ref+: [ - 'refs/heads/main', - 'refs/pull/**', - 'refs/tags/v*.*.*', - ], - }, -}; - -local dependsOn(steps=[]) = { - depends_on: steps, -}; - -local releaseOnly = { - when: { - ref+: [ - 'refs/tags/v*.*.*', - ], - }, -}; - -local prOnly = { - when: { event: [ 'pull_request' ] }, -}; - -local devOnly = { - when: { - ref+: [ - 'refs/heads/main', - ], - }, -}; - -local devAndRelease = { - when: { - ref+: [ - 'refs/heads/main', - 'refs/tags/v*.*.*', - ], - }, -}; - -local docker_repo = 'grafana/synthetic-monitoring-agent'; -local gcrio_repo = 'us.gcr.io/kubernetes-dev/synthetic-monitoring-agent'; - -local docker_auth = { - username: { from_secret: 'docker_username' }, - password: { from_secret: 'docker_password' }, -}; - -local grcio_auth = { - config: { from_secret: 'docker_config_json' }, -}; - -local vault_secret(name, vault_path, key) = { - kind: 'secret', - name: name, - get: { - path: vault_path, - name: key, - }, -}; - -local docker_step(tag, os, arch, version='', with_browser=false) = - // We can't use 'make docker' without making this repo priveleged in drone - // so we will use the native docker plugin instead for security. - local platform = std.join('/', [ os, arch, if std.length(version) > 0 then version ]); - step(tag + ' (' + platform + ')', [], 'plugins/docker') - + { - environment: { - DOCKER_BUILDKIT: '1', - }, - settings: { - repo: docker_repo, - dry_run: 'true', - target: if with_browser then 'with-browser' else 'release', - build_args: [ - 'TARGETPLATFORM=' + platform, - 'TARGETOS=' + os, - 'TARGETARCH=' + arch, - ] + if std.length(version) > 0 then [ - 'TARGETVARIANT=' + version, - ] else [], - }, - }; - -local docker_build(os, arch, version='', with_browser=false) = - local step = if with_browser then - 'docker build (with browser)' - else - 'docker build'; - docker_step(step, os, arch, version, with_browser) - + dependsOn([ 'build' ]); - -local docker_publish(repo, auth, tag, os, arch, version='') = - docker_step('docker publish to ' + tag, os, arch, version, false) - + { settings: { repo: repo, dry_run: 'false', target: 'release' } + auth } - + dependsOn([ 'test', 'docker build' ]); - -local docker_publish_with_browser(repo, auth, tag, os, arch) = - docker_step('docker publish (with browser) to ' + tag, os, arch, '', true) - + { settings: { repo: repo, dry_run: 'false', target: 'with-browser' } + auth } - + dependsOn([ 'docker publish (with browser) tags' ]); // step to update .tags file with browser-specific image tags - -[ - pipeline('build', [ - step('deps', [ - 'make deps', - './scripts/enforce-clean', - ]) - + dependsOn([ 'runner identification' ]), - - step( - 'lint', - [ 'make lint' ], - go_tools_image, - ) - + dependsOn([ 'deps' ]), - - step( - 'build', - [ - 'git fetch origin --tags', - 'git status --porcelain --untracked-files=no', - 'git diff --no-ext-diff --quiet', // fail if the workspace has modified files - './scripts/version', - './scripts/generate-tags > .tags', // save version in special file for docker plugin - 'make build', - ], - go_tools_image, - ) - + dependsOn([ 'deps' ]), - - step('test', [ 'make test' ]) - + dependsOn([ 'lint', 'build' ]), - - docker_build('linux', 'amd64'), - docker_build('linux', 'arm64', 'v8'), - - // dry run build with browser - docker_build('linux', 'amd64', '', true), - - step('docker build', [ 'true' ], 'alpine') - + dependsOn([ - 'docker build (linux/amd64)', - 'docker build (with browser) (linux/amd64)', - 'docker build (linux/arm64/v8)', - ]), - - docker_publish(gcrio_repo, grcio_auth, 'gcr.io', 'linux', 'amd64') + devAndRelease, - // docker_publish(gcrio_repo, grcio_auth, 'gcr.io', 'linux', 'arm', 'v7') + devAndRelease, - // docker_publish(gcrio_repo, grcio_auth, 'gcr.io', 'linux', 'arm64', 'v8') + devAndRelease, - - docker_publish(docker_repo, docker_auth, 'docker', 'linux', 'amd64') + releaseOnly, - // docker_publish(docker_repo, docker_auth, 'docker', 'linux', 'arm', 'v7') + releaseOnly, - // docker_publish(docker_repo, docker_auth, 'docker', 'linux', 'arm64', 'v8') + releaseOnly, - - step('docker publish (dev)', [ 'true' ], 'alpine') - + dependsOn([ - 'docker publish to gcr.io (linux/amd64)', - // 'docker publish to gcr.io (linux/arm/v7)', - // 'docker publish to gcr.io (linux/arm64/v8)', - ]) - + devAndRelease, - - step('docker publish (release)', [ 'true' ], 'alpine') - + dependsOn([ - 'docker publish to gcr.io (linux/amd64)', - // 'docker publish to gcr.io (linux/arm/v7)', - // 'docker publish to gcr.io (linux/arm64/v8)', - 'docker publish to docker (linux/amd64)', - // 'docker publish to docker (linux/arm/v7)', - // 'docker publish to docker (linux/arm64/v8)', - ]) - + releaseOnly, - - step( - 'docker publish (with browser) tags', - [ - './scripts/generate-tags browser > .tags', - ], - go_tools_image, - ) - + dependsOn([ 'docker publish (release)' ]), - - // publish image with chromium browser available - docker_publish_with_browser(docker_repo, docker_auth, 'docker', 'linux', 'amd64') + releaseOnly, - - step('docker publish (with browser) (release)', [ 'true' ], 'alpine') - + dependsOn([ - 'docker publish (with browser) to docker (linux/amd64)', - ]) - + releaseOnly, - - // step('trigger argo workflow (dev)', []) - // + { - // settings: { - // namespace: 'synthetic-monitoring-cd', - // token: { from_secret: 'argo_token' }, - // command: std.strReplace(||| - // submit --from workflowtemplate/deploy-synthetic-monitoring-agent - // --name deploy-synthetic-monitoring-agent-dev-$(./scripts/version) - // --parameter mode=dev - // --parameter dockertag=$(./scripts/version) - // --parameter commit=${DRONE_COMMIT} - // --parameter commit_author=${DRONE_COMMIT_AUTHOR} - // --parameter commit_link=${DRONE_COMMIT_LINK} - // |||, '\n', ' '), - // add_ci_labels: true, - // }, - // image: 'us.gcr.io/kubernetes-dev/drone/plugins/argo-cli', - // } - // + dependsOn([ 'docker publish (dev)' ]) - // + devOnly, - - step('trigger argo workflow (release)', []) - + { - settings: { - namespace: 'synthetic-monitoring-cd', - token: { from_secret: 'argo_token' }, - command: std.strReplace(||| - submit --from workflowtemplate/deploy-synthetic-monitoring-agent - --name deploy-synthetic-monitoring-agent-release-$(./scripts/version) - --parameter mode=release - --parameter dockertag=$(./scripts/version) - --parameter commit=${DRONE_COMMIT} - --parameter commit_author=${DRONE_COMMIT_AUTHOR} - --parameter commit_link=${DRONE_COMMIT_LINK} - |||, '\n', ' '), - add_ci_labels: true, - }, - image: 'us.gcr.io/kubernetes-dev/drone/plugins/argo-cli', - } - + dependsOn([ 'docker publish (release)' ]) - + releaseOnly, - - ]), - - // Build and release packages - // Tested in PRs by installing the packages on a systemd container - pipeline('release') + { - trigger: { - event: [ 'tag', 'pull_request' ], - }, - volumes+: [ - { - name: 'cgroup', - host: { - path: '/sys/fs/cgroup', - }, - }, - { - name: 'docker', - host: { - path: '/var/run/docker.sock', - }, - }, - ], - // Launch systemd containers to test the packages - services: [ - { - name: 'systemd-debian', - image: 'jrei/systemd-debian:12', - volumes: [ - { - name: 'cgroup', - path: '/sys/fs/cgroup', - }, - ], - privileged: true, - }, - { - name: 'systemd-centos', - image: 'jrei/systemd-centos:8', - volumes: [ - { - name: 'cgroup', - path: '/sys/fs/cgroup', - }, - ], - privileged: true, - }, - ], - steps+: [ - step('fetch', [ 'git fetch --tags' ], image='docker:git'), - step('write-key', [ 'printf "%s" "$NFPM_SIGNING_KEY" > $NFPM_SIGNING_KEY_FILE' ]) + { - environment: { - NFPM_SIGNING_KEY: { from_secret: 'gpg_private_key' }, - NFPM_SIGNING_KEY_FILE: '/drone/src/release-private-key.key', - }, - }, - step('test release', [ 'make release-snapshot' ]) + { - environment: { - NFPM_DEFAULT_PASSPHRASE: { from_secret: 'gpg_passphrase' }, - NFPM_SIGNING_KEY_FILE: '/drone/src/release-private-key.key', - }, - }, - step('test deb package', [ './scripts/package/verify-deb-install.sh' ], image='docker') + { - volumes: [ - { - name: 'docker', - path: '/var/run/docker.sock', - }, - ], - privileged: true, - }, - step('test rpm package', [ './scripts/package/verify-rpm-install.sh' ], image='docker') + { - volumes: [ - { - name: 'docker', - path: '/var/run/docker.sock', - }, - ], - privileged: true, - }, - step('release', [ 'make release' ]) + releaseOnly + { - environment: { - GITHUB_TOKEN: { from_secret: 'gh_token' }, - NFPM_DEFAULT_PASSPHRASE: { from_secret: 'gpg_passphrase' }, - NFPM_SIGNING_KEY_FILE: '/drone/src/release-private-key.key', - }, - }, - ], - } + { - trigger: { - ref: [ - 'refs/pull/**', - 'refs/tags/v*.*.*', - ], // Only on tags and PRs - repo: [ 'grafana/*' ], // Only trigger this pipeline for the Grafana org (no forks) - }, - }, - - vault_secret('docker_username', 'infra/data/ci/docker_hub', 'username'), - vault_secret('docker_password', 'infra/data/ci/docker_hub', 'password'), - vault_secret('docker_config_json', 'infra/data/ci/gcr-admin', '.dockerconfigjson'), - vault_secret('argo_token', 'infra/data/ci/argo-workflows/trigger-service-account', 'token'), - - // secret needed to publish a Github release - vault_secret('gh_token', 'infra/data/ci/github/grafanabot', 'pat'), - - // secret to sign linux packages - vault_secret('gpg_passphrase', 'infra/data/ci/packages-publish/gpg', 'passphrase'), - vault_secret('gpg_private_key', 'infra/data/ci/packages-publish/gpg', 'private-key'), -] diff --git a/scripts/generate-drone-yaml b/scripts/generate-drone-yaml deleted file mode 100755 index c5e4aa4b..00000000 --- a/scripts/generate-drone-yaml +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -set -e -set -u - -syntax() { - cat <<-EOT -Syntax: - - $0 -EOT -} - -gh_repo_name=$1 -target=$2 -src=${3:-${PWD}/scripts/configs/drone/main.jsonnet} - -test -z "${target}" && syntax && exit 1 - -drone_json=$(mktemp) -drone_yaml=$(mktemp) - -trap 'rm -f "${drone_json}" "${drone_yaml}"' EXIT - -jsonnet \ - --jpath "${PWD}/scripts/configs/drone/vendor" \ - "${src}" > "${drone_json}" -drone jsonnet --stream --format --source "${drone_json}" --target "${drone_yaml}" -drone lint --trusted "${drone_yaml}" -drone sign --save "${gh_repo_name}" "${drone_yaml}" -mv "${drone_yaml}" "${target}" diff --git a/scripts/make/helpers.mk b/scripts/make/helpers.mk index f7854e9d..d95ec6a3 100644 --- a/scripts/make/helpers.mk +++ b/scripts/make/helpers.mk @@ -1,10 +1,5 @@ ##@ Helpers -DRONE_SERVER ?= https://drone.grafana.net - -export DRONE_SERVER -export DRONE_TOKEN - ifeq ($(origin GITIGNORE_GEN),undefined) GITIGNORE_GEN ?= $(ROOTDIR)/scripts/go/bin/gitignore-gen LOCAL_GITIGNORE_GEN = yes @@ -112,45 +107,16 @@ $(ROOTDIR)/pkg/pb/synthetic_monitoring/multihttp_string.go: $(wildcard $(ROOTDIR testdata: ## Update golden files for tests. $(V) $(GO) test -v -run TestValidateMetrics ./internal/scraper -args -update-golden -.PHONY: drone -drone: .drone.yml ## Update drone files - $(S) true - # rwildcard will recursively search for files matching the pattern, e.g. $(call rwildcard, src/*.c) rwildcard = $(call rwildcard_helper, $(dir $1), $(notdir $1)) rwildcard_helper = $(wildcard $(addsuffix $(strip $2), $(strip $1))) \ $(foreach d, $(wildcard $(addsuffix *, $(strip $1))), $(call rwildcard_helper, $d/, $2)) -DRONE_SOURCE_FILES := $(call rwildcard, $(ROOTDIR)/scripts/configs/drone/*.jsonnet) $(call rwildcard, $(ROOTDIR)/scripts/configs/drone/*.libsonnet) - -$(ROOTDIR)/scripts/configs/drone/go-tools-image.libsonnet: $(ROOTDIR)/.gbt.mk - echo '"$(GBT_IMAGE)"' > $@ - -.drone.yml: $(DRONE_SOURCE_FILES) - $(S) echo 'Regenerating $@...' -ifneq ($(origin DRONE_TOKEN),environment) -ifeq ($(origin DRONE_TOKEN),undefined) - $(S) echo 'E: DRONE_TOKEN should set in the environment. Stop.' -else - $(S) echo 'E: DRONE_TOKEN should *NOT* be set in a makefile, set it in the environment. Stop.' -endif - $(S) false -endif - $(V) ./scripts/generate-drone-yaml "$(GH_REPO_NAME)" "$(ROOTDIR)/.drone.yml" "$(ROOTDIR)/scripts/configs/drone/main.jsonnet" - -.PHONY: dronefmt -dronefmt: ## Format drone jsonnet files - $(S) $(foreach src, $(filter-out $(ROOTDIR)/scripts/configs/drone/vendor/%, $(DRONE_SOURCE_FILES)), \ - echo "==== Formatting $(src)" ; \ - jsonnetfmt -i --pretty-field-names --pad-arrays --pad-objects --no-use-implicit-plus "$(src)" ; \ - ) - .PHONY: update-go-version update-go-version: ## Update Go version (specify in go.mod) $(S) echo 'Updating Go version to $(GO_VERSION)...' $(S) cd scripts/go && $(GO) mod edit -go=$(GO_VERSION) $(S) sed -i -e 's,^GO_VERSION=.*,GO_VERSION=$(GO_VERSION),' scripts/docker_build - $(S) $(MAKE) --always-make --no-print-directory .drone.yml S=$(S) V=$(V) .PHONY: help help: ## Display this help. diff --git a/scripts/make/vars.mk b/scripts/make/vars.mk index 9dfc5f58..54698706 100644 --- a/scripts/make/vars.mk +++ b/scripts/make/vars.mk @@ -14,13 +14,11 @@ ifneq ($(strip $(S)),) .SILENT: endif -ifeq ($(strip $(DRONE)),true) +ifeq ($(strip $(CI)),true) # In CI use local tools because those will be provided by the selected docker image. USE_LOCAL_TOOLS := true endif -# TODO(mem): this still needs some thinking because ideally we would fall back -# to building the tools that we need if they are missing. ifeq ($(USE_LOCAL_TOOLS),true) GOLANGCI_LINT := golangci-lint GOTESTSUM := gotestsum