Skip to content

Commit

Permalink
Add Drone PR checks back, fix issue with GitHub Actions tests (#2708)
Browse files Browse the repository at this point in the history
* Revert "Remove unnecessary Done builds. (#2695)"

This reverts commit c990e48.

* Fix issue with running all tests on GH Actions
  • Loading branch information
ptodev authored Feb 12, 2025
1 parent c30fbed commit 6f7fa9e
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local pipelines = import './pipelines.jsonnet';

(import 'pipelines/test.jsonnet') +
(import 'pipelines/check_containers.jsonnet') +
(import 'pipelines/crosscompile.jsonnet') +
(import 'pipelines/publish.jsonnet') +
(import 'util/secrets.jsonnet').asList
238 changes: 237 additions & 1 deletion .drone/drone.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
---
kind: pipeline
name: Lint
platform:
arch: amd64
os: linux
steps:
- commands:
- apt-get update -y && apt-get install -y libsystemd-dev
- make lint
image: grafana/alloy-build-image:v0.1.8
name: Lint
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Test
platform:
arch: amd64
os: linux
steps:
- commands:
- make GO_TAGS="nodocker" test
image: grafana/alloy-build-image:v0.1.8
name: Run Go tests
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Test (Full)
platform:
arch: amd64
os: linux
steps:
- commands:
- K8S_USE_DOCKER_NETWORK=1 make test
image: grafana/alloy-build-image:v0.1.8
name: Run Go tests
volumes:
- name: docker
path: /var/run/docker.sock
trigger:
ref:
- refs/heads/main
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
kind: pipeline
name: Test (Windows)
platform:
arch: amd64
os: windows
version: "1809"
steps:
- commands:
- '& "C:/Program Files/git/bin/bash.exe" -c ''go test -tags="nodocker,nonetwork"
./...'''
image: grafana/alloy-build-image:v0.1.8-windows
name: Run Go tests
trigger:
ref:
- refs/heads/main
type: docker
---
kind: pipeline
name: Check Linux container (grafana/alloy)
platform:
arch: amd64
Expand Down Expand Up @@ -51,6 +121,172 @@ volumes:
name: docker
---
kind: pipeline
name: Build alloy (Linux amd64)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM=
make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Linux arm64)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM=
make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Linux ppc64le)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM=
make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Linux s390x)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM=
make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (macOS Intel)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (macOS Apple Silicon)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Windows amd64)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (FreeBSD amd64)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make alloy
image: grafana/alloy-build-image:v0.1.8
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Linux amd64 boringcrypto)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM=
GOEXPERIMENT=boringcrypto make alloy
image: grafana/alloy-build-image:v0.1.8-boringcrypto
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Build alloy (Linux arm64 boringcrypto)
platform:
arch: amd64
os: linux
steps:
- commands:
- make generate-ui
- GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM=
GOEXPERIMENT=boringcrypto make alloy
image: grafana/alloy-build-image:v0.1.8-boringcrypto
name: Build
trigger:
event:
- pull_request
type: docker
---
kind: pipeline
name: Publish Windows alloy-devel container
platform:
arch: amd64
Expand Down Expand Up @@ -343,6 +579,6 @@ kind: secret
name: updater_private_key
---
kind: signature
hmac: a856a4590fb1229d9a5f749671c3c075cdc91631704f14a321f5d03aa2a53e2f
hmac: 26b5613cbd5e5cd42656c10c372d44dc93af565ec2ae212d3b27c2fe366c6aeb

...
77 changes: 77 additions & 0 deletions .drone/pipelines/crosscompile.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
local build_image = import '../util/build_image.jsonnet';
local pipelines = import '../util/pipelines.jsonnet';

local go_tags = {
linux: 'builtinassets promtail_journal_enabled',
windows: 'builtinassets',
darwin: 'builtinassets',
freebsd: 'builtinassets',
};

local os_arch_tuples = [
// Linux
{ name: 'Linux amd64', os: 'linux', arch: 'amd64' },
{ name: 'Linux arm64', os: 'linux', arch: 'arm64' },
{ name: 'Linux ppc64le', os: 'linux', arch: 'ppc64le' },
{ name: 'Linux s390x', os: 'linux', arch: 's390x' },

// Darwin
{ name: 'macOS Intel', os: 'darwin', arch: 'amd64' },
{ name: 'macOS Apple Silicon', os: 'darwin', arch: 'arm64' },

// Windows
{ name: 'Windows amd64', os: 'windows', arch: 'amd64' },


// FreeBSD
{ name: 'FreeBSD amd64', os: 'freebsd', arch: 'amd64' },
];


local targets = [
'alloy',
];
local targets_boringcrypto = [
'alloy',
];


local os_arch_types_boringcrypto = [
// Linux boringcrypto
{ name: 'Linux amd64 boringcrypto', os: 'linux', arch: 'amd64', experiment: 'boringcrypto' },
{ name: 'Linux arm64 boringcrypto', os: 'linux', arch: 'arm64', experiment: 'boringcrypto' },
];

local build_environments(targets, tuples, image) = std.flatMap(function(target) (
std.map(function(platform) (
pipelines.linux('Build %s (%s)' % [target, platform.name]) {
local env = {
GOOS: platform.os,
GOARCH: platform.arch,
GOARM: if 'arm' in platform then platform.arm else '',

target: target,

tags: go_tags[platform.os],
} + (if 'experiment' in platform then { GOEXPERIMENT: platform.experiment } else {}),

trigger: {
event: ['pull_request'],
},

steps: [{
name: 'Build',
image: image,
commands: [
'make generate-ui',
(if 'GOEXPERIMENT' in env
then 'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s GOEXPERIMENT=%(GOEXPERIMENT)s make %(target)s' % env
else 'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s make %(target)s') % env,
],
}],
}
), tuples)
), targets);

build_environments(targets, os_arch_tuples, build_image.linux) +
build_environments(targets_boringcrypto, os_arch_types_boringcrypto, build_image.boringcrypto)
Loading

0 comments on commit 6f7fa9e

Please sign in to comment.