Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate bumping brats golang deps #2556

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: go
on: [push, pull_request]

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: src/brats/go.mod
- uses: golangci/golangci-lint-action@v6
with:
working-directory: src/brats/
9 changes: 9 additions & 0 deletions ci/dockerfiles/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM ubuntu:jammy

ARG BOSH_CLI_URL
ARG META4_CLI_URL
ARG GOLANGCI_LINT_INSTALL_URL
ARG YQ_CLI_URL

ARG RUBY_INSTALL_URL
Expand Down Expand Up @@ -84,6 +85,14 @@ RUN meta4_cli_path="/usr/local/bin/meta4" \
> "${meta4_cli_path}" \
&& chmod +x "${meta4_cli_path}"

RUN cd /tmp \
&& golangci_lint_path="/usr/local/bin/golangci-lint" \
&& curl --show-error -sL "${GOLANGCI_LINT_INSTALL_URL}" \
| tar -xzf - \
&& mv golangci-lint-*-linux-amd64/golangci-lint "${golangci_lint_path}" \
&& rm -rf golangci-lint-*-linux-amd64 \
&& chmod +x "${golangci_lint_path}"

RUN yq_cli_path="/usr/local/bin/yq" \
&& curl --show-error -sL "${YQ_CLI_URL}" \
> "${yq_cli_path}" \
Expand Down
3 changes: 3 additions & 0 deletions ci/dockerfiles/integration/build-docker-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ yq_cli_url="$(curl -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" -s https://a
| jq -r '.assets[] | select(.name | endswith ("linux_amd64")) | .browser_download_url')"
ruby_install_url="$(curl -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" -s https://api.github.com/repos/postmodern/ruby-install/releases/latest \
| jq -r '.assets[] | select(.name | endswith ("tar.gz")) | .browser_download_url')"
golangci_lint_install_url="$(curl -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" -s https://api.github.com/repos/golangci/golangci-lint/releases/latest \
| jq -r '.assets[] | select(.name | match("golangci-lint-[0-9]+.[0-9]+.[0-9]+-linux-amd64.tar.gz")) | .browser_download_url')"

uaa_release_url="$(bosh int bosh-deployment/uaa.yml --path /release=uaa/value/url)"
java_install_prefix="/usr/lib/jvm"
Expand All @@ -22,6 +24,7 @@ cat << JSON > docker-build-args/docker-build-args.json
{
"BOSH_CLI_URL": "${bosh_cli_url}",
"META4_CLI_URL": "${meta4_cli_url}",
"GOLANGCI_LINT_INSTALL_URL":"${golangci_lint_install_url}",
"YQ_CLI_URL": "${yq_cli_url}",

"RUBY_INSTALL_URL": "${ruby_install_url}",
Expand Down
32 changes: 32 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ groups:
jobs:
- gate
- bump-deps
- bump-golang-deps
- bump-packages
- unit-common
- unit-core
Expand Down Expand Up @@ -1080,6 +1081,31 @@ jobs:
repository: bosh-src-out
rebase: true

- name: bump-golang-deps
public: true
plan:
- get: weekly
trigger: true
- get: bosh-src
- get: golang-release
- get: integration-image
- task: bump-deps
file: golang-release/ci/tasks/shared/bump-deps.yml
input_mapping:
input_repo: bosh-src
output_mapping:
output_repo: bosh-src-out
params:
SOURCE_PATH: bosh-src/src/brats/
- task: lint-brats
input_mapping:
bosh-src: bosh-src-out
file: bosh-src/ci/tasks/lint-brats.yml
# TODO: uncomment after verifying that this task does what we expect
# - put: bosh-src
# params:
# repository: bosh-src-out

- name: bump-packages
serial: true
plan:
Expand Down Expand Up @@ -1560,6 +1586,12 @@ resources:
branch: main
uri: https://github.com/cloudfoundry/bosh-package-nginx-release.git

- name: golang-release
type: git
source:
uri: https://github.com/cloudfoundry/bosh-package-golang-release.git
branch: main

- name: ruby-release
type: git
source:
Expand Down
6 changes: 6 additions & 0 deletions ci/tasks/lint-brats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eu -o pipefail

cd bosh-src/src/brats/

golangci-lint run ./...
13 changes: 13 additions & 0 deletions ci/tasks/lint-brats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
platform: linux

image_resource:
type: registry-image
source:
repository: bosh/integration

inputs:
- name: bosh-src

run:
path: bosh-src/ci/tasks/lint-brats.sh
11 changes: 11 additions & 0 deletions src/brats/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# https://golangci-lint.run/usage/configuration/
run:
timeout: 3m # 1m default times out on github-action runners

linters:
enable:
- goimports

output:
# Sort results by: filepath, line and column.
sort-results: true
Loading