471 lines
16 KiB
YAML
Generated
471 lines
16 KiB
YAML
Generated
### ***
|
|
### WARNING: DO NOT manually EDIT or MERGE this file, it is generated by 'make ci-config'.
|
|
### INSTEAD: Edit or merge the source in config/ then run 'make ci-config'.
|
|
### ***
|
|
# Orb 'circleci/slack@3.4.2' resolved to 'circleci/slack@3.4.2'
|
|
version: 2
|
|
jobs:
|
|
test-sql-13-alpine:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make test-sql POSTGRES_DOCKER_IMAGE_BASE=docker.mirror.hashicorp.services/postgres PG_DOCKER_TAG=13-alpine
|
|
name: Run SQL PgTap Tests
|
|
test-api:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make install-go
|
|
source ~/.bashrc
|
|
echo 'export GOROOT=$GOROOT' >> "$BASH_ENV"
|
|
echo 'export GOPATH=$GOPATH' >> "$BASH_ENV"
|
|
echo 'export PATH=$PATH' >> "$BASH_ENV"
|
|
echo "$ go version"
|
|
go version
|
|
name: Install go
|
|
- run:
|
|
command: |
|
|
make test-api
|
|
name: Run API Tests
|
|
no_output_timeout: 15m
|
|
test-sql-11-alpine:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make test-sql POSTGRES_DOCKER_IMAGE_BASE=docker.mirror.hashicorp.services/postgres PG_DOCKER_TAG=11-alpine
|
|
name: Run SQL PgTap Tests
|
|
make-gen-deltas:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make install-go
|
|
source ~/.bashrc
|
|
echo 'export GOROOT=$GOROOT' >> "$BASH_ENV"
|
|
echo 'export GOPATH=$GOPATH' >> "$BASH_ENV"
|
|
echo 'export PATH=$PATH' >> "$BASH_ENV"
|
|
echo "$ go version"
|
|
go version
|
|
name: Install go
|
|
- run:
|
|
command: |
|
|
make tools
|
|
name: Install tools
|
|
- run:
|
|
command: |
|
|
make gen
|
|
echo "Testing git diffs..."
|
|
git diff --exit-code
|
|
git status --porcelain
|
|
test -z "$(git status --porcelain)"
|
|
name: Check make gen deltas
|
|
test-sdk:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make install-go
|
|
source ~/.bashrc
|
|
echo 'export GOROOT=$GOROOT' >> "$BASH_ENV"
|
|
echo 'export GOPATH=$GOPATH' >> "$BASH_ENV"
|
|
echo 'export PATH=$PATH' >> "$BASH_ENV"
|
|
echo "$ go version"
|
|
go version
|
|
name: Install go
|
|
- run:
|
|
command: |
|
|
make test-sdk
|
|
name: Run SDK Tests
|
|
no_output_timeout: 15m
|
|
test-sql-12-alpine:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make test-sql POSTGRES_DOCKER_IMAGE_BASE=docker.mirror.hashicorp.services/postgres PG_DOCKER_TAG=12-alpine
|
|
name: Run SQL PgTap Tests
|
|
build:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: large
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make install-go
|
|
source ~/.bashrc
|
|
echo 'export GOROOT=$GOROOT' >> "$BASH_ENV"
|
|
echo 'export GOPATH=$GOPATH' >> "$BASH_ENV"
|
|
echo 'export PATH=$PATH' >> "$BASH_ENV"
|
|
echo "$ go version"
|
|
go version
|
|
name: Install go
|
|
- run:
|
|
command: |
|
|
which pg_isready || sudo apt-get update && sudo apt-get install -y postgresql-client
|
|
make DOCKER_ARGS='-d' PG_OPTS='-c shared_buffers=256MB -c max_connections=200000' -C testing/dbtest/docker database-up
|
|
until pg_isready -h 127.0.0.1; do docker container inspect boundary-sql-tests &> /dev/null || exit -1; sleep 1; done
|
|
name: Initialize Test Database
|
|
- run:
|
|
command: |
|
|
make test-ci
|
|
name: Run Acceptance Tests
|
|
no_output_timeout: 15m
|
|
- run:
|
|
command: |
|
|
make -C testing/dbtest/docker clean
|
|
name: Cleanup
|
|
when: always
|
|
- run:
|
|
command: |
|
|
echo 'export SLACK_BUILD_STATUS="fail"' >> $BASH_ENV
|
|
name: Slack - Setting Failure Condition
|
|
when: on_fail
|
|
- run:
|
|
command: |
|
|
echo 'export SLACK_BUILD_STATUS="success"' >> $BASH_ENV
|
|
name: Slack - Setting Success Condition
|
|
when: on_success
|
|
- run:
|
|
command: |
|
|
if [ ! -x /bin/bash ]; then
|
|
echo Bash not installed.
|
|
exit 1
|
|
fi
|
|
name: Provide error if non-bash shell
|
|
- run:
|
|
command: |
|
|
current_branch_in_filter=false
|
|
|
|
IFS="," read -ra BRANCH_FILTERS <<< "master"
|
|
|
|
for i in "${BRANCH_FILTERS[@]}"; do
|
|
if [ "${i}" == "${CIRCLE_BRANCH}" ]; then
|
|
current_branch_in_filter=true
|
|
fi
|
|
done
|
|
|
|
if [ "x" == "xmaster" ] || [ "$current_branch_in_filter" = true ]; then
|
|
# Provide error if no webhook is set and error. Otherwise continue
|
|
if [ -z "webhook" ]; then
|
|
echo "NO SLACK WEBHOOK SET"
|
|
echo "Please input your SLACK_WEBHOOK value either in the settings for this project, or as a parameter for this orb."
|
|
exit 1
|
|
else
|
|
#Create Members string
|
|
if [ -n "" ]; then
|
|
IFS="," read -ra SLACK_MEMBERS <<< ""
|
|
for i in "${SLACK_MEMBERS[@]}"; do
|
|
if [ $(echo ${i} | head -c 1) == "S" ]; then
|
|
SLACK_MENTIONS="${SLACK_MENTIONS}<!subteam^${i}> "
|
|
elif echo ${i} | grep -E "^(here|channel|everyone)$" > /dev/null; then
|
|
SLACK_MENTIONS="${SLACK_MENTIONS}<!${i}> "
|
|
else
|
|
SLACK_MENTIONS="${SLACK_MENTIONS}<@${i}> "
|
|
fi
|
|
done
|
|
fi
|
|
#If successful
|
|
if [ "$SLACK_BUILD_STATUS" = "success" ]; then
|
|
#Skip if fail_only
|
|
if [ true = true ]; then
|
|
echo "The job completed successfully"
|
|
echo '"fail_only" is set to "true". No Slack notification sent.'
|
|
else
|
|
curl -X POST -H 'Content-type: application/json' \
|
|
--data "{ \
|
|
\"attachments\": [ \
|
|
{ \
|
|
\"fallback\": \":tada: A $CIRCLE_JOB job has succeeded!\", \
|
|
\"text\": \":tada: A $CIRCLE_JOB job has succeeded! $SLACK_MENTIONS\", \
|
|
\"fields\": [ \
|
|
{ \
|
|
\"title\": \"Project\", \
|
|
\"value\": \"$CIRCLE_PROJECT_REPONAME\", \
|
|
\"short\": true \
|
|
}, \
|
|
{ \
|
|
\"title\": \"Job Number\", \
|
|
\"value\": \"$CIRCLE_BUILD_NUM\", \
|
|
\"short\": true \
|
|
} \
|
|
], \
|
|
\"actions\": [ \
|
|
{ \
|
|
\"type\": \"button\", \
|
|
\"text\": \"Visit Job\", \
|
|
\"url\": \"$CIRCLE_BUILD_URL\" \
|
|
} \
|
|
], \
|
|
\"color\": \"#1CBF43\" \
|
|
} \
|
|
] \
|
|
} " webhook
|
|
echo "Job completed successfully. Alert sent."
|
|
fi
|
|
else
|
|
#If Failed
|
|
curl -X POST -H 'Content-type: application/json' \
|
|
--data "{ \
|
|
\"attachments\": [ \
|
|
{ \
|
|
\"fallback\": \":red_circle: A $CIRCLE_JOB job has failed!\", \
|
|
\"text\": \":red_circle: A $CIRCLE_JOB job has failed! $SLACK_MENTIONS\", \
|
|
\"fields\": [ \
|
|
{ \
|
|
\"title\": \"Project\", \
|
|
\"value\": \"$CIRCLE_PROJECT_REPONAME\", \
|
|
\"short\": true \
|
|
}, \
|
|
{ \
|
|
\"title\": \"Job Number\", \
|
|
\"value\": \"$CIRCLE_BUILD_NUM\", \
|
|
\"short\": true \
|
|
} \
|
|
], \
|
|
\"actions\": [ \
|
|
{ \
|
|
\"type\": \"button\", \
|
|
\"text\": \"Visit Job\", \
|
|
\"url\": \"$CIRCLE_BUILD_URL\" \
|
|
} \
|
|
], \
|
|
\"color\": \"#ed5c5c\" \
|
|
} \
|
|
] \
|
|
} " webhook
|
|
echo "Job failed. Alert sent."
|
|
fi
|
|
fi
|
|
else
|
|
echo "Current branch is not included in only_for_branches filter; no status alert will be sent"
|
|
fi
|
|
name: Slack - Sending Status Alert
|
|
shell: /bin/bash
|
|
when: always
|
|
trigger-merge-to-ent:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
./scripts/trigger-merge-to-ent
|
|
name: Trigger Merge to Enterprise
|
|
test-sql-latest:
|
|
machine:
|
|
image: ubuntu-2004:202111-01
|
|
resource_class: medium
|
|
working_directory: ~/boundary
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
command: |
|
|
make test-sql POSTGRES_DOCKER_IMAGE_BASE=docker.mirror.hashicorp.services/postgres PG_DOCKER_TAG=latest
|
|
name: Run SQL PgTap Tests
|
|
workflows:
|
|
ci:
|
|
jobs:
|
|
- build
|
|
- test-api
|
|
- test-sdk
|
|
- test-sql-latest
|
|
- test-sql-11-alpine
|
|
- test-sql-12-alpine
|
|
- test-sql-13-alpine
|
|
- make-gen-deltas
|
|
trigger-merge-to-ent:
|
|
jobs:
|
|
- trigger-merge-to-ent:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- main
|
|
version: 2
|
|
|
|
# Original config.yml file:
|
|
# commands:
|
|
# install-go:
|
|
# description: |
|
|
# Ensure the right version of Go is installed and set PATH, GOPATH, GOROOT
|
|
# steps:
|
|
# - run:
|
|
# command: |
|
|
# make install-go
|
|
# source ~/.bashrc
|
|
# echo 'export GOROOT=$GOROOT' >> \"$BASH_ENV\"
|
|
# echo 'export GOPATH=$GOPATH' >> \"$BASH_ENV\"
|
|
# echo 'export PATH=$PATH' >> \"$BASH_ENV\"
|
|
# echo \"$ go version\"
|
|
# go version
|
|
# name: Install go
|
|
# install-tools:
|
|
# description: |
|
|
# Install tools using the Makefile
|
|
# steps:
|
|
# - run:
|
|
# command: |
|
|
# make tools
|
|
# name: Install tools
|
|
# executors:
|
|
# go-machine:
|
|
# machine:
|
|
# image: ubuntu-2004:202111-01
|
|
# resource_class: large
|
|
# working_directory: ~/boundary
|
|
# go-machine-medium:
|
|
# machine:
|
|
# image: ubuntu-2004:202111-01
|
|
# resource_class: medium
|
|
# working_directory: ~/boundary
|
|
# jobs:
|
|
# algolia-index:
|
|
# docker:
|
|
# - image: docker.mirror.hashicorp.services/node:12
|
|
# steps:
|
|
# - checkout
|
|
# - run:
|
|
# command: |-
|
|
# cd website/
|
|
# npm install
|
|
# node scripts/index_search_content.js
|
|
# name: Push content to Algolia Index
|
|
# build:
|
|
# executor: go-machine
|
|
# steps:
|
|
# - checkout
|
|
# - install-go
|
|
# - run:
|
|
# command: |
|
|
# which pg_isready || sudo apt-get update && sudo apt-get install -y postgresql-client
|
|
# make DOCKER_ARGS='-d' PG_OPTS='-c shared_buffers=256MB -c max_connections=200000' -C testing/dbtest/docker database-up
|
|
# until pg_isready -h 127.0.0.1; do docker container inspect boundary-sql-tests &> /dev/null || exit -1; sleep 1; done
|
|
# name: Initialize Test Database
|
|
# - run:
|
|
# command: |
|
|
# make test-ci
|
|
# name: Run Acceptance Tests
|
|
# no_output_timeout: 15m
|
|
# - run:
|
|
# command: |
|
|
# make -C testing/dbtest/docker clean
|
|
# name: Cleanup
|
|
# when: always
|
|
# - slack/status:
|
|
# fail_only: true
|
|
# only_for_branches: master
|
|
# webhook: webhook
|
|
# make-gen-deltas:
|
|
# executor: go-machine-medium
|
|
# steps:
|
|
# - checkout
|
|
# - install-go
|
|
# - install-tools
|
|
# - run:
|
|
# command: |
|
|
# make gen
|
|
# echo \"Testing git diffs...\"
|
|
# git diff --exit-code
|
|
# git status --porcelain
|
|
# test -z \"$(git status --porcelain)\"
|
|
# name: Check make gen deltas
|
|
# test-api:
|
|
# executor: go-machine-medium
|
|
# steps:
|
|
# - checkout
|
|
# - install-go
|
|
# - run:
|
|
# command: |
|
|
# make test-api
|
|
# name: Run API Tests
|
|
# no_output_timeout: 15m
|
|
# test-sdk:
|
|
# executor: go-machine-medium
|
|
# steps:
|
|
# - checkout
|
|
# - install-go
|
|
# - run:
|
|
# command: |
|
|
# make test-sdk
|
|
# name: Run SDK Tests
|
|
# no_output_timeout: 15m
|
|
# test-sql:
|
|
# executor: go-machine-medium
|
|
# parameters:
|
|
# postgres-version:
|
|
# type: string
|
|
# steps:
|
|
# - checkout
|
|
# - run:
|
|
# command: |
|
|
# make test-sql POSTGRES_DOCKER_IMAGE_BASE=docker.mirror.hashicorp.services/postgres PG_DOCKER_TAG=<< parameters.postgres-version >>
|
|
# name: Run SQL PgTap Tests
|
|
# trigger-merge-to-ent:
|
|
# executor: go-machine-medium
|
|
# steps:
|
|
# - checkout
|
|
# - run:
|
|
# command: |
|
|
# ./scripts/trigger-merge-to-ent
|
|
# name: Trigger Merge to Enterprise
|
|
# orbs:
|
|
# slack: circleci/slack@3.4.2
|
|
# version: 2.1
|
|
# workflows:
|
|
# ci:
|
|
# jobs:
|
|
# - build
|
|
# - test-api
|
|
# - test-sdk
|
|
# - test-sql:
|
|
# matrix:
|
|
# parameters:
|
|
# postgres-version:
|
|
# - latest
|
|
# - 11-alpine
|
|
# - 12-alpine
|
|
# - 13-alpine
|
|
# - algolia-index:
|
|
# filters:
|
|
# branches:
|
|
# only:
|
|
# - stable-website
|
|
# - make-gen-deltas
|
|
# trigger-merge-to-ent:
|
|
# jobs:
|
|
# - trigger-merge-to-ent:
|
|
# filters:
|
|
# branches:
|
|
# only:
|
|
# - main
|