ci: fix accidentally skipped package failures (#13240)

pull/13207/head^2
Trevor Whitney 11 months ago committed by GitHub
parent 932338b319
commit 6f21bc1389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/jsonnetfile.json
  2. 4
      .github/jsonnetfile.lock.json
  3. 2
      .github/vendor/github.com/grafana/loki-release/workflows/release.libsonnet
  4. 203
      .github/vendor/github.com/grafana/loki-release/workflows/validate.libsonnet
  5. 2
      .github/workflows/release.yml
  6. 7
      Makefile

@ -8,7 +8,7 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224"
"version": "adca1c07a2199374e1646e62331926509699368b"
}
],
"legacyImports": true

@ -8,8 +8,8 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224",
"sum": "8wrJURq48ZBAtZcReO1W7AiXmvUyLqb932Q9sXyfFVo="
"version": "adca1c07a2199374e1646e62331926509699368b",
"sum": "/6NMt3DFr1mpaBxncbwBJVV5vBpAMIyP3XNOoFArz5Q="
}
],
"legacyImports": false

@ -176,7 +176,7 @@ local pullRequestFooter = 'Merging this PR will release the [artifacts](https://
step.new('download images')
+ step.withRun(|||
echo "downloading images to $(pwd)/images"
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images .
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/images .
|||),
step.new('publish docker images', './lib/actions/push-images')
+ step.with({

@ -24,15 +24,6 @@ local setupValidationDeps = function(job) job {
smoke_test: '${binary} --version',
tar_args: 'xvf',
}),
step.new('install jsonnetfmt', './lib/actions/install-binary')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.with({
binary: 'jsonnetfmt',
version: '0.18.0',
download_url: 'https://github.com/google/go-jsonnet/releases/download/v${version}/go-jsonnet_${version}_Linux_x86_64.tar.gz',
tarball_binary_path: '${binary}',
smoke_test: '${binary} --version',
}),
] + job.steps,
};
@ -44,45 +35,77 @@ local validationJob = _validationJob(false);
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(common.makeTarget(target)),
test: setupValidationDeps(
validationJob
+ job.withSteps([
validationMakeStep('test', 'test'),
])
),
// Test jobs
collectPackages: job.new()
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
step.new('gather packages')
+ step.withId('gather-tests')
+ step.withRun(|||
echo "packages=$(find . -path '*_test.go' -printf '%h\n' \
| grep -e "pkg/push" -e "integration" -e "operator" -e "lambda-promtail" -e "helm" -v \
| cut -d / -f 2,3 \
| uniq \
| sort \
| jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
|||),
])
+ job.withOutputs({
packages: '${{ steps.gather-tests.outputs.packages }}',
}),
integration: setupValidationDeps(
validationJob
+ job.withSteps([
validationMakeStep('integration', 'test-integration'),
])
),
integration: validationJob
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
validationMakeStep('integration', 'test-integration'),
]),
lint: setupValidationDeps(
validationJob
+ job.withSteps(
[
validationMakeStep('lint', 'lint'),
validationMakeStep('lint jsonnet', 'lint-jsonnet'),
validationMakeStep('lint scripts', 'lint-scripts'),
step.new('check format')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(|||
git fetch origin
make check-format
|||),
] + [
step.new('golangci-lint', 'golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.with({
version: '${{ inputs.golang_ci_lint_version }}',
'only-new-issues': true,
}),
],
)
),
testPackages: validationJob
+ job.withNeeds(['collectPackages'])
+ job.withStrategy({
matrix: {
package: '${{fromJson(needs.collectPackages.outputs.packages)}}',
},
})
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
step.new('test ${{ matrix.package }}')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(|||
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./${{ matrix.package }}/...
|||),
]),
check: setupValidationDeps(
testLambdaPromtail: validationJob
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
step.new('test push package')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withWorkingDirectory('tools/lambda-promtail')
+ step.withRun(|||
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./...
|||),
]),
testPushPackage: validationJob
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
step.new('test push package')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withWorkingDirectory('pkg/push')
+ step.withRun(|||
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./...
|||),
]),
// Check / lint jobs
checkFiles: setupValidationDeps(
validationJob
+ job.withSteps([
validationMakeStep('check generated files', 'check-generated-files'),
@ -115,4 +138,94 @@ local validationJob = _validationJob(false);
],
}
),
faillint:
validationJob
+ job.withSteps([
common.checkout,
common.fixDubiousOwnership,
step.new('faillint')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(|||
faillint -paths "sync/atomic=go.uber.org/atomic" ./...
|||),
]),
golangciLint: setupValidationDeps(
validationJob
+ job.withSteps(
[
step.new('golangci-lint', 'golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.with({
version: '${{ inputs.golang_ci_lint_version }}',
'only-new-issues': true,
}),
],
)
),
lintFiles: setupValidationDeps(
validationJob
+ job.withSteps(
[
validationMakeStep('lint scripts', 'lint-scripts'),
step.new('check format')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(|||
git fetch origin
make check-format
|||),
]
)
),
failCheck: job.new()
+ job.withNeeds([
'checkFiles',
'faillint',
'golangciLint',
'lintFiles',
'integration',
'testLambdaPromtail',
'testPackages',
'testPushPackage',
])
+ job.withEnv({
SKIP_VALIDATION: '${{ inputs.skip_validation }}',
})
+ job.withIf("${{ !fromJSON(inputs.skip_validation) && (cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure')) }}")
+ job.withSteps([
common.checkout,
step.new('verify checks passed')
+ step.withRun(|||
echo "Some checks have failed!"
exit 1,
|||),
]),
check: job.new()
+ job.withNeeds([
'checkFiles',
'faillint',
'golangciLint',
'lintFiles',
'integration',
'testLambdaPromtail',
'testPackages',
'testPushPackage',
])
+ job.withEnv({
SKIP_VALIDATION: '${{ inputs.skip_validation }}',
})
+ job.withSteps([
common.checkout,
step.new('checks passed')
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}')
+ step.withRun(|||
echo "All checks passed"
|||),
]),
}

@ -138,7 +138,7 @@ jobs:
- name: "download images"
run: |
echo "downloading images to $(pwd)/images"
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images .
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/images .
- name: "publish docker images"
uses: "./lib/actions/push-images"
with:

@ -906,6 +906,13 @@ release-workflows:
.PHONY: release-workflows-check
release-workflows-check:
ifeq ($(BUILD_IN_CONTAINER),true)
$(SUDO) docker run $(RM) $(TTY) -i \
-v $(shell go env GOPATH)/pkg:/go/pkg$(MOUNT_FLAGS) \
-v $(shell pwd):/src/loki$(MOUNT_FLAGS) \
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
else
@$(MAKE) release-workflows
@echo "Checking diff"
@git diff --exit-code -- ".github/workflows/*release*" || (echo "Please build release workflows by running 'make release-workflows'" && false)
endif

Loading…
Cancel
Save