Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f08b4f3
add package policy infra and update gcp and kspm integrations
gurevichdmitry Sep 28, 2023
a96b868
update cnvm integration package install
gurevichdmitry Sep 28, 2023
f517be8
update kspm eks integration package install
gurevichdmitry Sep 28, 2023
f31b483
update cspm aws integration package install
gurevichdmitry Sep 28, 2023
331b685
Merge branch 'main' into upgade-workflow
gurevichdmitry Oct 2, 2023
74a0d8f
add upgrade flow
gurevichdmitry Oct 3, 2023
8265213
added support for installing CNVM with correct template version
gurevichdmitry Oct 3, 2023
11f8df5
Merge pull request #193 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
db12572
update reuse workflow inputs
gurevichdmitry Oct 4, 2023
3d2acd2
Merge pull request #194 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
a3ab3ee
update inputs type
gurevichdmitry Oct 4, 2023
4987797
Merge pull request #195 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
51b360f
update additional input types
gurevichdmitry Oct 4, 2023
d498217
Merge pull request #196 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
bba5419
update additional input types
gurevichdmitry Oct 4, 2023
e148288
Merge pull request #197 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
e44b3e8
add secrets reuse workflow
gurevichdmitry Oct 4, 2023
fea2a2e
Merge pull request #198 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 4, 2023
a8b333d
Merge branch 'main' into upgade-workflow
gurevichdmitry Oct 12, 2023
ff4c2f0
update release version calculation
gurevichdmitry Oct 12, 2023
451b87d
Merge branch 'elastic:main' into main
gurevichdmitry Oct 12, 2023
22f0d2f
Merge branch 'main' into upgade-workflow
gurevichdmitry Oct 12, 2023
1cfa6e7
Merge pull request #199 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 12, 2023
655734c
remove usage of override docker image for released version provision
gurevichdmitry Oct 12, 2023
9a556ca
Merge remote-tracking branch 'origin/upgade-workflow' into upgade-wor…
gurevichdmitry Oct 12, 2023
2ec60a7
Merge pull request #200 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 12, 2023
c423776
add custom tags support
gurevichdmitry Oct 15, 2023
53512b7
Merge pull request #201 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 15, 2023
4c20a96
update cnvm tag pattern
gurevichdmitry Oct 15, 2023
32d1a8b
Merge pull request #202 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 15, 2023
7d5bf95
update workflows
gurevichdmitry Oct 15, 2023
7645e22
Merge pull request #203 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 15, 2023
ad41b51
add ec api key support
gurevichdmitry Oct 16, 2023
ff5de40
Merge pull request #204 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 16, 2023
be5efe1
update env var for sanity tests
gurevichdmitry Oct 16, 2023
9376ff8
Merge pull request #205 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 16, 2023
04dd45c
add upgrade kspm unmanaged agent
gurevichdmitry Oct 16, 2023
0f3a1d4
Merge pull request #206 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 16, 2023
80d0a3c
temporary code for testing identity provider
gurevichdmitry Oct 17, 2023
183bd6f
Merge pull request #207 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 17, 2023
9c5f4bf
add token permissions
gurevichdmitry Oct 17, 2023
435aaaa
Merge pull request #208 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 17, 2023
e6fe3d2
add eks agent upgrade action
gurevichdmitry Oct 17, 2023
2ec0281
Merge pull request #209 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 17, 2023
b69a763
add cnvm agent upgrade
gurevichdmitry Oct 18, 2023
2a34ddd
Merge pull request #210 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 18, 2023
0c53c5a
update file path
gurevichdmitry Oct 18, 2023
4f8f1d6
Merge pull request #211 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 18, 2023
602a4a8
update file path
gurevichdmitry Oct 19, 2023
89c1d3d
Merge pull request #212 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 19, 2023
e8a35af
add sanity checks after upgrade
gurevichdmitry Oct 25, 2023
8ce2346
Merge pull request #213 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 25, 2023
c043e0a
update jobs dependency and add prev stack version
gurevichdmitry Oct 25, 2023
2ae1070
Merge pull request #214 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 25, 2023
ce53d90
add upgrade all linux agents
gurevichdmitry Oct 26, 2023
806863a
Merge pull request #215 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 26, 2023
65d65cc
add logging to upgrade agents events and waiter for packages upgrade
gurevichdmitry Oct 29, 2023
c19528c
Merge pull request #216 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 29, 2023
dd5a57f
change logic to update agents one by one
gurevichdmitry Oct 29, 2023
582a28c
Merge pull request #217 from gurevichdmitry/upgade-workflow
gurevichdmitry Oct 29, 2023
23bd735
Merge branch 'main' into upgade-workflow
gurevichdmitry Oct 30, 2023
b301999
replace raise error by logging warning message
gurevichdmitry Oct 30, 2023
6060df1
Merge remote-tracking branch 'origin/upgade-workflow' into upgade-wor…
gurevichdmitry Oct 30, 2023
7642fb9
adding readme file
gurevichdmitry Nov 1, 2023
7e68bb7
Merge branch 'main' into upgade-workflow
gurevichdmitry Nov 1, 2023
6ea8e0f
update sleep timeout
gurevichdmitry Nov 2, 2023
86e70f4
Merge pull request #218 from gurevichdmitry/upgade-workflow
gurevichdmitry Nov 2, 2023
4ade8f2
Merge branch 'main' into upgade-workflow
oren-zohar Nov 5, 2023
1ef9a5d
Update deploy/test-environments/fleet_api/src/upgrade_cnvm.py
gurevichdmitry Nov 5, 2023
0b8e5e9
fix review comments
gurevichdmitry Nov 5, 2023
62f98ea
Merge pull request #219 from gurevichdmitry/upgade-workflow
gurevichdmitry Nov 5, 2023
a34f32f
fix timeout and enable workflow
gurevichdmitry Nov 6, 2023
83038a0
Merge pull request #220 from gurevichdmitry/gcp-timeout
gurevichdmitry Nov 6, 2023
5f7b3a2
add id to test action flow
gurevichdmitry Nov 6, 2023
f3ccecf
add env var stack version
gurevichdmitry Nov 6, 2023
76dd333
update env vars
gurevichdmitry Nov 6, 2023
d6e2f15
Merge pull request #221 from gurevichdmitry/gcp-timeout
gurevichdmitry Nov 6, 2023
9038167
update id
gurevichdmitry Nov 6, 2023
1f5c9e5
update env vars
gurevichdmitry Nov 6, 2023
ffb496d
Merge pull request #222 from gurevichdmitry/gcp-timeout
gurevichdmitry Nov 6, 2023
2dd47bd
remove id
gurevichdmitry Nov 6, 2023
bc8d0cc
update timeout and period config
gurevichdmitry Nov 7, 2023
e36325d
Merge pull request #223 from gurevichdmitry/gcp-timeout
gurevichdmitry Nov 7, 2023
3f8f135
add id
gurevichdmitry Nov 7, 2023
ff025a0
Merge branch 'elastic:main' into main
gurevichdmitry Nov 7, 2023
2757bd5
Update test_sanity_checks.py
gurevichdmitry Nov 7, 2023
0fcaff1
Update gcp-ci.yml
gurevichdmitry Nov 7, 2023
4da12a3
remove id
gurevichdmitry Nov 7, 2023
ba9c0b3
remove env var
gurevichdmitry Nov 7, 2023
75f395b
Update gcp-ci.yml
gurevichdmitry Nov 7, 2023
be08587
Update test_sanity_checks.py
gurevichdmitry Nov 7, 2023
557bc0e
add run-tests id
gurevichdmitry Nov 7, 2023
46d33e6
Update gcp-ci.yml
gurevichdmitry Nov 7, 2023
7ccd84e
update commands
gurevichdmitry Nov 7, 2023
e17ae42
Merge branch 'main' into gcp-timeout
gurevichdmitry Nov 7, 2023
ff6f463
update commands
gurevichdmitry Nov 7, 2023
697a04e
Merge remote-tracking branch 'origin/gcp-timeout' into gcp-timeout
gurevichdmitry Nov 7, 2023
abd7a2f
update flow
gurevichdmitry Nov 7, 2023
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
13 changes: 11 additions & 2 deletions .github/workflows/gcp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
jobs:
Run-CSPM-GCP-Tests:
name: CIS GCP integration test
if: false
runs-on: ubuntu-22.04
timeout-minutes: 60
permissions:
Expand Down Expand Up @@ -68,7 +67,17 @@ jobs:
USE_K8S: false
run: |
poetry install
poetry run pytest -k "cspm_gcp" --alluredir=./allure/results/ --clean-alluredir --maxfail=4
sleep 5
curl -X PUT "http://localhost:9200/*cloud_security_posture.findings*/_settings" -H "Content-Type: application/json" -d '{
"index.mapping.total_fields.limit": 2000
}'
poetry run pytest -k "cspm_gcp" --alluredir=./allure/results/ --clean-alluredir --maxfail=1

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: failure()
with:
limit-access-to-actor: true

