@@ -26,22 +26,42 @@ stages:
2626developer_tests :
2727 stage : developer_tests
2828 rules :
29- - when : always # Run on all branches
30-
29+ - if : $CI_PIPELINE_SOURCE == "merge_request_event"
30+ when : always # Only run on merge requests (PRs), not on merged branches
31+
3132 before_script :
3233 - python --version
3334 - apt-get update -y
34- - apt-get install make -y
35- - pip install ruff
35+ - apt-get install make curl git -y
36+ # Fetch target branch for comparison in typecheck-pr
37+ - export TARGET_BRANCH="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}"
38+ - echo "MR target branch (CI_MERGE_REQUEST_TARGET_BRANCH_NAME):$TARGET_BRANCH"
39+ - git fetch origin $TARGET_BRANCH:$TARGET_BRANCH || echo "Could not fetch $TARGET_BRANCH branch"
40+ # Install uv
41+ - pip install uv
42+ # Create virtual environment
43+ - uv venv .venv
44+ - source .venv/bin/activate
45+ # Install Node.js and npm for basedpyright
46+ - curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
47+ - apt-get install -y nodejs
48+ - npm install -g basedpyright
49+ - uv pip install ruff
3650 # Install dependencies needed by publish.py for test imports
37- - pip install typer rich boto3
51+ - uv pip install typer rich boto3
3852 # Install test dependencies
39- - cd lib/idp_common_pkg && pip install -e ".[test]" && cd ../..
53+ - cd lib/idp_common_pkg && uv pip install -e ".[test]" && cd ../..
4054
4155 script :
4256 - make lint-cicd
57+ - echo "=== Type Checking Configuration ==="
58+ - echo "MR target branch:$TARGET_BRANCH"
59+ - echo "Comparing:$TARGET_BRANCH...HEAD"
60+ - echo "===================================="
61+ - echo ""
62+ - make typecheck-pr TARGET_BRANCH=$TARGET_BRANCH
4363 - make test-cicd -C lib/idp_common_pkg
44-
64+
4565 artifacts :
4666 paths :
4767 - lib/idp_common_pkg/test-reports/coverage.xml
@@ -53,6 +73,25 @@ developer_tests:
5373 junit : lib/idp_common_pkg/test-reports/test-results.xml
5474 expire_in : 1 week
5575
76+ deployment_validation :
77+ stage : deployment_validation
78+ rules :
79+ - when : on_success
80+
81+ before_script :
82+ - apt-get update -y
83+ - apt-get install curl unzip python3-pip -y
84+ # Install AWS CLI
85+ - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
86+ - unzip awscliv2.zip
87+ - ./aws/install
88+ # Install PyYAML for template analysis
89+ - pip install PyYAML
90+
91+ script :
92+ # Check if service role has sufficient permissions for main stack deployment
93+ - python3 scripts/validate_service_role_permissions.py
94+
5695integration_tests :
5796 stage : integration_tests
5897 timeout : 2h
@@ -61,9 +100,8 @@ integration_tests:
61100 # AWS_CREDS_TARGET_ROLE: ${AWS_CREDS_TARGET_ROLE}
62101 # AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
63102 # IDP_ACCOUNT_ID: ${IDP_ACCOUNT_ID}
64-
65- # Add rules to only run on develop branch
66- # Add rules to only run on develop branch
103+
104+ # Add rules to only run on develop branch
67105 rules :
68106 - if : $CI_COMMIT_BRANCH == "develop"
69107 when : on_success
@@ -78,44 +116,23 @@ integration_tests:
78116 - when : manual
79117
80118 before_script :
81- - python --version
82119 - apt-get update -y
83- - apt-get install zip unzip curl make -y
84-
85- # Install Poetry
86- - curl -sSL https://install.python-poetry.org | python3 -
87- - export PATH="/root/.local/bin:$PATH"
88- - poetry --version
89-
120+ - apt-get install zip unzip curl python3-pip -y
90121 # Install AWS CLI
91122 - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
92123 - unzip awscliv2.zip
93124 - ./aws/install
125+ # Install boto3 for Python script
126+ - pip install boto3
94127
95128 script :
96129 - aws --version
97130 - aws sts get-caller-identity --no-cli-pager
98- - cd ./scripts/sdlc/idp-cli
99- - poetry install
100- - make put
101- - make wait
102-
103- deployment_validation :
104- stage : deployment_validation
105- rules :
106- - when : on_success
107131
108- before_script :
109- - apt-get update -y
110- - apt-get install curl unzip python3-pip -y
111- # Install AWS CLI
112- - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
113- - unzip awscliv2.zip
114- - ./aws/install
115- # Install PyYAML for template analysis
116- - pip install PyYAML
132+ # Set environment variables for Python script
133+ - export IDP_ACCOUNT_ID=${IDP_ACCOUNT_ID:-020432867916}
134+ - export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1}
135+ - export IDP_PIPELINE_NAME=idp-sdlc-deploy-pipeline
117136
118- script :
119- # Check if service role has sufficient permissions for main stack deployment
120- - python3 scripts/validate_service_role_permissions.py
121-
137+ # Run integration test deployment
138+ - python3 scripts/integration_test_deployment.py
0 commit comments