Skip to content

Commit 76fc8b1

Browse files
authored
feat: allow downloading latest release (#21)
1 parent 10ca01c commit 76fc8b1

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

iac/download.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,23 @@ set -ex
33

44
# Download the data.
55
code_version=$1
6-
code_architecture=$2
6+
export code_architecture=$2
77

8-
curl -L -o lambda.zip "https://github.com/spacelift-io/ec2-workerpool-autoscaler/releases/download/${code_version}/ec2-workerpool-autoscaler_linux_${code_architecture}.zip"
8+
if [ "$code_version" != "latest" ]; then
9+
code_version="tags/$code_version"
10+
fi
11+
12+
release=$(curl -sS "https://api.github.com/repos/spacelift-io/ec2-workerpool-autoscaler/releases/${code_version}" | jq -r --arg ZIP "ec2-workerpool-autoscaler_linux_$code_architecture.zip" '.assets[] | select(.name==$ZIP)')
13+
14+
release_date=$(echo $release | jq -r '.created_at')
15+
download_url=$(echo $release | jq -r '.browser_download_url')
16+
17+
echo "Downloading Details:"
18+
echo " Release Name: $code_version"
19+
echo " Release Date: $release_date"
20+
echo " Download URL: $download_url"
21+
22+
curl -L -o lambda.zip $download_url
923

1024
mkdir -p lambda
1125
cd lambda

iac/variables.tf

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ variable "autoscaling_group_arn" {
66
variable "autoscaler_version" {
77
type = string
88
description = "Version of the autoscaler to deploy"
9-
default = "v0.3.0"
10-
}
11-
12-
variable "autoscaling_frequency" {
13-
type = number
14-
description = "How often to run the autoscaler, in minutes"
15-
default = 5
9+
default = "latest"
1610
}
1711

1812
variable "spacelift_api_key_id" {

0 commit comments

Comments
 (0)