-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from porter-dev/sms/intgtests
sms/intgtests
- Loading branch information
Showing
9 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
.github/workflows/porter_stack_integration-test-provisioning.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"on": | ||
push: | ||
branches: | ||
- sms/intgtests | ||
name: Deploy to integration-test-provisioning | ||
jobs: | ||
porter-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set Github tag | ||
id: vars | ||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
- name: Setup porter | ||
uses: porter-dev/[email protected] | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: portersupport | ||
password: ${{ secrets.IMAGE_BUILD_TOKEN }} | ||
- name: Pull unauthenticated images | ||
run: | | ||
docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest | ||
- name: Deploy stack | ||
timeout-minutes: 30 | ||
run: exec porter apply | ||
env: | ||
PORTER_CLUSTER: "11" | ||
PORTER_HOST: https://dashboard.internal-tools.porter.run | ||
PORTER_PR_NUMBER: ${{ github.event.number }} | ||
PORTER_PROJECT: "8" | ||
PORTER_STACK_NAME: integration-test-provisioning | ||
PORTER_TAG: ${{ steps.vars.outputs.sha_short }} | ||
PORTER_TOKEN: ${{ secrets.PORTER_STACK_8_11 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# app-integration-tests | ||
|
||
Central location for test apps and test `porter.yaml` files. | ||
|
||
# Tests Summary: | ||
|
||
## Provisioning | ||
|
||
Runs the following tests on internal-tools project, application (integration-test-provisioning), against project 468, in AWS account 081277119371. Uses the Porter CLI and CCP CLI to ensure that clusters can be created and deleted. Triggers in honeycomb should alert on all failures | ||
|
||
- Create a cluster every morning | ||
- Delete a cluster every night | ||
- Every 2 hours, perform an instance type change | ||
- Update permissions every hour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM ghcr.io/porter-dev/porter/porter-cli:latest as porter-cli | ||
FROM ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest as ccp-cli | ||
|
||
RUN apt update | ||
RUN apt install -y software-properties-common | ||
RUN apt update | ||
RUN add-apt-repository -y ppa:rmescandon/yq | ||
RUN apt install -y gettext-base yq jq | ||
|
||
COPY --from=porter-cli /usr/local/bin/porter /usr/local/bin/porter | ||
|
||
COPY testdata . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"cluster": { | ||
"cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", | ||
"cloudProviderCredentialsId": "arn:aws:iam::081277119371:role/porter-manager", | ||
"eksKind": { | ||
"clusterName": "integration-test", | ||
"clusterVersion": "v1.27.0", | ||
"loadBalancer": {}, | ||
"logging": {}, | ||
"network": { | ||
"serviceCidr": "172.20.0.0/16", | ||
"vpcCidr": "10.78.0.0/16" | ||
}, | ||
"nodeGroups": [ | ||
{ | ||
"instanceType": "t3.medium", | ||
"maxInstances": 5, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_SYSTEM" | ||
}, | ||
{ | ||
"instanceType": "t3.large", | ||
"isStateful": true, | ||
"maxInstances": 5, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_MONITORING" | ||
}, | ||
{ | ||
"instanceType": "t3.medium", | ||
"maxInstances": 10, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_APPLICATION" | ||
} | ||
], | ||
"region": "us-east-1" | ||
}, | ||
"kind": "ENUM_KUBERNETES_KIND_EKS", | ||
"projectId": $PROJECT_ID | ||
}, | ||
"complianceProfiles": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"cluster": { | ||
"cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", | ||
"cloudProviderCredentialsId": "arn:aws:iam::081277119371:role/porter-manager", | ||
"eksKind": { | ||
"clusterName": "integration-test", | ||
"clusterVersion": "v1.27.0", | ||
"loadBalancer": {}, | ||
"logging": {}, | ||
"network": { | ||
"serviceCidr": "172.20.0.0/16", | ||
"vpcCidr": "10.78.0.0/16" | ||
}, | ||
"nodeGroups": [ | ||
{ | ||
"instanceType": "t3.medium", | ||
"maxInstances": 5, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_SYSTEM" | ||
}, | ||
{ | ||
"instanceType": "t3.large", | ||
"isStateful": true, | ||
"maxInstances": 5, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_MONITORING" | ||
}, | ||
{ | ||
"instanceType": "t3.medium", | ||
"maxInstances": 10, | ||
"minInstances": 1, | ||
"nodeGroupType": "NODE_GROUP_TYPE_APPLICATION" | ||
} | ||
], | ||
"region": "us-east-1" | ||
}, | ||
"kind": "ENUM_KUBERNETES_KIND_EKS", | ||
"projectId": $PROJECT_ID, | ||
"clusterId": $CLUSTER_ID | ||
}, | ||
"complianceProfiles": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#! /bin/bash | ||
set -euo pipefail | ||
|
||
if [ -z "$PROJECT_ID" ]; | ||
then | ||
echo "Project ID is not set" | ||
exit 1 | ||
fi | ||
echo "Project ID: $PROJECT_ID" | ||
|
||
if [ -z "$CLUSTER_ID" ]; | ||
then | ||
echo "Cluster ID is not set" | ||
exit 1 | ||
fi | ||
echo "Cluster ID: $CLUSTER_ID" | ||
|
||
echo "Deleting cluster" | ||
ccp-cli manage contract delete --project-id $PROJECT_ID --cluster-id $CLUSTER_ID | ||
|
||
export NEXT_INSTANCE_TYPE="t3.large" | ||
export CURRENT_INSTANCE_TYPE="t3.medium" | ||
export CLUSTER_ID="0" | ||
|
||
echo "Updating values in Porter" | ||
|
||
envsubst < template-porter.yaml > porter.yaml | ||
porter apply -f porter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: v2 | ||
name: integration-test-provisioning | ||
env: | ||
CLUSTER_ID: $CLUSTER_ID | ||
PROJECT_ID: $PROJECT_ID | ||
NEXT_INSTANCE_TYPE: $NEXT_INSTANCE_TYPE | ||
CURRENT_INSTANCE_TYPE: $CURRENT_INSTANCE_TYPE | ||
services: | ||
- name: cluster-update | ||
type: job |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#! /bin/bash | ||
set -euo pipefail | ||
|
||
contractname=cluster-basic-no-id.json | ||
|
||
if [ -z "$PROJECT_ID" ]; | ||
then | ||
echo "Project ID is not set" | ||
exit 1 | ||
fi | ||
echo "Project ID: $PROJECT_ID" | ||
|
||
if [ -z "$CLUSTER_ID" ]; | ||
then | ||
echo "Cluster ID is not set" | ||
exit 1 | ||
fi | ||
echo "Cluster ID: $CLUSTER_ID" | ||
|
||
if [ -z "$CURRENT_INSTANCE_TYPE" ]; | ||
then | ||
echo "Current instance type is not set" | ||
exit 1 | ||
fi | ||
echo "Current instance type: $CURRENT_INSTANCE_TYPE" | ||
|
||
if [ -z "$NEXT_INSTANCE_TYPE" ]; | ||
then | ||
echo "Next instance type is not set" | ||
exit 1 | ||
fi | ||
echo "Next instance type: $NEXT_INSTANCE_TYPE" | ||
|
||
if [ $CLUSTER_ID = 0 ]; | ||
then | ||
contractname=cluster-basic-no-id.json | ||
envsubst < cluster-basic-no-id-template.json > apply-contract.json | ||
else | ||
contractname=cluster-basic-with-id.json | ||
envsubst < cluster-basic-with-id-template.json > apply-contract.json | ||
fi | ||
|
||
echo "Applying contract to cluster. If this returns an error, another integration test may be in progress. Please wait a few minutes and try again." | ||
clusterid=$(ccp-cli manage contract update -f apply-contract.json -o json | jq '.cluster_id') | ||
echo "Cluster ID: $clusterid" | ||
|
||
NEXT_TYPE=$CURRENT_INSTANCE_TYPE | ||
CURRENT_TYPE=$NEXT_INSTANCE_TYPE | ||
CLUSTER_ID=$clusterid | ||
|
||
export NEXT_INSTANCE_TYPE=$NEXT_TYPE | ||
export CURRENT_INSTANCE_TYPE=$CURRENT_TYPE | ||
export CLUSTER_ID=$CLUSTER_ID | ||
|
||
echo "Updating values in Porter" | ||
|
||
envsubst < template-porter.yaml > porter.yaml | ||
porter apply -f porter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#! /bin/bash | ||
|
||
if [ -z "$PROJECT_ID" ]; | ||
then | ||
echo "Project ID is not set" | ||
exit 1 | ||
fi | ||
|
||
ccp-cli manage cloud update-permissions --project-id $PROJECT_ID |