Skip to content

Commit

Permalink
Merge pull request #3155 from cloudfoundry/mta-acceptance-tests
Browse files Browse the repository at this point in the history
Enable mta acceptance test in github action
  • Loading branch information
bonzofenix authored Sep 4, 2024
2 parents a52240c + ea2b062 commit 605fd1f
Show file tree
Hide file tree
Showing 14 changed files with 745 additions and 707 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/acceptance_tests_mta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Acceptance Tests - MTA
on:
pull_request:
types: [ opened, labeled, synchronize ]

concurrency:
group: "${{ github.workflow }}/${{ github.ref }}"
cancel-in-progress: true

jobs:
acceptance_tests_reusable:
name: " " # Whitespace name looks nicest on Github UI
uses: ./.github/workflows/acceptance_tests_reusable.yaml
with:
deployment_name: "autoscaler-mta-${{ github.event.pull_request.number }}"
deploy_apps: true
ops_files: |
operations/add-releases.yml
operations/instance-identity-cert-from-cf.yml
operations/add-postgres-variables.yml
operations/enable-nats-tls.yml
operations/add-extra-plan.yml
operations/set-release-version.yml
operations/enable-metricsforwarder-via-syslog-agent.yml
operations/enable-scheduler-logging.yml
operations/use-cf-services.yml
secrets:
bbl_ssh_key: "${{ secrets.BBL_SSH_KEY }}"
37 changes: 37 additions & 0 deletions .github/workflows/acceptance_tests_mta_close.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Acceptance Tests Cleanup (MTA)
on:
pull_request:
types: [closed]
env:
PR_NUMBER: "${{ github.event.pull_request.number }}"
DEPLOYMENT_NAME: "autoscaler-mta-${{ github.event.pull_request.number }}"

jobs:
deployment_cleanup:
name: Cleanup deployments
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
steps:
- uses: actions/checkout@v4
with:
path: app-autoscaler-release
ref: main

- uses: ./app-autoscaler-release/.github/actions/setup-environment
with:
ssh-key: ${{ secrets.BBL_SSH_KEY }}

- name: "clean up"
shell: bash
run: |
#! /usr/bin/env bash
set -eu -o pipefail
# The subsequent assignments are needed *HERE* because of:
# <https://github.com/actions/runner/issues/2058> or
# <https://github.com/actions/checkout/issues/785>
export BBL_STATE_PATH="${GITHUB_WORKSPACE}/bbl/bbl-state"
declare -r AUTOSCALER_DIR="${GITHUB_WORKSPACE}/app-autoscaler-release"
make --directory="${AUTOSCALER_DIR}" deploy-cleanup
15 changes: 15 additions & 0 deletions .github/workflows/acceptance_tests_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
deployment_name:
required: true
type: string
deploy_apps:
required: false
type: boolean
ops_files:
required: false
type: string
secrets:
bbl_ssh_key:
required: true
Expand Down Expand Up @@ -79,8 +85,17 @@ jobs:
ssh-key: ${{ secrets.bbl_ssh_key}}
- name: Deploy autoscaler
shell: bash
env:
OPS_FILES: ${{ inputs.ops_files }}
run: make --directory="${AUTOSCALER_DIR}" deploy-autoscaler

- name: Deploy Apps
shell: bash
run: make --directory="${AUTOSCALER_DIR}" deploy-apps
if: ${{ inputs.deploy_apps }}



acceptance_tests:
needs: [ deploy_autoscaler ]
strategy:
Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ linters:
- goprintffuncname
- gosec
- gosimple
- gomoddirectives
- gomodguard
- ineffassign
- misspell
Expand Down
6 changes: 5 additions & 1 deletion ci/autoscaler/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ function cleanup_apps(){
echo "No app to undeploy"
fi

if ! cf spaces | grep --quiet --regexp="^${AUTOSCALER_SPACE}$"; then
if cf spaces | grep --quiet --regexp="^${AUTOSCALER_SPACE}$"; then
cf delete-space -f "${AUTOSCALER_SPACE}"
fi

if cf orgs | grep --quiet --regexp="^${AUTOSCALER_ORG}$"; then
cf delete-org -f "${AUTOSCALER_ORG}"
fi
}


Expand Down
3 changes: 1 addition & 2 deletions ci/autoscaler/scripts/vars.source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ debug "DEPLOYMENT_NAME: ${DEPLOYMENT_NAME}"
log "set up vars: DEPLOYMENT_NAME=${DEPLOYMENT_NAME}"
deployment_name="${DEPLOYMENT_NAME}"

export AUTOSCALER_ORG="${AUTOSCALER_ORG:-"autoscaler-${PR_NUMBER}"}"
[ "${AUTOSCALER_ORG}" = "autoscaler-" ] && AUTOSCALER_ORG="${user}"
export AUTOSCALER_ORG="${AUTOSCALER_ORG:-$DEPLOYMENT_NAME}"
debug "AUTOSCALER_ORG: ${AUTOSCALER_ORG}"
log "set up vars: AUTOSCALER_ORG=${AUTOSCALER_ORG}"
autoscaler_org="${AUTOSCALER_ORG}"
Expand Down
1 change: 1 addition & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@
},
"ruby@latest": {
"last_modified": "2024-08-31T10:12:23Z",
"plugin_version": "0.0.2",
"resolved": "github:NixOS/nixpkgs/5629520edecb69630a3f4d17d3d33fc96c13f6fe#ruby",
"source": "devbox-search",
"version": "3.3.4",
Expand Down
5 changes: 3 additions & 2 deletions operations/use-cf-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
api_url: "https://api.((system_domain)):443"
oauth_url: "https://uaa.((system_domain)):443"
routes:
- name: autoscaler_postgres
registration_interval: 20s
- name: ((deployment_name))_postgres
registration_interval: 10s
port: 5432
external_port: ((postgres_external_port))
type: tcp
router_group: default-tcp
tags:
component: autoscaler_postgres
deployment: ((deployment_name))
uris:
- ((deployment_name))-postgres.tcp.((system_domain))

Expand Down
2 changes: 2 additions & 0 deletions packages/eventgenerator/spec
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ files:
- autoscaler/vendor/golang.org/x/text/unicode/bidi/* # gosub
- autoscaler/vendor/golang.org/x/text/unicode/norm/* # gosub
- autoscaler/vendor/golang.org/x/text/width/* # gosub
- autoscaler/vendor/google.golang.org/genproto/googleapis/api/* # gosub
- autoscaler/vendor/google.golang.org/genproto/googleapis/api/annotations/* # gosub
- autoscaler/vendor/google.golang.org/genproto/googleapis/api/httpbody/* # gosub
- autoscaler/vendor/google.golang.org/genproto/googleapis/rpc/status/* # gosub
Expand Down Expand Up @@ -246,6 +247,7 @@ files:
- autoscaler/vendor/google.golang.org/protobuf/reflect/protoregistry/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/runtime/protoiface/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/runtime/protoimpl/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/types/descriptorpb/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/types/known/anypb/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/types/known/durationpb/* # gosub
- autoscaler/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/* # gosub
Expand Down
2 changes: 2 additions & 0 deletions src/autoscaler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

replace google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240827150818-7e3bb234dfed

require (
code.cloudfoundry.org/go-diodes v0.0.0-20240813203737-5032edb05ceb // indirect
code.cloudfoundry.org/go-metric-registry v0.0.0-20240828184116-9710cd731bb8 // indirect
Expand Down
Loading

0 comments on commit 605fd1f

Please sign in to comment.