Skip to content
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
3 changes: 1 addition & 2 deletions .buildkite/steps/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -uxo pipefail

########################################################
# We make an attempt to clean up the specific resources created during this pipeline elsewhere. However
# sometimes that fails, are various CloudFormation Stacks, S3 Buckets and CloudWatch Log Groups can be
# left around.
# sometimes that fails, and various CloudFormation Stacks and S3 Buckets left around.
#
# This is a safety net at the end of the build that attempts to delete any resources created by this
# pipeline more than a day ago, regardless of if they were created in the current build or not.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we making any changes to this cleanup process, or just updating the comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they're referring to logs created during the AMI build, which I'm hoping won't be created, but I may be wrong. I was mostly trying to keep comments current with the changes we're making. My plan is to delete all log groups from CloudWatch before deploying these changes and check if any of them are recreated.

Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ AWS CLI | ✅ | ✅
S3 Secrets Bucket | ✅ | ✅
ECR Login | ✅ | ✅
Docker Login | ✅ | ✅
CloudWatch Logs Agent | ✅ | ✅
Per-Instance Bootstrap Script | ✅ | ✅
SSM Access | ✅ | ✅
Instance Storage (NVMe) | ✅ |
Expand Down Expand Up @@ -176,12 +175,8 @@ aws cloudformation describe-stacks --stack-name MY_STACK_NAME \
--query 'Stacks[].Parameters[].[ParameterKey,ParameterValue]' --output table
```
### Collect logs from CloudWatch
Provide us with logs from CloudWatch Logs:
It's currently not possible to disable logging to Cloudwatch from EC2 instances, so we removed the agent setup on our fork to avoid this.

```
/buildkite/elastic-stack/{instance-id}
/buildkite/system/{instance-id}
```
### Collect logs via script
An alternative method to collect the logs is to use the `log-collector` script in the `utils` folder.
The script will collect CloudWatch logs for the Instance, Lambda function, and AutoScaling activity and package them in a
Expand Down
4 changes: 0 additions & 4 deletions goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ port:
- "::"

service:
amazon-cloudwatch-agent:
enabled: true
running: true

amazon-ssm-agent:
enabled: true
running: true
Expand Down
6 changes: 1 addition & 5 deletions packer/linux/buildkite-ami.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ source "amazon-ebs" "elastic-ci-stack-ami" {
}

launch_block_device_mappings {
volume_type = "gp3"
volume_type = "gp3"
device_name = "/dev/xvda"
volume_size = 10
delete_on_termination = true
Expand Down Expand Up @@ -108,10 +108,6 @@ build {
script = "scripts/install-utils.sh"
}

provisioner "shell" {
script = "scripts/install-cloudwatch-agent.sh"
}

provisioner "shell" {
script = "scripts/install-docker.sh"
}
Expand Down
3 changes: 1 addition & 2 deletions packer/linux/conf/bin/bk-install-elastic-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ PLUGINS_ENABLED=()
echo "The following plugins will be enabled: ${PLUGINS_ENABLED[*]-}"

# cfn-env is sourced by the environment hook in builds
# DO NOT PUT SECRETES IN HERE, they will appear in both the cloudwatch and
# build logs, and the agent's log redactor will not be able to redact them.
# DO NOT PUT SECRETES IN HERE, they will appear in build logs.

# We will create it in two steps so that we don't need to go crazy with quoting and escaping. The
# first sets up a helper function, the second populates the default values for some environment
Expand Down
3 changes: 0 additions & 3 deletions packer/linux/conf/buildkite-agent/scripts/terminate-instance
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ mark_as_unhealthy() {
--health-status Unhealthy
}

echo "sleeping for 10 seconds before terminating instance to allow agent logs to drain to cloudwatch..."
sleep 10

token=$(
curl \
--fail --silent --show-error \
Expand Down
15 changes: 0 additions & 15 deletions packer/linux/scripts/install-cloudwatch-agent.sh

This file was deleted.

4 changes: 0 additions & 4 deletions packer/windows/buildkite-ami.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ build {
script = "scripts/install-utils.ps1"
}

provisioner "powershell" {
script = "scripts/install-cloudwatch-agent.ps1"
}

provisioner "powershell" {
script = "scripts/install-lifecycled.ps1"
}
Expand Down
18 changes: 0 additions & 18 deletions packer/windows/scripts/install-cloudwatch-agent.ps1

This file was deleted.

1 change: 0 additions & 1 deletion templates/aws-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,6 @@ Resources:
- Effect: Allow
Action:
- autoscaling:DescribeAutoScalingInstances
- cloudwatch:PutMetricData
- cloudformation:DescribeStackResource
- ec2:DescribeTags
Resource: "*"
Expand Down