Skip to content

Commit

Permalink
build(packer): pkr
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuthor committed Jun 17, 2024
1 parent 15a627c commit 38c5e41
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/aws-packer-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ VOLUME_SIZE=20
set

if [ "$DISTRIBUTION" = "ubuntu" ]; then
SSH_USERNAME="ubuntu"
TEMPLATE_DISTRIBUTION="ubuntu"
else
SSH_USERNAME="ec2-user"
TEMPLATE_DISTRIBUTION="redhat"
fi

Expand All @@ -26,6 +28,7 @@ sed -i "s#TEMPLATE_IMAGE_NAME#$IMAGE_NAME#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_SOURCE_AMI#$SOURCE_AMI#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_SUPPORT#$SUPPORT#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_VOLUME_SIZE#$VOLUME_SIZE#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_SSH_USERNAME#$SSH_USERNAME#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_DEVICE_NAME#$DEVICE_NAME#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_VOLUME_TYPE#$VOLUME_TYPE#g" "$PACKER_FILE"
sed -i "s#TEMPLATE_DISTRIBUTION#$TEMPLATE_DISTRIBUTION#g" "$PACKER_FILE"
Expand Down
12 changes: 1 addition & 11 deletions packer/aws.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packer {
}

source "amazon-ebssurrogate" "TEMPLATE_DISTRIBUTION" {
ssh_username = "packer"
ssh_username = "TEMPLATE_SSH_USERNAME"
ssh_timeout = "5m"
ssh_clear_authorized_keys = true
source_ami = "TEMPLATE_SOURCE_AMI"
Expand Down Expand Up @@ -49,14 +49,4 @@ build {
use_proxy = false
extra_arguments = ["-e", "cosmian_vm_version=TEMPLATE_COSMIAN_VM_VERSION", "-e", "cosmian_kms_version=TEMPLATE_COSMIAN_KMS_VERSION", "-e", "cosmian_ai_runner_version=TEMPLATE_COSMIAN_AI_RUNNER_VERSION"]
}

provisioner "shell" {
skip_clean = true
expect_disconnect = true
inline = [
"rm -f /etc/sudoers.d/90-cloud-init-users",
"/usr/sbin/userdel -r -f packer ",
]
}

}
9 changes: 0 additions & 9 deletions packer/azure.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,4 @@ build {
use_proxy = false
extra_arguments = ["-e", "cosmian_vm_version=TEMPLATE_COSMIAN_VM_VERSION", "-e", "cosmian_kms_version=TEMPLATE_COSMIAN_KMS_VERSION", "-e", "cosmian_ai_runner_version=TEMPLATE_COSMIAN_AI_RUNNER_VERSION"]
}

provisioner "shell" {
skip_clean = true
expect_disconnect = true
inline = [
"rm -f /etc/sudoers.d/90-cloud-init-users",
"/usr/sbin/userdel -r -f packer ",
]
}
}
11 changes: 1 addition & 10 deletions packer/gcp.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packer {
}

source "googlecompute" "TEMPLATE_GOOGLE_COMPUTE" {
ssh_username = "packer"
ssh_username = "root"
ssh_timeout = "5m"
ssh_clear_authorized_keys = true
project_id = "cosmian-dev"
Expand All @@ -37,13 +37,4 @@ build {
use_proxy = false
extra_arguments = ["-e", "cosmian_vm_version=TEMPLATE_COSMIAN_VM_VERSION", "-e", "cosmian_kms_version=TEMPLATE_COSMIAN_KMS_VERSION", "-e", "cosmian_ai_runner_version=TEMPLATE_COSMIAN_AI_RUNNER_VERSION"]
}

provisioner "shell" {
skip_clean = true
expect_disconnect = true
inline = [
"rm -f /etc/sudoers.d/90-cloud-init-users",
"/usr/sbin/userdel -r -f packer ",
]
}
}

0 comments on commit 38c5e41

Please sign in to comment.