Skip to content
Snippets Groups Projects
Commit dcee10ff authored by Derek Hudson's avatar Derek Hudson
Browse files

Merge branch 'aws-fix-integration-tests' into 'master'

Aws fix integration tests

See merge request !464
parents b17f244e a76c6c5c
No related branches found
No related tags found
1 merge request!464Aws fix integration tests
Pipeline #239499 failed
......@@ -156,9 +156,6 @@ azure_containerize:
azure_test:
image: community.opengroup.org:5555/osdu/platform/deployment-and-operations/base-containers-azure/azure-maven17:v0.0.1
aws-test-java:
image: $CI_REGISTRY/osdu/platform/deployment-and-operations/base-containers-aws/aws-maven/aws-maven:v2.1
fossa-analyze:
image: $CI_REGISTRY/divido/fossa-with-cache:v0.9-jdk17
......
......@@ -22,6 +22,42 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
file: "cloud-providers/aws-maven.yml"
aws-containerize:
extends:
- .aws
- .aws_common_variables
- .aws_variables
stage: containerize
needs: ['compile-and-unit-test']
script:
- |
if [ -z $AWS_BUILDER_DOCKERFILE_PATH ] && [ -z $AWS_RUNTIME_DOCKERFILE_PATH ]; then
echo Building BUILD_DIR/Dockerfile container
docker build -f $BUILD_DIR/Dockerfile -t $LOCAL_IMAGE_TAG .;
else
echo Building BUILDER->RUNTIME containers;
docker build -t builder:latest --file $AWS_BUILDER_DOCKERFILE_PATH .;
docker build -t $LOCAL_IMAGE_TAG --file $AWS_RUNTIME_DOCKERFILE_PATH --build-arg docker_builder_image=builder .;
fi
# Push to the local container registry
- export PUSH_ENDPOINT_ECR_TAG=`echo push_endpoint.${CI_COMMIT_SHA} | cut -c 1-120`
- export PUSH_ENDPOINT_IMAGE=${AWS_IMAGE_TAG_BASE}:${PUSH_ENDPOINT_ECR_TAG}
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $LOCAL_IMAGE_TAG
# Push to Amazon's container registry
- $(aws ecr get-login --no-include-email --region $AWS_ECR_REGION)
- docker tag $LOCAL_IMAGE_TAG $AWS_IMAGE_TAG_BASE:$CI_COMMIT_SHA
- docker tag $LOCAL_IMAGE_TAG $AWS_IMAGE_TAG_BASE:latest
- docker push $AWS_IMAGE_TAG_BASE:$CI_COMMIT_SHA
- docker push $AWS_IMAGE_TAG_BASE:latest
- export INTEGRATION_TEST_SOURCE_DIR_AWS=$(pwd)/testing/notification-test-aws
- $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint_image.sh
only:
variables:
- $AWS == '1'
aws-test-java:
image: $CI_REGISTRY/osdu/platform/deployment-and-operations/base-containers-aws/aws-maven/aws-maven:v2.1
extends:
......@@ -30,7 +66,6 @@ aws-test-java:
- .aws_common_variables
- .aws_variables
stage: integration
allow_failure: true
needs: [{ job: 'aws-update-tf', optional: true }, { job: 'aws-update-helm', optional: true }, { job: 'aws-update-eks', optional: true }]
retry: 1
before_script:
......@@ -41,8 +76,8 @@ aws-test-java:
- export KUBECONFIG=/tmp/kubeconfig-${RANDOM}.yaml
- aws eks update-kubeconfig --region $AWS_REGION --name $EKS_CLUSTER_NAME --role-arn $EKS_CLUSTER_MGMT_ROLE
- chmod 600 $KUBECONFIG
- pip3 install boto3
- export PUSH_ENDPOINT_PATH=testing/notification-test-aws/build-aws/push-endpoint
- pip3 install -r $PUSH_ENDPOINT_PATH/requirements.txt
- echo "PUSH_ENDPOINT_PATH ${PUSH_ENDPOINT_PATH}"
- python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --create --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml
- trap "python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --delete --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml" EXIT
......
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && mvn -B -ntp -s ./maven/settings.xml package)
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && docker build -t $PUSH_ENDPOINT_IMAGE -f Dockerfile --no-cache . && docker push $PUSH_ENDPOINT_IMAGE)
......@@ -36,7 +36,8 @@ echo $INTEGRATION_TEST_OUTPUT_DIR
echo $INTEGRATION_TEST_OUTPUT_BIN_DIR
# Build the Push Endpoint image
(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && mvn -B -ntp -s ./maven/settings.xml package && docker build -t $PUSH_ENDPOINT_IMAGE -f Dockerfile --no-cache . && docker push $PUSH_ENDPOINT_IMAGE)
$INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint.sh
$INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint_image.sh
# Finished building the Push Endpoint image
rm -rf "$INTEGRATION_TEST_OUTPUT_DIR"
......
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the “License”).
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
boto3==1.26.6
botocore==1.29.6
colorama==0.4.4
......@@ -330,9 +330,11 @@ class CommonParameters:
PolicyName=self.sa_role_policy_name,
PolicyDocument=permissions_policy)
role_arn = role["Role"]["Arn"]
print(f"Created role {role_arn}")
except self.iam_client.exceptions.EntityAlreadyExistsException:
role = self.iam_client.get_role(RoleName=service_role_name)
role_arn = role["Role"]["Arn"]
print(f"Using pre-existing role {role_arn}")
return role_arn
def create_k8s_file(self, queue_urls: typing.List[str],
......
......@@ -31,15 +31,16 @@ echo "$SCRIPT_SOURCE_DIR"
# see os-deploy-aws/build-aws/integration-test-env-variables.py for an updated list
PUSH_ENDPOINT_PATH=$SCRIPT_SOURCE_DIR/push-endpoint
pip3 install -r $PUSH_ENDPOINT_PATH/requirements.txt
python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --create --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml
trap "python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --delete --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml" EXIT
source $PUSH_ENDPOINT_PATH/environment_file.sh
export AWS_COGNITO_AUTH_FLOW=USER_PASSWORD_AUTH
export AWS_COGNITO_AUTH_PARAMS_PASSWORD=$ADMIN_PASSWORD
export AWS_COGNITO_AUTH_PARAMS_USER=$ADMIN_USER
export AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS=$USER_NO_ACCESS
export AWS_COGNITO_AUTH_PARAMS_PASSWORD=${AWS_COGNITO_AUTH_PARAMS_PASSWORD:-ADMIN_PASSWORD}
export AWS_COGNITO_AUTH_PARAMS_USER=${AWS_COGNITO_AUTH_PARAMS_USER:-ADMIN_USER}
export AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS=${AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS:-USER_NO_ACCESS}
export ENVIRONMENT=DEV
export NOTIFICATION_REGISTER_BASE_URL=$NOTIFICATION_REGISTER_BASE_URL
export REGISTER_CUSTOM_PUSH_PATH=/api/push-endpoint/0
......
......@@ -85,7 +85,7 @@ public class TestNotificationsEndpoint {
private final static ObjectMapper objectMapper = new ObjectMapper();
private static final int MAX_RETRIES = 5;
private static final int MAX_POLL_TIME = 120;
private static final int MAX_POLL_TIME = 240;
private static class PushQueue {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment