Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Metrics API, drop requirement for org-slug and api-token 馃帀 #405

Merged
merged 3 commits into from
Apr 18, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions .buildkite/steps/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,10 @@ echo "Using AMI $image_id"

cat << EOF > config.json
[
{
"ParameterKey": "BuildkiteOrgSlug",
"ParameterValue": "$BUILDKITE_AWS_STACK_ORG_SLUG"
},
{
"ParameterKey": "BuildkiteAgentToken",
"ParameterValue": "$BUILDKITE_AWS_STACK_AGENT_TOKEN"
},
{
"ParameterKey": "BuildkiteApiAccessToken",
"ParameterValue": "$BUILDKITE_AWS_STACK_API_TOKEN"
},
{
"ParameterKey": "BuildkiteQueue",
"ParameterValue": "${AWS_STACK_QUEUE_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Examples:

## Autoscaling

If you have provided `BuildkiteApiAccessToken` and your `MinSize` < `MaxSize`, the stack will automatically scale up and down based on the number of scheduled jobs.
If you have configured `MinSize` < `MaxSize`, the stack will automatically scale up and down based on the number of scheduled jobs.

This means you can scale down to zero when idle, which means you can use larger instances for the same cost.

Expand Down
10 changes: 1 addition & 9 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
[
{
"ParameterKey": "BuildkiteOrgSlug",
"ParameterValue": "MyOrg"
},
{
"ParameterKey": "BuildkiteAgentToken",
"ParameterValue": "TokenGoesHere"
},
{
"ParameterKey": "BuildkiteApiAccessToken",
"ParameterValue": "ApiTokenGoesHere"
},
{
"ParameterKey": "KeyName",
"ParameterValue": "default"
Expand All @@ -19,4 +11,4 @@
"ParameterKey": "ImageId",
"ParameterValue": ""
}
]
]
17 changes: 2 additions & 15 deletions templates/buildkite-elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Metadata:
- BuildkiteAgentToken
- BuildkiteAgentTags
- BuildkiteQueue
- BuildkiteOrgSlug
- BuildkiteApiAccessToken

- Label:
default: Network Configuration
Expand Down Expand Up @@ -80,27 +78,16 @@ Parameters:
Default: "beta"

BuildkiteAgentToken:
Description: Buildkite agent token
Description: Buildkite agent registration token
Type: String
NoEcho: true
MinLength: 1

BuildkiteOrgSlug:
Description: Buildkite organization slug
Type: String
MinLength: 1

BuildkiteAgentTags:
Description: Additional tags seperated by commas to provide to the agent. E.g os=linux,llamas=always
Type: String
Default: ""

BuildkiteApiAccessToken:
Description: Buildkite API access token with read_pipelines, read_builds and read_agents (required for metrics)
Type: String
NoEcho: true
MinLength: 1

BuildkiteQueue:
Description: Queue name that agents will use, targeted in pipeline steps using "queue={value}"
Type: String
Expand Down Expand Up @@ -312,7 +299,7 @@ Conditions:
"Fn::Not": [ "Fn::Equals": [ { Ref: MaxSize }, { Ref: MinSize } ] ]

CreateMetricsStack:
"Fn::And": [ Condition: UseAutoscaling, { "Fn::Not": [ "Fn::Equals": [ { Ref: BuildkiteApiAccessToken }, "" ] ] } ]
Condition: UseAutoscaling

UseCostAllocationTags:
"Fn::Equals": [ { Ref: EnableCostAllocationTags }, "true" ]
Expand Down
6 changes: 2 additions & 4 deletions templates/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Resources:
- logs:CreateLogStream
- logs:PutLogEvents
- cloudwatch:PutMetricData
- autoscaling:SetInstanceHealth
Resource:
- "*"

Expand All @@ -45,7 +44,7 @@ Resources:
Properties:
Code:
S3Bucket: { 'Fn::FindInMap': [MetricsLambdaBucket, { Ref: 'AWS::Region' }, 'Bucket'] }
S3Key: "buildkite-metrics-v2.0.2-lambda.zip"
S3Key: "buildkite-metrics-v3.0.0-lambda.zip"
Role:
Fn::GetAtt:
- LambdaExecutionRole
Expand All @@ -56,8 +55,7 @@ Resources:
MemorySize: 128
Environment:
Variables:
BUILDKITE_TOKEN: { Ref: BuildkiteApiAccessToken }
BUILDKITE_ORG: { Ref: BuildkiteOrgSlug }
BUILDKITE_AGENT_TOKEN: { Ref: BuildkiteAgentToken }
BUILDKITE_QUEUE: { Ref: BuildkiteQueue }
AWS_STACK_ID: { Ref: "AWS::StackId" }
AWS_STACK_NAME: { Ref: "AWS::StackName" }
Expand Down