Skip to content

Commit

Permalink
Test against v1.59.0 (#25)
Browse files Browse the repository at this point in the history
* Test against v1.59.0

* setup orgs when 1.59.0 or newer

* debug

* debug

* do not fail fast

* pass version as arg
  • Loading branch information
jsirianni authored Jun 15, 2024
1 parent d1f7103 commit 1a66e88
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# This matrix allows us to test multiple bindplane versions.
# When writing back to the repo, we write to directories based
Expand All @@ -76,6 +77,7 @@ jobs:
- 1.56.0
- 1.57.0
- 1.58.0
- 1.59.0 # organizations and projects
- latest # keep
steps:
- name: Checkout
Expand Down Expand Up @@ -127,19 +129,14 @@ jobs:
env:
BINDPLANE_LICENSE: ${{ secrets.BINDPLANE_LICENSE }}

- name: Init BindPlane Account
- name: Init BindPlane Account or Organization
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
polling_interval_seconds: 2
max_attempts: 3
shell: bash
command: |
curl -kv \
-u admin:admin https://localhost:3001/v1/accounts \
-X POST -d '{"displayName": "init"}' -v \
--key step/bindplane.key \
--cert step/bindplane.crt
command: .github/workflows/scripts/init.sh ${{ matrix.bindplane_versions }}

- name: Run BindPlane Action
# This should be replaced with a release action.
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

# This script initializes the BindPlane API with an organization or account
# depending on the version. Pre 1.59.0 was account based, post 1.59.0 is
# organization based.

set -ex

if [ -z "$1" ]; then
echo "Usage: $0 <bindplane_version>"
exit 1
fi

BINDPLANE_VERSION=$1
ORGS=false

echo "Initializing BindPlane $BINDPLANE_VERSION"

if [[ $(printf '%s\n' "$BINDPLANE_VERSION" "1.58.0" | sort -V | head -n1) == "1.58.0" && "$BINDPLANE_VERSION" != "1.58.0" ]]; then
ORGS=true
elif [[ "$BINDPLANE_VERSION" == "latest" ]]; then
ORGS=true
fi

if [[ $ORGS == "true" ]]; then
curl -v -k \
-u admin:admin \
https://localhost:3001/v1/organizations \
-X POST \
-d '{"organizationName": "init", "accountName": "project", "eulaAccepted":true}' \
--key step/bindplane.key \
--cert step/bindplane.crt
else
curl -v -k \
-u admin:admin \
https://localhost:3001/v1/accounts \
-X POST \
-d '{"displayName": "init"}' \
--key step/bindplane.key \
--cert step/bindplane.crt
fi

0 comments on commit 1a66e88

Please sign in to comment.