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

feat(metricsforwarder): Directly write to Log Cache via Syslog protocol #2913

Merged
merged 131 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
cccf5c8
Add initial files to push metricsforwarder as a cf app via binary
bonzofenix Apr 30, 2024
6390d13
Adds lable 'skip-cleanup to keep the acceptance test deployment alive
bonzofenix Apr 30, 2024
8524512
Uses binary buildpack to deploy
bonzofenix May 1, 2024
ece3e04
Adds metricforwarder makefile for poc deployment
bonzofenix May 1, 2024
8ca4b9c
Remove tls from postgres
bonzofenix May 2, 2024
a6af3ed
Refactor forwarder to support metrics forwardeR
bonzofenix May 6, 2024
03e3fdc
update operations
bonzofenix May 6, 2024
af6c261
Adds sg and updates manifest
bonzofenix May 6, 2024
2ea7495
Refactors loggregator metron emitter
bonzofenix May 6, 2024
d92d179
wip: Adds syslog forwarder
bonzofenix May 6, 2024
8a4ca44
WIP: Syslog implementation for metric forwarder
bonzofenix May 21, 2024
34446f0
More refactor
bonzofenix May 7, 2024
237d8cf
Adds port for syslog server
bonzofenix May 7, 2024
515f886
fix broken test
bonzofenix May 13, 2024
b13f598
Supports syslog via tls
bonzofenix May 13, 2024
cafa396
Change MetricsForwarder references to Emitter
bonzofenix May 14, 2024
7446094
Fix autoscaler deploy
bonzofenix May 14, 2024
b379f31
Makes sed usage compatible both with bsd and unix versions
bonzofenix May 14, 2024
9c107ac
Update gosub in bosh packages
bonzofenix May 14, 2024
92e3d5d
fixes sed apprearences with unix only argument
bonzofenix May 14, 2024
db1a5d8
Revert "Update gosub in bosh packages"
bonzofenix May 21, 2024
a950d75
Revert "fixes sed apprearences with unix only argument"
bonzofenix May 21, 2024
a49f376
Reapply "Update gosub in bosh packages"
bonzofenix May 21, 2024
e053f9f
fix package subs
bonzofenix May 14, 2024
8b1fb9b
Update package specs
bonzofenix May 14, 2024
51e9c0f
pulls loggregator certs from vm
bonzofenix May 14, 2024
21816d5
Defaults to metrics forwarder syslog on bosh release
bonzofenix May 14, 2024
a77f921
Clean mod vendor before mod vendor
bonzofenix May 14, 2024
f4220f9
fix spec for metricforwarder
bonzofenix May 15, 2024
b4e0010
Fix config validation
bonzofenix May 15, 2024
7154e98
Adds missing port for syslog server
bonzofenix May 15, 2024
305eb39
Adds logs
bonzofenix May 16, 2024
1fe0683
Fix emitter selection
bonzofenix May 16, 2024
847dbc8
Adds more logging
bonzofenix May 16, 2024
1617127
Adds port to syslog emitter
bonzofenix May 16, 2024
87d35c9
Adds missing certs
bonzofenix May 21, 2024
35ce9c7
Uses bosh dns to connect to syslog
bonzofenix May 21, 2024
b231df2
Sets certs in the right path
bonzofenix May 21, 2024
833a929
Fix typo
bonzofenix May 21, 2024
a887bbe
chore(deps): update dependency gruntwork-io/terragrunt to v0.58.0
renovate[bot] May 1, 2024
933d3d9
chore(deps): update ginkgo updates to v2.17.2
bonzofenix May 21, 2024
3a6c4a5
🤖🦾🛠️ go mod tidy & make package-specs
bonzofenix May 21, 2024
760bcce
chore(deps): update dependency gruntwork-io/terragrunt to v0.58.2
renovate[bot] May 2, 2024
ad4d37c
fix(deps): update module github.com/onsi/gomega to v1.33.1
renovate[bot] May 3, 2024
0269000
🤖🦾🛠️ go mod tidy & make package-specs
renovate[bot] May 3, 2024
81e4ceb
configure app memory via make
asalan316 Apr 17, 2024
b36cd07
test with 64MB test memory
asalan316 Apr 17, 2024
d9aca93
test with 128MB test memory
asalan316 Apr 18, 2024
71a5c69
remove debug statement
asalan316 May 2, 2024
a90219c
feat! Remove `buildin` mode (#2916)
silvestre May 3, 2024
c846c62
feat(deps): Add `devbox` config (#2914)
silvestre May 3, 2024
05fefaf
feat(direnv): Check if `devbox` is installed before invoking it (#2921)
silvestre May 6, 2024
950eaaf
chore(ci): Restore `use_buildin_mode` false until the next major version
silvestre May 13, 2024
24a8d72
feat(envrc): Automatically eval bbl env
silvestre May 8, 2024
ef3d946
chore(devbox): Add useful tools to devbox
silvestre May 14, 2024
32f92f5
chore(deps): update actions/checkout action to v4.1.5
renovate[bot] May 15, 2024
1bd28f6
fix(operator): Clean up scaling cooldowns
silvestre Apr 29, 2024
fa5c76b
chore(deps): update dependency credhub-cli to v2.9.30
renovate[bot] May 15, 2024
6eced2c
Update golang version to 1.21.5 (#2931)
app-autoscaler-ci-bot May 16, 2024
a35346c
fix(deps): update module github.com/gin-contrib/zap to v1.1.3
renovate[bot] May 15, 2024
c4563b1
🤖🦾🛠️ go mod tidy & make package-specs
renovate[bot] May 15, 2024
58e2a6f
chore(config): migrate config renovate.json
renovate[bot] May 15, 2024
1a5857f
chore(deps): update actions/checkout action to v4.1.6
renovate[bot] May 17, 2024
2ae603b
chore(deps): update dependency golang to v1.22.3
renovate[bot] May 17, 2024
bc61812
chore(deps): update dependency gruntwork-io/terragrunt to v0.58.7
renovate[bot] May 18, 2024
7ad9ff8
chore(deps): update dependency terraform to v1.8.3
renovate[bot] May 18, 2024
02eea37
Fix Linting
bonzofenix May 21, 2024
bfcff62
Does not remove postgres tls from bosh deployment
bonzofenix May 21, 2024
fba9349
Delete src/autoscaler/metricsforwarder/Makefile
bonzofenix May 21, 2024
8ae0682
Delete templates/app-autoscaler.yml
bonzofenix May 21, 2024
ca8d1df
Revert "Delete templates/app-autoscaler.yml"
bonzofenix May 21, 2024
52cd240
Update app-autoscaler.yml
bonzofenix May 21, 2024
13e7fe1
Update app-autoscaler.yml
bonzofenix May 21, 2024
891f58a
Remove unused security group
bonzofenix May 21, 2024
17b8d98
Adds missing dependencies
bonzofenix May 22, 2024
5b8391a
Undo changes from rebase
bonzofenix May 22, 2024
0cab630
Update .tool-versions
bonzofenix May 22, 2024
57eeb60
Undo changes from rebase
bonzofenix May 22, 2024
a4066dd
Update go mods
bonzofenix May 22, 2024
9b055e1
Removes hardcoded hostname in syslog messages
bonzofenix May 22, 2024
33a9212
Fix spec test
bonzofenix May 22, 2024
894aaa7
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 22, 2024
97fc50c
Adds missing package files for metricforwarder
bonzofenix May 22, 2024
754f2c3
Update jobs/metricsforwarder/spec
bonzofenix May 23, 2024
6e743b1
Update src/acceptance/Makefile
bonzofenix May 23, 2024
f02ca0c
Adds credhub mapping for asdf 2 devbox
bonzofenix May 24, 2024
7617857
Refactor ops files
bonzofenix May 24, 2024
5b17d96
Adds correct credhub version
bonzofenix May 24, 2024
a6c9ed1
Remove unused ops file
bonzofenix May 24, 2024
01ef890
Remove unused task
bonzofenix May 24, 2024
8338051
Remove comment
bonzofenix May 24, 2024
8c2917e
Remove unused manifesT
bonzofenix May 24, 2024
60391b7
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 24, 2024
9320a01
Update metricsforwarder spec file
bonzofenix May 24, 2024
c9b4bdf
🤖🦾🛠️ scripts/asdf2devbox.py
bonzofenix May 24, 2024
42b5872
Update src/autoscaler/metricsforwarder/config/config_test.go
bonzofenix May 24, 2024
8739456
Update src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go
bonzofenix May 24, 2024
c1efa5e
Update templates/app-autoscaler.yml
bonzofenix May 24, 2024
0cf0175
Remove gitignore
bonzofenix May 24, 2024
5652f94
Change from context to when in metricsforwarder/forwarder test
bonzofenix May 24, 2024
59a5102
Update src/autoscaler/metricsforwarder/forwarder/metron_emitter.go
bonzofenix May 24, 2024
fbba19e
Update src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go
bonzofenix May 24, 2024
d43bf4c
Update ci Readme
bonzofenix May 24, 2024
9c29de4
Update src/autoscaler/metricsforwarder/config/config_test.go
bonzofenix May 27, 2024
8fc6fb2
Update src/acceptance/Makefile
bonzofenix May 27, 2024
0d44af5
Adds missing acceptance tests pipeline for logcache syslog
bonzofenix May 27, 2024
a567e4a
Adds gum version to asdf
bonzofenix May 27, 2024
05ee5a8
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 27, 2024
f89e27d
🤖🦾🛠️ scripts/asdf2devbox.py
bonzofenix May 27, 2024
e60f202
Revert file renaming to maintain backward compatibility
bonzofenix May 28, 2024
1936380
🤖🦾🛠️ scripts/asdf2devbox.py
bonzofenix May 28, 2024
dfb43f4
Fix shellcheck recomendations
bonzofenix May 28, 2024
daf7b33
Update ci readme
bonzofenix May 28, 2024
ee5455e
Adds missing phony to ci makefile
bonzofenix May 28, 2024
15416b8
Improve unpause pipeline script
bonzofenix May 28, 2024
6acfcca
Checks if unpause jobs are left before trying
bonzofenix May 28, 2024
2455d67
Fix linting issue
bonzofenix May 28, 2024
676613d
Update ci readme
bonzofenix May 28, 2024
d11222e
"Change log cache syslog deployment name
bonzofenix May 28, 2024
ddbe682
Adds linting information on readme
bonzofenix May 28, 2024
1449bba
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 28, 2024
47e5528
🤖🦾🛠️ scripts/asdf2devbox.py
bonzofenix May 28, 2024
2c87b66
Fix all reference of Context to When for mf config test
bonzofenix May 28, 2024
3d780f4
🤖🦾🛠️ scripts/asdf2devbox.py
bonzofenix May 28, 2024
5ad72de
Uses prometheus counter gen creating egress connector for syslog
bonzofenix May 28, 2024
32e794a
Update src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go
bonzofenix May 28, 2024
b8e4c99
Tests when writer errors on emitting syslog message
bonzofenix May 29, 2024
5dd0090
Revert "Uses prometheus counter gen creating egress connector for sys…
bonzofenix May 29, 2024
6bab145
Rename Counter to DummyCounter
bonzofenix May 29, 2024
2b7443c
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 29, 2024
5296e2f
Merge branch 'main' into metricforwarder-on-cf
bonzofenix May 29, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/acceptance_tests_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:

deployment_cleanup:
needs: [ acceptance_tests_verify ]
if: "!contains(github.event.pull_request.labels.*.name, 'skip-cleanup')"
geigerj0 marked this conversation as resolved.
Show resolved Hide resolved
geigerj0 marked this conversation as resolved.
Show resolved Hide resolved
name: Deployment cleanup
runs-on: ubuntu-latest
container:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ keys/
# easy sharing, see:
# <https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions>
!.vscode/extensions.json

.devbox
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
act 0.2.62
actionlint 1.6.27
bosh 7.3.1
credhub 2.9.29
cf 8.7.10
concourse 7.10.0
direnv 2.34.0
Expand All @@ -14,3 +15,4 @@ maven 3.8.6
ruby 3.3.1
shellcheck 0.10.0
yq 4.43.1
gum 0.13.0
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ clean-scheduler:
@rm -rf src/scheduler/src/test/resources/certs
clean-certs:
@echo " - cleaning test certs"
@rm -f testcerts/*
@rm -f test-certs/*
clean-bosh-release:
@echo " - cleaning bosh dev releases"
@rm -rf dev_releases
Expand Down Expand Up @@ -231,7 +231,7 @@ lint: $(addprefix lint_,$(go_modules)) rubocop
rubocop:
@echo " - ruby scripts"
@bundle install
@bundle exec rubocop ./spec ./packages
@bundle exec rubocop ${RUBOCOP_OPTS} ./spec ./packages
bonzofenix marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: markdownlint
markdownlint: markdownlint-cli
Expand Down Expand Up @@ -305,7 +305,7 @@ mod-download:

.PHONY: acceptance.go-mod-vendor autoscaler.go-mod-vendor changelog.go-mod-vendor \
changeloglockcleander.go-mod-vendor
go-mod-vendor: acceptance.go-mod-vendor autoscaler.go-mod-vendor changelog.go-mod-vendor \
go-mod-vendor: clean-vendor acceptance.go-mod-vendor autoscaler.go-mod-vendor changelog.go-mod-vendor \
changeloglockcleander.go-mod-vendor
acceptance.go-mod-vendor:
make --directory='${go-acceptance-dir}' go-mod-vendor
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,21 @@ database.password | The password of the user specified above in "database.userna
database.sslmode | There are 6 values allowed for "postgres": disable, allow, prefer, require, verify-ca and verify-full. Please refer to [Postgres SSL definition](https://www.postgresql.org/docs/current/libpq-ssl.html) when define `database_sslmode`. For "mysql", there are 7 values allowed: false, true, skip-verify, preferred, verify-ca, verify_identity.Please refer to [Mysql SSL definition(Golang)](https://github.com/go-sql-driver/mysql#tls) and [Mysql Connector SSL](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-using-ssl.html)
database.tls.ca | PEM-encoded certification authority for secure TLS communication. Only required when sslmode is verify-ca or verify-full(postgres) or verify_identity(mysql) and can be omitted for other sslmode.

## Run linting

Linting can be run through make:

```
make lint
```

Autofix can be trigger by providing the following options:


```
OPTS=--fix RUBOCOP_OPTS=-A make lint
```

## Register service

Log in to Cloud Foundry with admin user, and use the following commands to register `app-autoscaler` service
Expand Down
11 changes: 11 additions & 0 deletions ci/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

bonzofenix marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: set-autoscaler-pipeline

set-autoscaler-pipeline:
@./autoscaler/set-pipeline.sh

.PHONY: unpause-pipeline

unpause-pipeline:
@./scripts/unpause-pipeline.sh

17 changes: 11 additions & 6 deletions ci/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# app-autoscaler-ci

This repository provides all public scripts and pipeline deployments used
by the app autoscaler team. The public pipeline is hosted at: <https://bosh.ci.cloudfoundry.org/>.
by the app autoscaler team. The public pipeline is hosted at: <https://concourse.app-runtime-interfaces.ci.cloudfoundry.org>.

To reproduce this pipeline, you can use your own private configuration files for the `pipeline.yml` files as described below.

## Autoscaler

This directory contains the concourse `pipeline.yml` for the autoscaler [pipeline](https://bosh.ci.cloudfoundry.org/pipelines/app-autoscaler)
This directory contains the concourse `pipeline.yml` for the autoscaler [pipeline](https://concourse.app-runtime-interfaces.ci.cloudfoundry.org/teams/app-autoscaler/pipelines/app-autoscaler-release)
and all of the associated scripts. To use this manifest, you need to provide a private configuration file
for all of the template parameters.

Expand All @@ -28,10 +28,15 @@ This directory contains the terragrunt managed stacks of resouces in account app
__Setup__

```
fly --target autoscaler login --team-name app-autoscaler --concourse-url https://bosh.ci.cloudfoundry.org/
push autoscaler
./set-pipeline.sh
popd
fly --target app-autoscaler-release login --team-name app-autoscaler --concourse-url https://concourse.app-runtime-interfaces.ci.cloudfoundry.org
make set-autoscaler-pipeline
```

## Unpause pipeline and jobs

```
# You will be prompted to select the specific jobs you want to unpause.
make unpause-pipeline
```

## Prometheus
Expand Down
89 changes: 81 additions & 8 deletions ci/autoscaler/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ anchors:
operations/set-release-version.yml
operations/enable-scheduler-logging.yml

app-autoscaler-ops-files-log-cache: &app-autoscaler-ops-files-log-cache
app-autoscaler-ops-files-log-cache-metron: &app-autoscaler-ops-files-log-cache-metron
OPS_FILES: |
operations/add-releases.yml
operations/instance-identity-cert-from-cf.yml
Expand All @@ -22,6 +22,22 @@ anchors:
operations/add-extra-plan.yml
operations/set-release-version.yml
operations/configure-log-cache-and-forward-metrics-via-mtls.yml
operations/enable-metricsforwarder-via-metron-agent.yml
operations/remove-metricsserver.yml
operations/remove-metricsgateway.yml
operations/enable-scheduler-logging.yml

app-autoscaler-ops-files-log-cache-syslog: &app-autoscaler-ops-files-log-cache-syslog
OPS_FILES: |
operations/add-releases.yml
operations/instance-identity-cert-from-cf.yml
operations/add-postgres-variables.yml
operations/enable-nats-tls.yml
operations/loggregator-certs-from-cf.yml
operations/add-extra-plan.yml
operations/set-release-version.yml
operations/configure-log-cache-and-forward-metrics-via-mtls.yml
operations/enable-metricsforwarder-via-syslog-agent.yml
operations/remove-metricsserver.yml
operations/remove-metricsgateway.yml
operations/enable-scheduler-logging.yml
Expand All @@ -42,7 +58,8 @@ groups:
- name: all
jobs:
- acceptance
- acceptance-log-cache
- acceptance-log-cache-metron
- acceptance-log-cache-syslog
- cleanup-autoscaler-deployments
- fetch-latest-stemcell
- draft
Expand All @@ -57,7 +74,8 @@ groups:
- name: autoscaler-release
jobs:
- acceptance
- acceptance-log-cache
- acceptance-log-cache-metron
- acceptance-log-cache-syslog
- draft
- integration-tests
- release
Expand Down Expand Up @@ -177,7 +195,8 @@ jobs:
vars:
branch_name: ((branch_name))
acceptance_deployment_name: ((acceptance_deployment_name))
logcache_acceptance_deployment_name: ((logcache_acceptance_deployment_name))
acceptance_deployment_name_logcache_metron: ((acceptance_deployment_name_logcache_metron))
acceptance_deployment_name_logcache_syslog: ((acceptance_deployment_name_logcache_syslog))

- name: unit-tests
public: true
Expand Down Expand Up @@ -260,15 +279,68 @@ jobs:
SUITES: broker
timeout: 15m

- name: acceptance-log-cache
- name: acceptance-log-cache-metron
public: true
build_logs_to_retain: 100
serial: true
on_success:
task: cleanup
file: ci/ci/autoscaler/tasks/cleanup-autoscaler.yml
params: &acceptance-log-cache-params
DEPLOYMENT_NAME: ((acceptance_deployment_name_logcache_metron))
plan:
- in_parallel:
- get: bbl-state
- get: app-autoscaler-release
passed: [unit-tests, integration-tests]
trigger: true
- get: ci
- task: make-prerelease
file: ci/ci/autoscaler/tasks/make/make.yaml
params:
# ⚠️ Here it is used that make officially guarantees to reach the goals in the provided order.
TARGETS: generate-fakes generate-openapi-generated-clients-and-servers go-mod-tidy go-mod-vendor db scheduler
timeout: 15m
- task: deploy-autoscaler
file: ci/ci/autoscaler/tasks/deploy-autoscaler.yml
params:
<<: *acceptance-log-cache-params
<<: *app-autoscaler-ops-files-log-cache-metron
timeout: 30m
- task: register-broker
file: ci/ci/autoscaler/tasks/register-broker.yml
params:
<<: *acceptance-log-cache-params
timeout: 5m
- in_parallel:
- task: autoscaler-acceptance-api
file: ci/ci/autoscaler/tasks/run-acceptance-tests.yml
params:
<<: *acceptance-log-cache-params
SUITES: api
timeout: 15m
- task: autoscaler-acceptance-app
file: ci/ci/autoscaler/tasks/run-acceptance-tests.yml
params:
<<: *acceptance-log-cache-params
SUITES: app
timeout: 45m
- task: autoscaler-acceptance-broker
file: ci/ci/autoscaler/tasks/run-acceptance-tests.yml
params:
<<: *acceptance-log-cache-params
SUITES: broker
timeout: 15m

- name: acceptance-log-cache-syslog
public: true
build_logs_to_retain: 100
serial: true
on_success:
task: cleanup
file: ci/ci/autoscaler/tasks/cleanup-autoscaler.yml
params: &acceptance-log-cache-params
DEPLOYMENT_NAME: ((logcache_acceptance_deployment_name))
DEPLOYMENT_NAME: ((acceptance_deployment_name_logcache_syslog))
plan:
- in_parallel:
- get: bbl-state
Expand All @@ -286,7 +358,7 @@ jobs:
file: ci/ci/autoscaler/tasks/deploy-autoscaler.yml
params:
<<: *acceptance-log-cache-params
<<: *app-autoscaler-ops-files-log-cache
<<: *app-autoscaler-ops-files-log-cache-syslog
timeout: 30m
- task: register-broker
file: ci/ci/autoscaler/tasks/register-broker.yml
Expand Down Expand Up @@ -374,7 +446,8 @@ jobs:
- get: app-autoscaler-release
passed:
- acceptance
- acceptance-log-cache
- acceptance-log-cache-metron
- acceptance-log-cache-syslog
trigger: true
- get: previous-stable-release
- task: deploy-previous-stable-release
Expand Down
1 change: 1 addition & 0 deletions ci/autoscaler/scripts/deploy-autoscaler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ops_files=${OPS_FILES:-"${autoscaler_dir}/operations/add-releases.yml\
${autoscaler_dir}/operations/remove-metricsserver.yml\
${autoscaler_dir}/operations/remove-metricsgateway.yml\
${autoscaler_dir}/operations/enable-log-cache-via-uaa.yml\
${autoscaler_dir}/operations/enable-metricsforwarder-via-syslog-agent.yml\
${autoscaler_dir}/operations/enable-scheduler-logging.yml"}


Expand Down
8 changes: 5 additions & 3 deletions ci/autoscaler/set-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if "$(which gh)" > /dev/null; then
echo "gh cli found"
gh --version
else
echo "no gh cli found!"
echo "no gh cli found!"
exit 1
fi

Expand All @@ -31,10 +31,12 @@ function set_pipeline(){
add_var branch_name "${CURRENT_BRANCH}"
if [[ -z $PR_NUMBER ]]; then
add_var acceptance_deployment_name "acceptance"
add_var logcache_acceptance_deployment_name "acceptance-lc"
add_var acceptance_deployment_name_logcache_metron "acceptance-lc"
add_var acceptance_deployment_name_logcache_syslog "acceptance-lc-sl"
else
add_var acceptance_deployment_name "${PR_NUMBER}-acceptance"
add_var logcache_acceptance_deployment_name "${PR_NUMBER}-acceptance-lc"
add_var acceptance_deployment_name_logcache_metron "${PR_NUMBER}-acceptance-lc"
add_var acceptance_deployment_name_logcache_syslog "${PR_NUMBER}-acceptance-lc-sl"
fi

# shellcheck disable=SC2086
Expand Down
58 changes: 58 additions & 0 deletions ci/scripts/unpause-pipeline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
bonzofenix marked this conversation as resolved.
Show resolved Hide resolved
# shellcheck disable=SC2086
#

target="app-autoscaler-release"

function unpause-job(){
pipeline="$1"
jobs=$(fly -t "$target" jobs -p "$pipeline" --json | jq ".[] | select(.paused==true) | .name" -r)

if [[ -z "$jobs" ]]; then
echo "No paused job in pipeline $pipeline"
return
fi

selected_job=$(gum choose --no-limit $jobs --header "Select jobs to unpause from pipeline $pipeline")


if [[ -z "$selected_job" ]]; then
echo "No job selected to unpause"
return
fi

for j in $selected_job; do
fly -t "$target" unpause-job -j "$pipeline/$j"
done
}

function unpause-pipeline(){
payload=$(fly -t "$target" pipelines --json)

pipelines=$(echo "$payload" | jq ".[] |.name" -r | sort)
# ignore shellcheck warning
pipeline=$(gum choose $pipelines "all")
bonzofenix marked this conversation as resolved.
Show resolved Hide resolved

if [[ "$pipeline" == "all" ]]; then
for p in $pipelines; do
fly -t "$target" unpause-pipeline -p "$p"
unpause-job "$p"
done
else
fly -t "$target" unpause-pipeline -p "$pipeline"
unpause-job "$pipeline"
fi

}

function check-login(){
if ! fly -t "$target" status; then
echo
echo "fly -t $target login"
echo
exit 1
fi
}

check-login
unpause-pipeline "${@:-}"
3 changes: 2 additions & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"path:local-flake#app-autoscaler-cli-plugin",
"path:local-flake#log-cache-cli-plugin",
"path:local-flake#uaac",
"credhub-cli@latest",
"delve@latest",
"gh@latest",
"go-tools@latest",
Expand Down Expand Up @@ -33,6 +32,8 @@
"[email protected]",
"bundix@latest",
"oha@latest",
"[email protected]",
"[email protected]",
"google-cloud-sdk@latest",
"ginkgo@latest",
"temurin-bin-17@latest"
Expand Down
Loading
Loading