- name: Print cloudbeat logs
if: always()
Expand Down
69 changes: 59 additions & 10 deletions .github/workflows/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ on:
required: true
description: "Stack version: For released/BC version use 8.x.y, for SNAPSHOT use 8.x.y-SNAPSHOT"
default: "8.10.0"
type: string
ess-region:
required: true
description: "Elastic Cloud deployment region"
default: "gcp-us-west2"
type: string
docker-image-override:
required: false
description: "Provide the full Docker image path to override the default image (e.g. for testing BC/SNAPSHOT)"
type: string
run-sanity-tests:
description: "Run sanity tests after provision"
default: false
Expand All @@ -33,6 +36,45 @@ on:
type: string
description: "**Optional** By default, the environment will be created in our Cloud Security Organization. If you want to use your own cloud account, enter your Elastic Cloud API key."
required: false
workflow_call:
inputs:
deployment_name:
description: Name of the deployment to create
type: string
required: true
elk-stack-version:
required: true
description: "Stack version: For released/BC version use 8.x.y, for SNAPSHOT use 8.x.y-SNAPSHOT"
default: "8.10.0"
type: string
ess-region:
required: true
description: "Elastic Cloud deployment region"
default: "gcp-us-west2"
type: string
docker-image-override:
required: false
description: "Provide the full Docker image path to override the default image (e.g. for testing BC/SNAPSHOT)"
type: string
run-sanity-tests:
description: "Run sanity tests after provision"
default: false
type: boolean
cleanup-env:
description: "Cleanup resources after provision"
default: false
type: boolean
ec-api-key:
type: string
description: "**Optional** By default, the environment will be created in our Cloud Security Organization. If you want to use your own cloud account, enter your Elastic Cloud API key."
required: false
outputs:
s3-bucket:
description: "Terraform state s3 bucket folder"
value: ${{ jobs.Deploy.outputs.deploy-s3-bucket }}
cnvm-stack-name:
description: "AWS CNVM integration stack name"
value: ${{ jobs.Deploy.outputs.aws-cnvm-stack-name }}

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -52,17 +94,20 @@ jobs:
run:
working-directory: ${{ env.WORKING_DIR }}
env:
TF_VAR_stack_version: ${{ github.event.inputs.elk-stack-version }}
TF_VAR_ess_region: ${{ github.event.inputs.ess-region }}
DEPLOYMENT_NAME: ${{ github.event.inputs.deployment_name }}
TF_VAR_stack_version: ${{ inputs.elk-stack-version }}
TF_VAR_ess_region: ${{ inputs.ess-region }}
DEPLOYMENT_NAME: ${{ inputs.deployment_name }}
S3_BASE_BUCKET: "s3://tf-state-bucket-test-infra"
DOCKER_IMAGE_OVERRIDE: ${{ github.event.inputs.docker-image-override }}
STACK_VERSION: ${{ github.event.inputs.elk-stack-version }}
CNVM_STACK_NAME: "${{ github.event.inputs.deployment_name }}-cnvm-sanity-test-stack"
DOCKER_IMAGE_OVERRIDE: ${{ inputs.docker-image-override }}
STACK_VERSION: ${{ inputs.elk-stack-version }}
CNVM_STACK_NAME: "${{ inputs.deployment_name }}-cnvm-sanity-test-stack"
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
outputs:
deploy-s3-bucket: ${{ steps.upload-state.outputs.s3-bucket-folder }}
aws-cnvm-stack-name: ${{ steps.upload-state.outputs.aws-cnvm-stack }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -73,7 +118,7 @@ jobs:

- name: Check Deployment Name
run: |
deployment_name="${{ github.event.inputs.deployment_name }}"
deployment_name="${{ inputs.deployment_name }}"

# Check length
if [ ${#deployment_name} -gt 20 ]; then
Expand All @@ -88,7 +133,7 @@ jobs:
fi

- name: Mask Sensitive Data
if: github.event.inputs.ec-api-key != ''
if: inputs.ec-api-key != ''
run: |
ec_api_key=$(jq -r '.inputs["ec-api-key"]' $GITHUB_EVENT_PATH)
echo "::add-mask::$ec_api_key"
Expand Down Expand Up @@ -178,13 +223,16 @@ jobs:
echo "CSPM_PUBLIC_IP=$CSPM_PUBLIC_IP" >> $GITHUB_ENV

- name: Upload tf state
id: upload-state
if: always()
env:
S3_BUCKET: "${{ env.S3_BASE_BUCKET }}/${{ env.DEPLOYMENT_NAME }}_${{ env.TF_STATE_FOLDER }}"
run: |
aws s3 cp "./terraform.tfstate" "${{ env.S3_BUCKET }}/terraform.tfstate"
aws s3 cp "${{ env.EC2_CSPM_KEY }}" "${{ env.S3_BUCKET }}/cspm.pem"
aws s3 cp "${{ env.EC2_KSPM_KEY }}" "${{ env.S3_BUCKET }}/kspm.pem"
echo "s3-bucket-folder=${{ env.S3_BUCKET }}" >> $GITHUB_OUTPUT
echo "aws-cnvm-stack=${{ env.CNVM_STACK_NAME }}" >> $GITHUB_OUTPUT

- name: Summary
if: success()
Expand Down Expand Up @@ -296,6 +344,7 @@ jobs:
aws s3 cp "${{ env.FLEET_API_DIR}}/kspm_d4c.yaml" "${{ env.S3_BUCKET }}/kspm_d4c.yaml"
aws s3 cp "${{ env.FLEET_API_DIR}}/kspm_eks.yaml" "${{ env.S3_BUCKET }}/kspm_eks.yaml"
aws s3 cp "${{ env.FLEET_API_DIR}}/cspm-linux.sh" "${{ env.S3_BUCKET }}/cspm-linux.sh"
aws s3 cp "${{ env.FLEET_API_DIR}}/state_data.json" "${{ env.S3_BUCKET }}/state_data.json"

- name: Wait for agents to enroll
id: wait-for-agents
Expand All @@ -304,13 +353,13 @@ jobs:
poetry run python src/agents_enrolled.py

- name: Run Sanity checks
if: ${{ success() && github.event.inputs.run-sanity-tests == 'true' }}
if: ${{ success() && inputs.run-sanity-tests == true }}
working-directory: ./tests
run: |
poetry install
poetry run pytest -m "sanity" --alluredir=./allure/results/ --clean-alluredir --maxfail=4

- name: Cleanup Environment
if: github.event.inputs.cleanup-env == 'true'
if: inputs.cleanup-env == 'true'
run: |
just delete-cloud-env ${{ env.DEPLOYMENT_NAME }} '' "false"
Loading