From 293993ac09791f7e04fe544a988694c30209b60a Mon Sep 17 00:00:00 2001 From: Kat Yang <69819079+yangkb09@users.noreply.github.com> Date: Wed, 31 May 2023 16:57:45 -0400 Subject: [PATCH] CI: Add validate-modfile step in drone (#69232) * chore: test drone step * revert changes to lint_backend_step() * try to add validate_modifle_step * try to run check func * remove CGO and wire-install * update filepath to scripts/modowners * make drone again * correct the filepath * try to ignore validate-modfile step if fail * chore: remove log that says i am a programmer * fix: spell modfile correctly * chore: remove unecessary comment * fix: check go.mod instead of go.txd --- .drone.yml | 12 +++++++++++- scripts/drone/pipelines/lint_backend.star | 2 ++ scripts/drone/steps/lib.star | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 22bcd4e3c0b..33d6c5f8ef0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -427,6 +427,11 @@ steps: CGO_ENABLED: "1" image: golang:1.20.4 name: lint-backend +- commands: + - go run scripts/modowners/modowners.go check go.mod + failure: ignore + image: golang:1.20.4 + name: validate-modfile trigger: event: - pull_request @@ -1429,6 +1434,11 @@ steps: CGO_ENABLED: "1" image: golang:1.20.4 name: lint-backend +- commands: + - go run scripts/modowners/modowners.go check go.mod + failure: ignore + image: golang:1.20.4 + name: validate-modfile - commands: - ./bin/build verify-drone depends_on: @@ -7206,6 +7216,6 @@ kind: secret name: delivery-bot-app-private-key --- kind: signature -hmac: 358fac7d0ab0a53dffe606efc35b060132ca2270407d6b58e06bc9f3415c9e65 +hmac: d1a589fd39357048aa2b6595181f98d17545e184121774b729553e9165464480 ... diff --git a/scripts/drone/pipelines/lint_backend.star b/scripts/drone/pipelines/lint_backend.star index f2605c44598..523b59531f0 100644 --- a/scripts/drone/pipelines/lint_backend.star +++ b/scripts/drone/pipelines/lint_backend.star @@ -9,6 +9,7 @@ load( "identify_runner_step", "lint_backend_step", "lint_drone_step", + "validate_modfile_step", "wire_install_step", ) load( @@ -45,6 +46,7 @@ def lint_backend_pipeline(trigger, ver_mode): test_steps = [ lint_backend_step(), + validate_modfile_step(), ] if ver_mode == "main": diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index cab9190f708..6de8780f8c6 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -364,6 +364,16 @@ def lint_backend_step(): ], } +def validate_modfile_step(): + return { + "name": "validate-modfile", + "image": go_image, + "failure": "ignore", + "commands": [ + "go run scripts/modowners/modowners.go check go.mod", + ], + } + def benchmark_ldap_step(): return { "name": "benchmark-ldap",