Skip to content

Commit

Permalink
[images] build based on ubuntu24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronkaikov committed Jul 3, 2024
1 parent 0e23d55 commit d88f2df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
6 changes: 3 additions & 3 deletions packer/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ if [ "$TARGET" = "aws" ]; then
arch="$ARCH"
case "$arch" in
"x86_64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-amd64*"
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64*"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="c4.xlarge"
fi
;;
"aarch64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-arm64*"
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64*"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="im4gn.2xlarge"
fi
Expand All @@ -283,7 +283,7 @@ if [ "$TARGET" = "aws" ]; then
PACKER_ARGS+=(-var scylla_ami_description="${SCYLLA_AMI_DESCRIPTION:0:255}")
elif [ "$TARGET" = "gce" ]; then
SSH_USERNAME=ubuntu
SOURCE_IMAGE_FAMILY="ubuntu-minimal-2204-lts"
SOURCE_IMAGE_FAMILY="ubuntu-minimal-2404-lts"

PACKER_ARGS+=(-var source_image_family="$SOURCE_IMAGE_FAMILY")
elif [ "$TARGET" = "azure" ]; then
Expand Down
18 changes: 2 additions & 16 deletions packer/scylla.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
"managed_image_name": "{{user `image_name`| clean_resource_name}}",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "0001-com-ubuntu-minimal-jammy",
"image_sku": "minimal-22_04-lts-gen2",
"image_offer": "0001-com-ubuntu-minimal-noble",
"image_sku": "minimal-24_04-lts-gen2",
"azure_tags": {
"scylla_version": "{{user `scylla_full_version`}}",
"scylla_machine_image_version": "{{user `scylla_machine_image_version`}}",
Expand All @@ -171,20 +171,6 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"if [ {{build_name}} = aws -o {{build_name}} = azure ]; then sudo DEBIAN_FRONTEND=noninteractive apt purge -y linux-{{build_name}}* linux-headers-{{build_name}}* linux-image*{{build_name}}* linux-modules*-{{build_name}}* && sudo DEBIAN_FRONTEND=noninteractive sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y linux-{{build_name}}-lts-22.04 && sudo reboot; fi"
],
"expect_disconnect": true
},
{
"type": "shell",
"inline": [
"if [ {{build_name}} = gce ]; then sudo DEBIAN_FRONTEND=noninteractive apt purge -y linux-gcp* linux-headers-gcp* linux-image*gcp* linux-modules*-gcp* && sudo DEBIAN_FRONTEND=noninteractive sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y linux-gcp-lts-22.04 && sudo reboot; fi"
],
"expect_disconnect": true
},
{
"destination": "/home/{{user `ssh_username`}}/",
"source": "files/",
Expand Down
7 changes: 3 additions & 4 deletions packer/scylla_install_image
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ if __name__ == '__main__':
print('Error: need to specify --localdeb or --repo/--repo-for-install')
sys.exit(1)

run('apt-get update --allow-insecure-repositories -y', shell=True, check=True)
run('apt-get install -y gnupg2', shell=True, check=True)
run(f'mkdir -p {apt_keys_dir}; gpg --homedir /tmp --no-default-keyring --keyring {apt_keys_dir}/scylladb.gpg '
f'--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys d0a112e067426ab2 491c93b9de7496a7', shell=True, check=True)

Expand Down Expand Up @@ -92,16 +94,13 @@ if __name__ == '__main__':
run('apt-get purge -y accountsservice', shell=True, check=True)
run('apt-get purge -y acpid motd-news-config fwupd-signed', shell=True, check=True)
run('apt-get purge -y udisks2', shell=True, check=True)
# cannot remove policykit since add-apt-repository depends on that,
# so just disable the service
run('systemctl disable polkit.service', shell=True, check=True)

# drop packages does not needed anymore
run('apt-get autoremove --purge -y', shell=True, check=True)

if args.target_cloud == 'aws':
run('apt-get install -y pip', shell=True, check=True)
run('pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-2.0-18.tar.gz', shell=True, check=True)
# run('pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz', shell=True, check=True)

# install .deb version of ssm-agent since we dropped snapd version
run(f'curl -L -o /tmp/amazon-ssm-agent.deb https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_{deb_arch()}/amazon-ssm-agent.deb', shell=True, check=True)
Expand Down

0 comments on commit d88f2df

Please sign in to comment.