Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix postman workflow #294

Merged
merged 10 commits into from
Mar 30, 2023
16 changes: 13 additions & 3 deletions .github/workflows/performance-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ jobs:
with:
ref: main

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: maven

Comment on lines +58 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems this is added, but not required by any change below?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah is it for the /mvnw?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

# login to ECR to we can pull coord image from there
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -69,16 +76,19 @@ jobs:

# Use docker-compose to start required stack
# Pull JSON API image from ECR corresponding to latest commit on main branch
# Retag JSON API image to remove repository name since start script does not expect it
# Pull Stargate coordinator image from ECR corresponding to version dependency in project pom
# Retag images to remove repository name since start script does not expect it
# Print version of images used for verification
- name: Start Docker Compose
run: |
JSONTAG=$(git show -s --format="%H")
docker pull ${{ secrets.ECR_REPOSITORY }}/stargateio/${{ matrix.docker-image }}:$JSONTAG
docker image tag ${{ secrets.ECR_REPOSITORY }}/stargateio/${{ matrix.docker-image }}:$JSONTAG stargateio/${{ matrix.docker-image }}:$JSONTAG
SGTAG="$(./mvnw -f . help:evaluate -Dexpression=stargate.int-test.coordinator.image-tag -q -DforceStdout)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In copying steps from docker pull from this performance testing workflow for the new postman workflow, I realized that this workflow wasn't actually pulling the coordinator image from ECR. I updated both workflows with logic to pull the coordinator image according to the Stargate version referenced in the pom.

docker pull ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-68:$SGTAG
docker image tag ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-68:$SGTAG stargateio/coordinator-dse-68:$SGTAG
cd docker-compose
./start_dse_68_dev_mode.sh ${{ matrix.docker-flags }} -j $JSONTAG
docker-compose images
./start_dse_68_dev_mode.sh ${{ matrix.docker-flags }} -j $JSONTAG -t $SGTAG

# Install NB and required library
# See: https://github.com/AppImage/AppImageKit/wiki/FUSE
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/postman-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,56 @@ jobs:
COLLECTION_ID: 25879866-266032b1-1fe9-4abd-aee9-e6e4b335f921
ENVIRONMENT_ID: 12949543-2e78cf27-bd8c-43f2-909f-70a2b87d65fe
steps:
# force checkout of main branch so we get a SHA that will have a corresponding docker image tag in ECR
- uses: actions/checkout@v3
with:
ref: main

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: maven

# login to ECR to we can pull coord image from there
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Install Postman CLI
run: |
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh

- name: Login to Postman CLI
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
- name: Start Backend

# Run Stargate coordinator in developer mode to save time / resources
# Pull JSON API image from ECR corresponding to latest commit on main branch
# Pull Stargate coordinator image from ECR corresponding to version dependency in project pom
# Retag images to remove repository name since start script does not expect it
- name: Start Backend
run: |
JSONTAG=$(git show -s --format="%H")
docker pull ${{ secrets.ECR_REPOSITORY }}/stargateio/jsonapi:$JSONTAG
docker image tag ${{ secrets.ECR_REPOSITORY }}/stargateio/jsonapi:$JSONTAG stargateio/jsonapi:$JSONTAG
SGTAG="$(./mvnw -f . help:evaluate -Dexpression=stargate.int-test.coordinator.image-tag -q -DforceStdout)"
docker pull ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-68:$SGTAG
docker image tag ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-68:$SGTAG stargateio/coordinator-dse-68:$SGTAG
cd docker-compose
./start_dse_68_dev_mode.sh
./start_dse_68_dev_mode.sh -j $JSONTAG -t $SGTAG

- name: Run API test
run: |
postman collection run $COLLECTION_ID -e $ENVIRONMENT_ID --verbose

- name: Stop Backend
if: always()
run: |
Expand Down