From a44746697696e8cc03696e8f378b6276b535d1c9 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 08:12:29 -0500 Subject: [PATCH 1/7] add 7 days retention logs --- serverless.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/serverless.yaml b/serverless.yaml index 28eb995421..25eb584a84 100644 --- a/serverless.yaml +++ b/serverless.yaml @@ -12,6 +12,7 @@ provider: role: name: lambda-perf-${sls:stage}-role-${aws:region} timeout: 900 + logRetentionInDays: 7 iamRoleStatements: - Effect: Allow Action: "logs:CreateLogGroup" From 198acab81d5957699c125b24d1c889e3eb76af35 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 15:43:31 -0500 Subject: [PATCH 2/7] disable rule for staging --- .github/workflows/aws-deploy.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index d4a3f06aa2..7fa93c8012 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -68,6 +68,9 @@ jobs: export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') sls deploy --force - - - + - name: Remove the cron job scheduler in staging (eu-west-1) + if: "${{ inputs.region == 'eu-west-1' }}" + run: | + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file From 804bd82cb886e184f52ae6aa05b732265a7fb072 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 15:45:25 -0500 Subject: [PATCH 3/7] disable rule for staging --- .github/workflows/aws-deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index 7fa93c8012..721454694f 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -73,4 +73,7 @@ jobs: run: | RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file From 581505ae792b7df02102667c2018e67d257ab4c1 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 17:10:26 -0500 Subject: [PATCH 4/7] add rust cache --- .github/workflows/aws-deploy.yml | 59 ++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index 721454694f..ec1641798d 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -27,6 +27,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: AWS Authentication env: AWS_MFA_ARN: ${{ secrets.RESTRICTED_AWS_MFA_ARN }} @@ -52,28 +61,28 @@ jobs: run: cargo test - name: build run: ./build.sh - - name: install dependencies - run: | - cd ./result-builder && yarn install - - name: install Serverless Framework - run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local - - name: deploy - env: - AWS_REGION: ${{ inputs.region }} - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} - LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} - run: | - export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') - export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') - export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') - sls deploy --force - - name: Remove the cron job scheduler in staging (eu-west-1) - if: "${{ inputs.region == 'eu-west-1' }}" - run: | - RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - echo "Disabling rule ${RULE_NAME}" - aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} - RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - echo "Disabling rule ${RULE_NAME}" - aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file + # - name: install dependencies + # run: | + # cd ./result-builder && yarn install + # - name: install Serverless Framework + # run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local + # - name: deploy + # env: + # AWS_REGION: ${{ inputs.region }} + # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + # GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} + # LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} + # run: | + # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + # sls deploy --force + # - name: Remove the cron job scheduler in staging (eu-west-1) + # if: "${{ inputs.region == 'eu-west-1' }}" + # run: | + # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + # echo "Disabling rule ${RULE_NAME}" + # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} + # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + # echo "Disabling rule ${RULE_NAME}" + # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file From 4579e3da07f7dc550a9d3d474d90384d0ecb7c52 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 17:15:55 -0500 Subject: [PATCH 5/7] enable cache --- .github/workflows/aws-deploy.yml | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index ec1641798d..74b4f8bd74 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -61,28 +61,28 @@ jobs: run: cargo test - name: build run: ./build.sh - # - name: install dependencies - # run: | - # cd ./result-builder && yarn install - # - name: install Serverless Framework - # run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local - # - name: deploy - # env: - # AWS_REGION: ${{ inputs.region }} - # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - # GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} - # LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} - # run: | - # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') - # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') - # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') - # sls deploy --force - # - name: Remove the cron job scheduler in staging (eu-west-1) - # if: "${{ inputs.region == 'eu-west-1' }}" - # run: | - # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - # echo "Disabling rule ${RULE_NAME}" - # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} - # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - # echo "Disabling rule ${RULE_NAME}" - # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file + - name: install dependencies + run: | + cd ./result-builder && yarn install + - name: install Serverless Framework + run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local + - name: deploy + env: + AWS_REGION: ${{ inputs.region }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} + LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} + run: | + export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + sls deploy --force + - name: Remove the cron job scheduler in staging (eu-west-1) + if: "${{ inputs.region == 'eu-west-1' }}" + run: | + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file From 77ba96de8901501470eda3f336995a433b3f86de Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 17:25:28 -0500 Subject: [PATCH 6/7] cache --- .github/workflows/aws-deploy.yml | 47 +++++++++++++++++--------------- Cargo.toml | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index 74b4f8bd74..6ec98a1b52 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -64,25 +64,28 @@ jobs: - name: install dependencies run: | cd ./result-builder && yarn install - - name: install Serverless Framework - run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local - - name: deploy - env: - AWS_REGION: ${{ inputs.region }} - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} - LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} - run: | - export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') - export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') - export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') - sls deploy --force - - name: Remove the cron job scheduler in staging (eu-west-1) - if: "${{ inputs.region == 'eu-west-1' }}" - run: | - RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - echo "Disabling rule ${RULE_NAME}" - aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} - RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - echo "Disabling rule ${RULE_NAME}" - aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file + # - name: install Serverless Framework + # run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local + # - name: deploy + # env: + # AWS_REGION: ${{ inputs.region }} + # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + # GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} + # LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} + # run: | + # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + # sls deploy --force + # - name: Remove the cron job scheduler in staging (eu-west-1) + # if: "${{ inputs.region == 'eu-west-1' }}" + # run: | + # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + # echo "Disabling rule ${RULE_NAME}" + # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} + # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + # echo "Disabling rule ${RULE_NAME}" + # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 30e28c18c5..5485955c52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [workspace] - members = [ "function-trigger-deployer-rs", "function-deployer-rs", @@ -7,6 +6,7 @@ members = [ "function-report-log-processor-rs", "common_lib" ] +resolver = "2" [profile.release] opt-level = 'z' From af5705b7b5d0c52eeaadc225544e8af503b26dac Mon Sep 17 00:00:00 2001 From: Maxime David Date: Tue, 5 Mar 2024 17:26:44 -0500 Subject: [PATCH 7/7] cache --- .github/workflows/aws-deploy.yml | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index 6ec98a1b52..e803455204 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -64,28 +64,28 @@ jobs: - name: install dependencies run: | cd ./result-builder && yarn install - # - name: install Serverless Framework - # run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local - # - name: deploy - # env: - # AWS_REGION: ${{ inputs.region }} - # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - # GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} - # LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} - # run: | - # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') - # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') - # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') - # sls deploy --force - # - name: Remove the cron job scheduler in staging (eu-west-1) - # if: "${{ inputs.region == 'eu-west-1' }}" - # run: | - # export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') - # export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') - # export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') - # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - # echo "Disabling rule ${RULE_NAME}" - # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} - # RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') - # echo "Disabling rule ${RULE_NAME}" - # aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file + - name: install Serverless Framework + run: sudo yarn global add serverless@^3.27.0 --prefix /usr/local + - name: deploy + env: + AWS_REGION: ${{ inputs.region }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} + LAMBDA_PERF_ENV: ${{ inputs.lambdaPerfEnv }} + run: | + export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + sls deploy --force + - name: Remove the cron job scheduler in staging (eu-west-1) + if: "${{ inputs.region == 'eu-west-1' }}" + run: | + export AWS_ACCESS_KEY_ID=$(cat /tmp/creds_json | jq .Credentials.AccessKeyId |tr -d '"') + export AWS_SECRET_ACCESS_KEY=$(cat /tmp/creds_json | jq .Credentials.SecretAccessKey| tr -d '"') + export AWS_SESSION_TOKEN=$(cat /tmp/creds_json | jq .Credentials.SessionToken|tr -d '"') + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-functionTriggerDeployerRs --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} + RULE_NAME=$(aws events list-rule-names-by-target --target-arn arn:aws:lambda:${{ inputs.region }}:${{ secrets.AWS_ACCOUNT_ID }}:function:lambda-perf-dev-resultBuilder --region ${{ inputs.region }} | jq -r '.RuleNames[0]') + echo "Disabling rule ${RULE_NAME}" + aws events disable-rule --name $RULE_NAME --region ${{ inputs.region }} \ No newline at end of file