Skip to content

Commit

Permalink
update wf
Browse files Browse the repository at this point in the history
  • Loading branch information
gurevichdmitry committed Sep 11, 2024
1 parent 1caf75e commit 6f886df
Showing 1 changed file with 4 additions and 67 deletions.
71 changes: 4 additions & 67 deletions .github/workflows/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ 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
# TODO: remove
# cdr-infra:
# description: "Flag to indicate that the CDR infrastructure is being created"
# type: boolean
# required: false
# default: false
infra-type:
description: "Type of infrastructure to create"
type: string
Expand Down Expand Up @@ -193,7 +187,7 @@ jobs:
if [[ $is_serverless_mode == "true" ]]; then
# Stack version is not relevant for serverless deployments
# Therefore, we set it to the latest snapshot version
stack_version="${{ env.ELK_VERSION }}"
stack_version="${ELK_VERSION}"
fi
echo "TF_VAR_stack_version=$stack_version" >> $GITHUB_ENV
Expand Down Expand Up @@ -291,26 +285,6 @@ jobs:
TF_VAR_owner: ${{ github.actor }}
run: |
./manage_infrastructure.sh "$INFRA_TYPE" "apply"
# TODO: remove
# - name: Terraform Init
# run: terraform init

# - name: Terraform Validate
# run: terraform validate

# - name: Provision Test Environment (EC + EC2 K8s + EC2 CSPM)
# id: apply
# if: success()
# run: |
# terraform apply --auto-approve \
# -var="deployment_name=${{ env.DEPLOYMENT_NAME }}" \
# -var="region=${{ env.AWS_REGION }}" \
# -var="project=${{ github.actor }}" \
# -var="owner=${{ github.actor }}"

# - name: Set Environment Output
# id: env-output
# run: ../../.ci/scripts/set_cloud_env_params.sh
- name: Set Environment Output
id: env-output
Expand All @@ -329,42 +303,6 @@ jobs:
echo "aws-cnvm-stack=${CNVM_STACK_NAME}" >> $GITHUB_OUTPUT
python3 ../../.ci/scripts/create_env_config.py
aws s3 cp "./env_config.json" "${S3_BUCKET}/env_config.json"
# TODO: remove
# - name: Upload tf state
# id: upload-state
# if: always()
# env:
# S3_BUCKET: "${{ env.S3_BASE_BUCKET }}/${{ env.DEPLOYMENT_NAME }}_${{ env.TF_STATE_FOLDER }}"
# EXPIRATION_DAYS: ${{ inputs.expiration_days }}
# run: |
# aws s3 cp "./terraform.tfstate" "${S3_BUCKET}/terraform.tfstate"
# aws s3 cp "${EC2_CSPM_KEY}" "${S3_BUCKET}/cspm.pem"
# aws s3 cp "${EC2_KSPM_KEY}" "${S3_BUCKET}/kspm.pem"
# echo "s3-bucket-folder=${S3_BUCKET}" >> $GITHUB_OUTPUT
# echo "aws-cnvm-stack=${CNVM_STACK_NAME}" >> $GITHUB_OUTPUT
# python3 ../../.ci/scripts/create_env_config.py
# aws s3 cp "./env_config.json" "${S3_BUCKET}/env_config.json"
# if [[ ${TF_VAR_cdr_infra:-} == "true" ]]; then
# aws s3 cp "${CLOUDTRAIL_KEY}" "${S3_BUCKET}/cloudtrail.pem"
# aws s3 cp "${ACTIVITY_LOGS_KEY}" "${S3_BUCKET}/az_activity_logs.pem"
# aws s3 cp "${AUDIT_LOGS_KEY}" "${S3_BUCKET}/gcp_audit_logs.pem"
# fi
# TODO: remove
# - name: Summary
# if: success()
# run: |
# kibana_url=$(terraform output -raw kibana_url)
# summary="Kibana URL: $kibana_url"
# bucket_name="${{ env.S3_BASE_BUCKET }}"
# bucket_name="${bucket_name#s3://}"
# s3_bucket_link="[creds and keys](https://s3.console.aws.amazon.com/s3/buckets/$bucket_name)"
# summary=$(cat <<-EOF
# Kibana URL: [kibana]($kibana_url)
# Environment Details: $s3_bucket_link
# EOF
# )
# echo "$summary" >> $GITHUB_STEP_SUMMARY
# echo "$summary" # Print the summary to the workflow log
- name: Summary
if: success()
Expand Down Expand Up @@ -502,11 +440,10 @@ jobs:
env:
S3_BUCKET: "${{ env.S3_BASE_BUCKET }}/${{ env.DEPLOYMENT_NAME }}_${{ env.TF_STATE_FOLDER }}"
run: |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig \
--name $(terraform output -raw deployment_name) --alias eks-config
aws eks --region ${AWS_REGION} update-kubeconfig --name ${DEPLOYMENT_NAME} --alias eks-config
echo 'KUBE_CONFIG_DATA=$(cat ~/.kube/config | base64)' >> $GITHUB_ENV
kubectl config use-context eks-config
kubectl apply -f ../../${{ env.INTEGRATIONS_SETUP_DIR }}/kspm_d4c.yaml
kubectl apply -f ../../${INTEGRATIONS_SETUP_DIR}/kspm_d4c.yaml
- name: Install KSPM Unmanaged integration
id: kspm-unmanaged
Expand Down Expand Up @@ -562,7 +499,7 @@ jobs:
S3_BUCKET: "${{ env.S3_BASE_BUCKET }}/${{ env.DEPLOYMENT_NAME }}_${{ env.TF_STATE_FOLDER }}"
working-directory: ${{ env.INTEGRATIONS_SETUP_DIR }}
run: |
if [[$INFRA_TYPE != 'cdr']]; then
if [[ $INFRA_TYPE != 'cdr' ]]; then
aws s3 cp "./cspm-linux.sh" "$S3_BUCKET/cspm-linux.sh"
aws s3 cp "./kspm_unmanaged.yaml" "$S3_BUCKET/kspm_unmanaged.yaml"
aws s3 cp "./kspm_d4c.yaml" "$S3_BUCKET/kspm_d4c.yaml"
Expand Down

0 comments on commit 6f886df

Please sign in to comment.