Skip to content

Gen2 migrations execute #14192

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

Merged
merged 3 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .circleci/local_publish_helpers_codebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,29 @@ function runE2eTestCb {
fi
}

function runGen2MigrationsE2ETestCb {
_setupCoverage
FAILED_TEST_REGEX_FILE="./amplify-migration-e2e-reports/amplify-migration-e2e-failed-test.txt"

if [ -f $FAILED_TEST_REGEX_FILE ]; then
# read the content of failed tests
failedTests=$(<$FAILED_TEST_REGEX_FILE)
if [[ ! -z "$DISABLE_COVERAGE" ]]; then
echo Running WITHOUT coverage
yarn e2e --forceExit --no-cache --maxWorkers=4 $TEST_SUITE -t "$failedTests"
else
NODE_V8_COVERAGE=$E2E_TEST_COVERAGE_DIR yarn e2e-migration --forceExit --no-cache --maxWorkers=4 $TEST_SUITE -t "$failedTests"
fi
else
if [[ ! -z "$DISABLE_COVERAGE" ]]; then
echo Running WITHOUT coverage
yarn e2e --forceExit --no-cache --maxWorkers=4 $TEST_SUITE
else
NODE_V8_COVERAGE=$E2E_TEST_COVERAGE_DIR yarn e2e-migration --forceExit --no-cache --maxWorkers=4 $TEST_SUITE
fi
fi
}

function _setupCoverage {
_teardownCoverage
echo "Setup Coverage ($E2E_TEST_COVERAGE_DIR)"
Expand Down
55 changes: 55 additions & 0 deletions codebuild_specs/run_gen2_migrations_e2e_tests_linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: 0.2
env:
shell: bash
variables:
E2E_TEST_COVERAGE_DIR: node_v8_coverage
CI: true
CIRCLECI: true
IS_AMPLIFY_CI: true
# mock values to test artifact scanning
ENV_VAR_WITH_SECRETS: 'MOCK_ENV_VAR_FOR_SCANNING_SECRETS'
MOCK_ENV_VAR_FOR_SCANNING_SECRETS: 'abc123xyz'

# mock values for credentials below
FACEBOOK_APP_ID: 'fbAppId'
FACEBOOK_APP_SECRET: 'fbAppSecret'
GOOGLE_APP_ID: 'gglAppID'
GOOGLE_APP_SECRET: 'gglAppSecret'
AMAZON_APP_ID: 'amaznAppID'
AMAZON_APP_SECRET: 'amaznAppID'
APPLE_APP_ID: 'com.fake.app'
APPLE_TEAM_ID: '2QLEWNDK6K'
APPLE_KEY_ID: '2QLZXKYJ8J'
# mock value, Cognito validates the private key, this is an invalidated key.
APPLE_PRIVATE_KEY_2: '----BEGIN PRIVATE KEY-----MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgIltgNsTgTfSzUadYiCS0VYtDDMFln/J8i1yJsSIw5g+gCgYIKoZIzj0DAQehRANCAASI8E0L/DhR/mIfTT07v3VwQu6q8I76lgn7kFhT0HvWoLuHKGQFcFkXXCgztgBrprzd419mUChAnKE6y89bWcNw----END PRIVATE KEY----'
phases:
build:
commands:
# you can provide a codebuild source version to use old cache and skip all other jobs :)
- export NODE_OPTIONS=--max-old-space-size=4096
- export AMPLIFY_DIR=$CODEBUILD_SRC_DIR/out
- export AMPLIFY_PATH=$CODEBUILD_SRC_DIR/out/amplify-pkg-linux-x64
- echo $AMPLIFY_DIR
- echo $AMPLIFY_PATH
- npm install -g ts-node
- source ./shared-scripts.sh && _runGen2MigrationE2ETestsLinux
post_build:
commands:
- source ./shared-scripts.sh && _convertCoverage # && _uploadCoverageLinux (disabled while troubleshooting E2E test failures during initial CodeBuild setup)
- source ./shared-scripts.sh && _scanArtifacts
- source ./shared-scripts.sh && _uploadReportsToS3 $CODEBUILD_SOURCE_VERSION $CODEBUILD_BATCH_BUILD_IDENTIFIER amplify-migration-e2e
artifacts:
files:
- '$E2E_TEST_COVERAGE_DIR/*'
- amplify-migration-e2e-reports/*
base-directory: packages/amplify-migration-e2e/
reports:
e2e-reports:
files:
- '*.xml'
file-format: 'JUNITXML'
base-directory: '$CODEBUILD_SRC_DIR/packages/amplify-migration-e2e/junit'
e2e-coverage-report:
files:
- 'packages/amplify-migration-e2e/coverage/clover.xml'
file-format: CLOVERXML
2 changes: 1 addition & 1 deletion shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function _runGen2MigrationE2ETestsLinux {
amplify version
cd packages/amplify-migration-e2e
_loadTestAccountCredentials
retry runE2eTestCb
retry runGen2MigrationsE2ETestCb
}

function _unassumeTestAccountCredentials {
Expand Down
Loading