Skip to content

Commit

Permalink
Build: simplify how protos are built (#4639)
Browse files Browse the repository at this point in the history
* we always seem to be chasing our tails with how protos are generated and Makes use of timestamps to determine if files should be recompiled. Instead of touching files and altering timestamps always delete the compiled proto files when calling `protos` to make sure they are compiled every time.

Removed targets to build protos, yaccs, and ragel files when trying to build loki or the canary. This isn't necesary, if you are changing these files you would know you need to build them and the `check-generated-files` should catch any changes to them not committed.

* rm -rf

* we have a race between check-generated-files and our other steps, so let that run first.

also removing `check-generated-files` from the `all` target because its redundant with a separate step and could also race with the parallel lint

* remove TOUCH_PROTOS

* more cleanup of TOUCH_PROTOS
  • Loading branch information
slim-bean authored Nov 4, 2021
1 parent c8f3df3 commit 2ac409c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 112 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ jobs:
steps:
- checkout
- setup_remote_docker
- run:
name: touch-protos
command: make touch-protos
- run:
name: build
command: make GOOS=windows GOGC=10 promtail
Expand Down
18 changes: 5 additions & 13 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,14 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) {
when: condition('exclude').tagMain,
settings+: {
dry_run: true,
build_args: ['TOUCH_PROTOS=1'],
},
},
] + [
// publish for tag or main
clients_docker(arch, 'promtail') {
depends_on: ['image-tag'],
when: condition('include').tagMain,
settings+: {
build_args: ['TOUCH_PROTOS=1'],
},
settings+: {},
},
],
depends_on: ['check'],
Expand Down Expand Up @@ -249,9 +246,7 @@ local lambda_promtail(tags='') = pipeline('lambda-promtail'){
lambda_promtail_ecr('lambda-promtail') {
depends_on: ['image-tag'],
when: condition('include').tagMain,
settings+: {
build_args: ['TOUCH_PROTOS=1'],
},
settings+: {},
},
],
depends_on: ['check'],
Expand All @@ -265,7 +260,6 @@ local multiarch_image(arch) = pipeline('docker-' + arch) + arch_image(arch) {
when: condition('exclude').tagMain,
settings+: {
dry_run: true,
build_args: ['TOUCH_PROTOS=1'],
},
}
for app in apps
Expand All @@ -274,9 +268,7 @@ local multiarch_image(arch) = pipeline('docker-' + arch) + arch_image(arch) {
docker(arch, app) {
depends_on: ['image-tag'],
when: condition('include').tagMain,
settings+: {
build_args: ['TOUCH_PROTOS=1'],
},
settings+: {},
}
for app in apps
],
Expand Down Expand Up @@ -323,9 +315,9 @@ local manifest(apps) = pipeline('manifest') {
path: 'loki',
},
steps: [
make('test', container=false) { depends_on: ['clone'] },
make('lint', container=false) { depends_on: ['clone'] },
make('check-generated-files', container=false) { depends_on: ['clone'] },
make('test', container=false) { depends_on: ['clone','check-generated-files'] },
make('lint', container=false) { depends_on: ['clone','check-generated-files'] },
make('check-mod', container=false) { depends_on: ['clone', 'test', 'lint'] },
{
name: 'shellcheck',
Expand Down
66 changes: 9 additions & 57 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ kind: pipeline
name: check
steps:
- commands:
- make BUILD_IN_CONTAINER=false test
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
image: grafana/loki-build-image:0.18.0
name: test
name: check-generated-files
- commands:
- make BUILD_IN_CONTAINER=false lint
- make BUILD_IN_CONTAINER=false test
depends_on:
- clone
- check-generated-files
image: grafana/loki-build-image:0.18.0
name: lint
name: test
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
- make BUILD_IN_CONTAINER=false lint
depends_on:
- clone
- check-generated-files
image: grafana/loki-build-image:0.18.0
name: check-generated-files
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
depends_on:
Expand Down Expand Up @@ -73,8 +75,6 @@ steps:
image: plugins/docker
name: build-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: true
password:
Expand All @@ -93,8 +93,6 @@ steps:
image: plugins/docker
name: build-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: true
password:
Expand All @@ -113,8 +111,6 @@ steps:
image: plugins/docker
name: build-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
Expand All @@ -133,8 +129,6 @@ steps:
image: plugins/docker
name: publish-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: false
password:
Expand All @@ -153,8 +147,6 @@ steps:
image: plugins/docker
name: publish-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: false
password:
Expand All @@ -173,8 +165,6 @@ steps:
image: plugins/docker
name: publish-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: false
password:
Expand Down Expand Up @@ -208,8 +198,6 @@ steps:
image: plugins/docker
name: build-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: true
password:
Expand All @@ -228,8 +216,6 @@ steps:
image: plugins/docker
name: build-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: true
password:
Expand All @@ -248,8 +234,6 @@ steps:
image: plugins/docker
name: build-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
Expand All @@ -268,8 +252,6 @@ steps:
image: plugins/docker
name: publish-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: false
password:
Expand All @@ -288,8 +270,6 @@ steps:
image: plugins/docker
name: publish-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: false
password:
Expand All @@ -308,8 +288,6 @@ steps:
image: plugins/docker
name: publish-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: false
password:
Expand Down Expand Up @@ -343,8 +321,6 @@ steps:
image: plugins/docker
name: build-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: true
password:
Expand All @@ -363,8 +339,6 @@ steps:
image: plugins/docker
name: build-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: true
password:
Expand All @@ -383,8 +357,6 @@ steps:
image: plugins/docker
name: build-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: true
password:
Expand All @@ -403,8 +375,6 @@ steps:
image: plugins/docker
name: publish-loki-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki/Dockerfile
dry_run: false
password:
Expand All @@ -423,8 +393,6 @@ steps:
image: plugins/docker
name: publish-loki-canary-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/loki-canary/Dockerfile
dry_run: false
password:
Expand All @@ -443,8 +411,6 @@ steps:
image: plugins/docker
name: publish-logcli-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: cmd/logcli/Dockerfile
dry_run: false
password:
Expand Down Expand Up @@ -478,8 +444,6 @@ steps:
image: plugins/docker
name: build-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile
dry_run: true
password:
Expand All @@ -498,8 +462,6 @@ steps:
image: plugins/docker
name: publish-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile
dry_run: false
password:
Expand Down Expand Up @@ -533,8 +495,6 @@ steps:
image: plugins/docker
name: build-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile
dry_run: true
password:
Expand All @@ -553,8 +513,6 @@ steps:
image: plugins/docker
name: publish-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile
dry_run: false
password:
Expand Down Expand Up @@ -588,8 +546,6 @@ steps:
image: plugins/docker
name: build-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile.arm32
dry_run: true
password:
Expand All @@ -608,8 +564,6 @@ steps:
image: plugins/docker
name: publish-promtail-image
settings:
build_args:
- TOUCH_PROTOS=1
dockerfile: clients/cmd/promtail/Dockerfile.arm32
dry_run: false
password:
Expand Down Expand Up @@ -925,8 +879,6 @@ steps:
settings:
access_key:
from_secret: ecr_key
build_args:
- TOUCH_PROTOS=1
dockerfile: tools/lambda-promtail/Dockerfile
dry_run: false
region: us-east-1
Expand Down Expand Up @@ -984,6 +936,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: 55440faa2728a5b8abbd213c2cf198e01f00201ba7143391924da1b9aa02c350
hmac: b51ec8dfc84d0be83827fc851b21b81e1091886be480d675f51485b647e58001

...
Loading

0 comments on commit 2ac409c

Please sign in to comment.