Skip to content

Commit

Permalink
fix: use Amazon EC2 Image instead of CentOS EC2 Image (#24183)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnpfeife authored Apr 5, 2023
1 parent 85f725f commit a7a6e92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ jobs:
- run:
name: Validate Debian Package (AMD64)
command: |
sudo .circleci/scripts/package-validation/ubuntu \
sudo .circleci/scripts/package-validation/debian \
/tmp/workspace/artifacts/influxdb2*-amd64.deb
check_package_deb_arm64:
Expand All @@ -923,7 +923,7 @@ jobs:
- run:
name: Validate Debian Package (ARM64)
command: |
sudo .circleci/scripts/package-validation/ubuntu \
sudo .circleci/scripts/package-validation/debian \
/tmp/workspace/artifacts/influxdb2*-arm64.deb
check_package_rpm:
Expand All @@ -947,4 +947,4 @@ jobs:
command: |
export AWS_ACCESS_KEY_ID=$TEST_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$TEST_AWS_SECRET_ACCESS_KEY
.circleci/scripts/package-validation/centos << parameters.arch >> /tmp/workspace/artifacts/influxdb2*.<< parameters.arch >>.rpm
.circleci/scripts/package-validation/redhat << parameters.arch >> /tmp/workspace/artifacts/influxdb2*.<< parameters.arch >>.rpm
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ set -o errexit \

# $1 -> architecture
# $2 -> package path
arch="${1}"
case ${1} in
x86_64) arch=x86_64 ;;
aarch64) arch=arm64 ;;
esac

package="$(realpath "${2}")"

path="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
Expand All @@ -16,7 +20,7 @@ terraform_init() {
# Unfortunately, CircleCI doesn't offer any RPM based machine images.
# This is required to test the functionality of the systemd services.
# (systemd doesn't run within docker containers). This will spawn a
# CentOS 9 Stream EC2 instance in AWS.
# Amazon Linux instance in AWS.
terraform init
terraform apply \
-auto-approve \
Expand Down
20 changes: 11 additions & 9 deletions .circleci/scripts/package-validation/tf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ provider "aws" {
region = "us-east-1"
}

data "aws_ami" "centos" {
data "aws_ami" "test_ami" {
most_recent = true

# This information is sourced from https://wiki.centos.org/Cloud/AWS
# and should pull the latest AWS-provided CentOS Stream 9 image.
filter {
name = "name"
values = [format("CentOS Stream 9 %s*", var.architecture)]
values = ["al20*-ami-20*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "architecture"
values = [var.architecture]
}

owners = ["125523088429"]
owners = ["137112412989"]
}

resource "aws_security_group" "influxdb_test_package_sg" {
Expand All @@ -58,15 +60,15 @@ resource "aws_security_group" "influxdb_test_package_sg" {
}
}

resource "aws_instance" "centos" {
resource "aws_instance" "test_instance" {
count = 1
ami = data.aws_ami.centos.id
ami = data.aws_ami.test_ami.id
instance_type = var.architecture == "x86_64" ? "t2.micro" : "c6g.medium"
key_name = "circleci-oss-test"
vpc_security_group_ids = [aws_security_group.influxdb_test_package_sg.id]

tags = {
Name = format("circleci_%s_centos_%s", var.identifier, var.architecture)
Name = format("circleci_%s_test_%s", var.identifier, var.architecture)
}

provisioner "file" {
Expand Down Expand Up @@ -108,5 +110,5 @@ resource "aws_instance" "centos" {
}

output "node_ssh" {
value = aws_instance.centos.0.public_dns
value = aws_instance.test_instance.0.public_dns
}

0 comments on commit a7a6e92

Please sign in to comment.