From 70823f67dcfb71abef53e87f7e3c3bfe379bb555 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Tue, 5 Mar 2024 18:44:31 -0500 Subject: [PATCH 01/22] add app integration tests repo --- provisioning/Dockerfile | 1 + provisioning/cluster-basic.yaml | 0 2 files changed, 1 insertion(+) create mode 100644 provisioning/Dockerfile create mode 100644 provisioning/cluster-basic.yaml diff --git a/provisioning/Dockerfile b/provisioning/Dockerfile new file mode 100644 index 0000000..84c296d --- /dev/null +++ b/provisioning/Dockerfile @@ -0,0 +1 @@ +FROM docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:0.0.11 diff --git a/provisioning/cluster-basic.yaml b/provisioning/cluster-basic.yaml new file mode 100644 index 0000000..e69de29 From 50ca68cf815a55e24214ee7ea851c1d49aa1a42d Mon Sep 17 00:00:00 2001 From: "porter-internal[bot]" <108749831+porter-internal[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 23:46:16 +0000 Subject: [PATCH 02/22] Create porter_stack_integration-test-provisioning.yml file --- ...er_stack_integration-test-provisioning.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/porter_stack_integration-test-provisioning.yml diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml new file mode 100644 index 0000000..8eed179 --- /dev/null +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -0,0 +1,27 @@ +"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/setup-porter@v0.1.0 + - 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 }} From 7b41abb6aba750eb499a763d406552c673657a69 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 19:29:09 -0500 Subject: [PATCH 03/22] basic integration tests --- .../cluster-basic-no-id-template.json | 41 ++++++++++++++++++ .../cluster-basic-with-id-template.json | 42 +++++++++++++++++++ provisioning/testdata/template-porter.yaml | 10 +++++ provisioning/testdata/update-cluster.sh | 40 ++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 provisioning/testdata/cluster-basic-no-id-template.json create mode 100644 provisioning/testdata/cluster-basic-with-id-template.json create mode 100644 provisioning/testdata/template-porter.yaml create mode 100755 provisioning/testdata/update-cluster.sh diff --git a/provisioning/testdata/cluster-basic-no-id-template.json b/provisioning/testdata/cluster-basic-no-id-template.json new file mode 100644 index 0000000..b8dcd67 --- /dev/null +++ b/provisioning/testdata/cluster-basic-no-id-template.json @@ -0,0 +1,41 @@ +{ + "cluster": { + "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", + "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", + "eksKind": { + "clusterName": "stefan-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": {} +} \ No newline at end of file diff --git a/provisioning/testdata/cluster-basic-with-id-template.json b/provisioning/testdata/cluster-basic-with-id-template.json new file mode 100644 index 0000000..df01921 --- /dev/null +++ b/provisioning/testdata/cluster-basic-with-id-template.json @@ -0,0 +1,42 @@ +{ + "cluster": { + "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", + "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", + "eksKind": { + "clusterName": "stefan-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": {} +} \ No newline at end of file diff --git a/provisioning/testdata/template-porter.yaml b/provisioning/testdata/template-porter.yaml new file mode 100644 index 0000000..0329ad7 --- /dev/null +++ b/provisioning/testdata/template-porter.yaml @@ -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 diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh new file mode 100755 index 0000000..4d99d25 --- /dev/null +++ b/provisioning/testdata/update-cluster.sh @@ -0,0 +1,40 @@ +# Create/update cluster using environment variables +contractname=cluster-basic-no-id.json + +if [ -z "$PROJECT_ID" ]; +then + echo "Project ID is not set" + exit 1 +fi + +if [ -z "$CLUSTER_ID" ]; +then + echo "Cluster ID is not set" + exit 1 +fi + +if [ -z "$CURRENT_INSTANCE_TYPE" ]; +then + echo "Current instance type is not set" + exit 1 +fi + +if [ -z "$NEXT_INSTANCE_TYPE" ]; +then + echo "Next instance type is not set" + exit 1 +fi + +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 + NEXT_TYPE=$CURRENT_INSTANCE_TYPE + CURRENT_TYPE=$NEXT_INSTANCE_TYPE + envsubst < template-porter.yaml > porter.yaml +fi + +ccp-cli contract update -f $contractname -o json | jq From d4448e3e46056294666db3a44dcb124ea5a5080c Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 19:43:56 -0500 Subject: [PATCH 04/22] basic integration tests --- ...er_stack_integration-test-provisioning.yml | 38 +++++++++---------- provisioning/Dockerfile | 13 ++++++- provisioning/cluster-basic.yaml | 0 provisioning/testdata/update-cluster.sh | 12 ++++-- 4 files changed, 39 insertions(+), 24 deletions(-) delete mode 100644 provisioning/cluster-basic.yaml diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 8eed179..2c29a21 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -1,27 +1,27 @@ "on": push: branches: - - sms/intgtests + - 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/setup-porter@v0.1.0 - - 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 }} + - 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/setup-porter@v0.1.0 + - 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 }} diff --git a/provisioning/Dockerfile b/provisioning/Dockerfile index 84c296d..41a5310 100644 --- a/provisioning/Dockerfile +++ b/provisioning/Dockerfile @@ -1 +1,12 @@ -FROM docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:0.0.11 +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 + +COPY --from=porter-cli /usr/local/bin/porter /usr/local/bin/porter + +COPY testdata . diff --git a/provisioning/cluster-basic.yaml b/provisioning/cluster-basic.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 4d99d25..4003479 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -32,9 +32,13 @@ then else contractname=cluster-basic-with-id.json envsubst < cluster-basic-with-id-template.json > apply-contract.json - NEXT_TYPE=$CURRENT_INSTANCE_TYPE - CURRENT_TYPE=$NEXT_INSTANCE_TYPE - envsubst < template-porter.yaml > porter.yaml fi -ccp-cli contract update -f $contractname -o json | jq +clusterid=$(ccp-cli contract update -f apply-contract.json -o json | jq '.ClusterId') +echo "Cluster ID: $clusterid" + +NEXT_TYPE=$CURRENT_INSTANCE_TYPE +CURRENT_TYPE=$NEXT_INSTANCE_TYPE +CLUSTER_ID=$clusterid +envsubst < template-porter.yaml > porter.yaml +porter apply -f porter.yaml \ No newline at end of file From a6ab6314a906c45e1a4a13aa8676f942926cc8bb Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 19:45:43 -0500 Subject: [PATCH 05/22] basic integration tests --- provisioning/testdata/update-permissions.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 provisioning/testdata/update-permissions.sh diff --git a/provisioning/testdata/update-permissions.sh b/provisioning/testdata/update-permissions.sh new file mode 100755 index 0000000..3bbd76b --- /dev/null +++ b/provisioning/testdata/update-permissions.sh @@ -0,0 +1,7 @@ +if [ -z "$PROJECT_ID" ]; +then + echo "Project ID is not set" + exit 1 +fi + +ccp-cli manage cloud update-permissions --project-id $PROJECT_ID \ No newline at end of file From 70254daad594b5ed236f6fa4037aae76a7f820d9 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 19:57:53 -0500 Subject: [PATCH 06/22] basic integration tests --- .github/workflows/porter_stack_integration-test-provisioning.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 2c29a21..dd0ba83 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -25,3 +25,4 @@ jobs: PORTER_STACK_NAME: integration-test-provisioning PORTER_TAG: ${{ steps.vars.outputs.sha_short }} PORTER_TOKEN: ${{ secrets.PORTER_STACK_8_11 }} + GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} From 7920bdcd9120f5a0d3f1eba4f0ff2d91e929781b Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 20:23:04 -0500 Subject: [PATCH 07/22] basic integration tests --- .../porter_stack_integration-test-provisioning.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index dd0ba83..f5a1733 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -14,6 +14,11 @@ jobs: run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Setup porter uses: porter-dev/setup-porter@v0.1.0 + - name: Pull unauthenticated images + run: | + docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest + env: + GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} - name: Deploy stack timeout-minutes: 30 run: exec porter apply @@ -25,4 +30,3 @@ jobs: PORTER_STACK_NAME: integration-test-provisioning PORTER_TAG: ${{ steps.vars.outputs.sha_short }} PORTER_TOKEN: ${{ secrets.PORTER_STACK_8_11 }} - GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} From 115febd1d2435e43dda3cf83f2dccde7ecf4c116 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 20:52:14 -0500 Subject: [PATCH 08/22] remove ack fix --- .../porter_stack_integration-test-provisioning.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index f5a1733..dfd249d 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -14,6 +14,12 @@ jobs: run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Setup porter uses: porter-dev/setup-porter@v0.1.0 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.IMAGE_BUILD_TOKEN }} - name: Pull unauthenticated images run: | docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest From ce15479245d765b8cd4e8828d778f5d254ab9198 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 20:58:03 -0500 Subject: [PATCH 09/22] remove ack fix --- .../workflows/porter_stack_integration-test-provisioning.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index dfd249d..99dfad5 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -18,7 +18,7 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} + username: portersupport password: ${{ secrets.IMAGE_BUILD_TOKEN }} - name: Pull unauthenticated images run: | From 534637c91d2be44edda0ae5ec58bd5d297962cda Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 20:59:19 -0500 Subject: [PATCH 10/22] remove ack fix --- .../porter_stack_integration-test-provisioning.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 99dfad5..5d70146 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -14,14 +14,9 @@ jobs: run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Setup porter uses: porter-dev/setup-porter@v0.1.0 - - 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: | + echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest env: GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} From 5189b1dead313280398b8071fe5af4072067eb43 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 21:00:37 -0500 Subject: [PATCH 11/22] remove ack fix --- .../workflows/porter_stack_integration-test-provisioning.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 5d70146..99cb186 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -6,6 +6,10 @@ name: Deploy to integration-test-provisioning jobs: porter-deploy: runs-on: ubuntu-latest + permissions: + contents: read + packages: read + steps: - name: Checkout code uses: actions/checkout@v3 From 2d46ade42ea51a79248df7d2e52a8a96564366ca Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 21:03:46 -0500 Subject: [PATCH 12/22] remove ack fix --- .../workflows/porter_stack_integration-test-provisioning.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 99cb186..57c60e7 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -20,7 +20,7 @@ jobs: uses: porter-dev/setup-porter@v0.1.0 - name: Pull unauthenticated images run: | - echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin + echo $GITHUB_TOKEN | docker login ghcr.io -u portersupport --password-stdin docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest env: GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} From a6bd57549b16fff69d34f239994591406e1f03d0 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Wed, 6 Mar 2024 21:09:00 -0500 Subject: [PATCH 13/22] remove ack fix --- .../porter_stack_integration-test-provisioning.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/porter_stack_integration-test-provisioning.yml b/.github/workflows/porter_stack_integration-test-provisioning.yml index 57c60e7..ab2f92c 100644 --- a/.github/workflows/porter_stack_integration-test-provisioning.yml +++ b/.github/workflows/porter_stack_integration-test-provisioning.yml @@ -6,10 +6,6 @@ name: Deploy to integration-test-provisioning jobs: porter-deploy: runs-on: ubuntu-latest - permissions: - contents: read - packages: read - steps: - name: Checkout code uses: actions/checkout@v3 @@ -18,12 +14,15 @@ jobs: run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Setup porter uses: porter-dev/setup-porter@v0.1.0 + - 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: | - echo $GITHUB_TOKEN | docker login ghcr.io -u portersupport --password-stdin docker pull ghcr.io/porter-dev/cluster-control-plane/ccp-cli:latest - env: - GITHUB_TOKEN: ${{ secrets.IMAGE_BUILD_TOKEN }} - name: Deploy stack timeout-minutes: 30 run: exec porter apply From dfcb28165f0b3af7d5bf750f64a91e255fb28ee6 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Thu, 7 Mar 2024 17:59:25 -0500 Subject: [PATCH 14/22] remove shared vpc name check --- provisioning/testdata/update-cluster.sh | 3 ++- provisioning/testdata/update-permissions.sh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 4003479..57af391 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -1,4 +1,5 @@ -# Create/update cluster using environment variables +#! /bin/bash + contractname=cluster-basic-no-id.json if [ -z "$PROJECT_ID" ]; diff --git a/provisioning/testdata/update-permissions.sh b/provisioning/testdata/update-permissions.sh index 3bbd76b..57483da 100755 --- a/provisioning/testdata/update-permissions.sh +++ b/provisioning/testdata/update-permissions.sh @@ -1,3 +1,5 @@ +#! /bin/bash + if [ -z "$PROJECT_ID" ]; then echo "Project ID is not set" From 8f7457d1863417a72830b1700cef05fce2634f07 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Fri, 8 Mar 2024 15:50:21 -0500 Subject: [PATCH 15/22] updating image --- provisioning/testdata/update-cluster.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 57af391..825dad0 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -7,24 +7,28 @@ 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 @@ -35,8 +39,7 @@ else envsubst < cluster-basic-with-id-template.json > apply-contract.json fi -clusterid=$(ccp-cli contract update -f apply-contract.json -o json | jq '.ClusterId') -echo "Cluster ID: $clusterid" +clusterid=$(ccp-cli manage contract update -f apply-contract.json -o json | jq '.ClusterId') NEXT_TYPE=$CURRENT_INSTANCE_TYPE CURRENT_TYPE=$NEXT_INSTANCE_TYPE From 609a2c35865a1010511dc427194e1805b7877434 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Fri, 8 Mar 2024 17:59:24 -0500 Subject: [PATCH 16/22] updating cli to nats --- provisioning/Dockerfile | 2 +- provisioning/testdata/update-cluster.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/provisioning/Dockerfile b/provisioning/Dockerfile index 41a5310..b87d8d4 100644 --- a/provisioning/Dockerfile +++ b/provisioning/Dockerfile @@ -5,7 +5,7 @@ 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 +RUN apt install -y gettext-base yq jq COPY --from=porter-cli /usr/local/bin/porter /usr/local/bin/porter diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 825dad0..9efc7b6 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -39,7 +39,8 @@ else envsubst < cluster-basic-with-id-template.json > apply-contract.json fi -clusterid=$(ccp-cli manage contract update -f apply-contract.json -o json | jq '.ClusterId') +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 From 1739227953d4d84431a85773d986a3d45521a1f3 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Fri, 8 Mar 2024 18:20:37 -0500 Subject: [PATCH 17/22] add deleting intg test --- provisioning/testdata/delete-cluster.sh | 42 +++++++++++++++++++++++++ provisioning/testdata/update-cluster.sh | 5 +++ 2 files changed, 47 insertions(+) create mode 100755 provisioning/testdata/delete-cluster.sh diff --git a/provisioning/testdata/delete-cluster.sh b/provisioning/testdata/delete-cluster.sh new file mode 100755 index 0000000..6b75c1d --- /dev/null +++ b/provisioning/testdata/delete-cluster.sh @@ -0,0 +1,42 @@ +#! /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" + +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" + +echo "Deleting cluster" +ccp-cli manage contract delete --project-id $PROJECT_ID --cluster-id $CLUSTER_ID + +NEXT_TYPE=$CURRENT_INSTANCE_TYPE +CURRENT_TYPE=$NEXT_INSTANCE_TYPE +CLUSTER_ID=0 + +echo "Updating values in Porter" + +envsubst < template-porter.yaml > porter.yaml +porter apply -f porter.yaml \ No newline at end of file diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 9efc7b6..4530dc3 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -euo pipefail contractname=cluster-basic-no-id.json @@ -39,11 +40,15 @@ else envsubst < cluster-basic-with-id-template.json > apply-contract.json fi +echo "Applying contract to cluster" 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 + +echo "Updating values in Porter" + envsubst < template-porter.yaml > porter.yaml porter apply -f porter.yaml \ No newline at end of file From a35a51d2f3236c727edd173be4457888b391dad4 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Fri, 8 Mar 2024 18:29:57 -0500 Subject: [PATCH 18/22] add deleting intg test --- provisioning/testdata/update-cluster.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 4530dc3..6a78eed 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -40,7 +40,7 @@ else envsubst < cluster-basic-with-id-template.json > apply-contract.json fi -echo "Applying contract to cluster" +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" From 233213c65da3428c60da09dec9423cd875a16350 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Fri, 8 Mar 2024 22:12:44 -0500 Subject: [PATCH 19/22] stdout writing --- provisioning/testdata/cluster-basic-no-id-template.json | 2 +- provisioning/testdata/cluster-basic-with-id-template.json | 2 +- provisioning/testdata/template-porter.yaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/provisioning/testdata/cluster-basic-no-id-template.json b/provisioning/testdata/cluster-basic-no-id-template.json index b8dcd67..19802a4 100644 --- a/provisioning/testdata/cluster-basic-no-id-template.json +++ b/provisioning/testdata/cluster-basic-no-id-template.json @@ -3,7 +3,7 @@ "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", "eksKind": { - "clusterName": "stefan-test", + "clusterName": "integration-test", "clusterVersion": "v1.27.0", "loadBalancer": {}, "logging": {}, diff --git a/provisioning/testdata/cluster-basic-with-id-template.json b/provisioning/testdata/cluster-basic-with-id-template.json index df01921..f5946f9 100644 --- a/provisioning/testdata/cluster-basic-with-id-template.json +++ b/provisioning/testdata/cluster-basic-with-id-template.json @@ -3,7 +3,7 @@ "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", "eksKind": { - "clusterName": "stefan-test", + "clusterName": "integration-test", "clusterVersion": "v1.27.0", "loadBalancer": {}, "logging": {}, diff --git a/provisioning/testdata/template-porter.yaml b/provisioning/testdata/template-porter.yaml index 0329ad7..2dc69d9 100644 --- a/provisioning/testdata/template-porter.yaml +++ b/provisioning/testdata/template-porter.yaml @@ -1,10 +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 + 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 From 4a9b84fb6ed26890d613c6a82b3753407dd51fe1 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Mon, 11 Mar 2024 16:56:26 -0400 Subject: [PATCH 20/22] change account Id --- provisioning/testdata/cluster-basic-no-id-template.json | 2 +- provisioning/testdata/cluster-basic-with-id-template.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/provisioning/testdata/cluster-basic-no-id-template.json b/provisioning/testdata/cluster-basic-no-id-template.json index 19802a4..d58305e 100644 --- a/provisioning/testdata/cluster-basic-no-id-template.json +++ b/provisioning/testdata/cluster-basic-no-id-template.json @@ -1,7 +1,7 @@ { "cluster": { "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", - "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", + "cloudProviderCredentialsId": "arn:aws:iam::081277119371:role/porter-manager", "eksKind": { "clusterName": "integration-test", "clusterVersion": "v1.27.0", diff --git a/provisioning/testdata/cluster-basic-with-id-template.json b/provisioning/testdata/cluster-basic-with-id-template.json index f5946f9..c4f4a04 100644 --- a/provisioning/testdata/cluster-basic-with-id-template.json +++ b/provisioning/testdata/cluster-basic-with-id-template.json @@ -1,7 +1,7 @@ { "cluster": { "cloudProvider": "ENUM_CLOUD_PROVIDER_AWS", - "cloudProviderCredentialsId": "arn:aws:iam::026281491146:role/porter-manager", + "cloudProviderCredentialsId": "arn:aws:iam::081277119371:role/porter-manager", "eksKind": { "clusterName": "integration-test", "clusterVersion": "v1.27.0", From 1b008725d0b7eb35c71f877522b9c1993307ddb3 Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Mon, 11 Mar 2024 18:28:08 -0400 Subject: [PATCH 21/22] updating envs --- provisioning/testdata/delete-cluster.sh | 20 +++----------------- provisioning/testdata/update-cluster.sh | 4 ++++ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/provisioning/testdata/delete-cluster.sh b/provisioning/testdata/delete-cluster.sh index 6b75c1d..01f77e8 100755 --- a/provisioning/testdata/delete-cluster.sh +++ b/provisioning/testdata/delete-cluster.sh @@ -15,26 +15,12 @@ then 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" - echo "Deleting cluster" ccp-cli manage contract delete --project-id $PROJECT_ID --cluster-id $CLUSTER_ID -NEXT_TYPE=$CURRENT_INSTANCE_TYPE -CURRENT_TYPE=$NEXT_INSTANCE_TYPE -CLUSTER_ID=0 +export NEXT_INSTANCE_TYPE="t3.large" +export CURRENT_INSTANCE_TYPE="t3.medium" +export CLUSTER_ID="0" echo "Updating values in Porter" diff --git a/provisioning/testdata/update-cluster.sh b/provisioning/testdata/update-cluster.sh index 6a78eed..f113e4f 100755 --- a/provisioning/testdata/update-cluster.sh +++ b/provisioning/testdata/update-cluster.sh @@ -48,6 +48,10 @@ 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 From 34cb025d7c9da4a8de0b4582ce4ab1e4290bd32c Mon Sep 17 00:00:00 2001 From: Stefan McShane Date: Tue, 12 Mar 2024 11:17:06 -0400 Subject: [PATCH 22/22] readme updates --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e708d06..0b26fc3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ # app-integration-tests Permissions needed for Github API: + - Workflows (Read & Write) - Contents (Read & Write) -- Actions (Read & Write) \ No newline at end of file +- Actions (Read & Write) + +# 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