diff --git a/.github/scripts/aws-packer-build.sh b/.github/scripts/aws-packer-build.sh index 140e6d49..88b1db18 100644 --- a/.github/scripts/aws-packer-build.sh +++ b/.github/scripts/aws-packer-build.sh @@ -63,7 +63,18 @@ sed -i "s#TEMPLATE_COSMIAN_AI_RUNNER_VERSION#$AI_RUNNER_VERSION#g" "$PACKER_FILE cat "$PACKER_FILE" -packer init "$PACKER_FILE" +plugins='https://github.com/hashicorp/packer-plugin-ansible.git https://github.com/hashicorp/packer-plugin-amazon.git' + +for plugin in $plugins; do + git clone $plugin + plugin_name=$(echo "$plugin" | sed -E 's#.*/([^/]+)\.git#\1#') + cd $plugin_name + go build + ./$plugin_name describe + plugin_name_short=$(echo "$plugin_name" | sed 's/.*-//') + packer plugins install --path $plugin_name releases.hashicorp.com/$plugin_name/$plugin_name_short + cd .. +done # Since packer build fails randomly because of external resources use, retry packer build until it succeeds timeout 60m bash -c "until packer build $PACKER_FILE; do sleep 30; done" diff --git a/.github/scripts/azure-packer-build.sh b/.github/scripts/azure-packer-build.sh index 89a44e34..6df7ab48 100644 --- a/.github/scripts/azure-packer-build.sh +++ b/.github/scripts/azure-packer-build.sh @@ -67,7 +67,18 @@ fi cat "$PACKER_FILE" -packer init "$PACKER_FILE" +plugins='https://github.com/hashicorp/packer-plugin-ansible.git https://github.com/hashicorp/packer-plugin-azure.git' + +for plugin in $plugins; do + git clone $plugin + plugin_name=$(echo "$plugin" | sed -E 's#.*/([^/]+)\.git#\1#') + cd $plugin_name + go build + ./$plugin_name describe + plugin_name_short=$(echo "$plugin_name" | sed 's/.*-//') + packer plugins install --path $plugin_name releases.hashicorp.com/$plugin_name/$plugin_name_short + cd .. +done # Since packer build fails randomly because of external resources use, retry packer build until it succeeds timeout 60m bash -c "until packer build -force $PACKER_FILE; do sleep 30; done" diff --git a/.github/scripts/gcp-packer-build.sh b/.github/scripts/gcp-packer-build.sh old mode 100644 new mode 100755 index d8211aa8..0b6658c4 --- a/.github/scripts/gcp-packer-build.sh +++ b/.github/scripts/gcp-packer-build.sh @@ -36,7 +36,18 @@ sed -i "s#TEMPLATE_COSMIAN_AI_RUNNER_VERSION#$AI_RUNNER_VERSION#g" "$PACKER_FILE cat "$PACKER_FILE" -packer init "$PACKER_FILE" +plugins='https://github.com/hashicorp/packer-plugin-ansible.git https://github.com/hashicorp/packer-plugin-googlecompute.git' + +for plugin in $plugins; do + git clone $plugin + plugin_name=$(echo "$plugin" | sed -E 's#.*/([^/]+)\.git#\1#') + cd $plugin_name + go build + ./$plugin_name describe + plugin_name_short=$(echo "$plugin_name" | sed 's/.*-//') + packer plugins install --path $plugin_name releases.hashicorp.com/$plugin_name/$plugin_name_short + cd .. +done # Since packer build fails randomly because of external resources use, retry packer build until it succeeds timeout 60m bash -c "until packer build $PACKER_FILE; do sleep 30; done" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b829c57..1f13b877 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: run: | sudo curl -fsSLo /usr/share/keyrings/intel-sgx-deb.asc https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx-deb.asc] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list - sudo apt-get update && sudo apt-get install -y tpm2-tools libtss2-dev libtdx-attest-dev + sudo apt-get update && sudo apt-get install -y tpm2-tools libtss2-dev libtdx-attest-dev golang-go - name: Install Rust toolchain and components if: steps.cargo-cache.outputs.cache-hit != 'true' diff --git a/packer/aws.pkr.hcl b/packer/aws.pkr.hcl index 0847afa7..c211abf5 100644 --- a/packer/aws.pkr.hcl +++ b/packer/aws.pkr.hcl @@ -1,16 +1,3 @@ -packer { - required_plugins { - amazon = { - version = "= 1.3.0" - source = "github.com/hashicorp/amazon" - } - ansible = { - version = "= 1.1.1" - source = "github.com/hashicorp/ansible" - } - } -} - source "amazon-ebssurrogate" "TEMPLATE_DISTRIBUTION" { ssh_username = "TEMPLATE_SSH_USERNAME" ssh_timeout = "5m" diff --git a/packer/azure.pkr.hcl b/packer/azure.pkr.hcl index a6fb6015..fe1f6f04 100644 --- a/packer/azure.pkr.hcl +++ b/packer/azure.pkr.hcl @@ -1,16 +1,3 @@ -packer { - required_plugins { - azure = { - version = "= 2.1.4" - source = "github.com/hashicorp/azure" - } - ansible = { - version = "= 1.1.1" - source = "github.com/hashicorp/ansible" - } - } -} - source "azure-arm" "TEMPLATE_DISTRIBUTION" { ssh_username = "packer" ssh_timeout = "5m" diff --git a/packer/gcp.pkr.hcl b/packer/gcp.pkr.hcl index 1bf073fd..bec9f7bd 100644 --- a/packer/gcp.pkr.hcl +++ b/packer/gcp.pkr.hcl @@ -1,16 +1,3 @@ -packer { - required_plugins { - googlecompute = { - version = "= 1.1.4" - source = "github.com/hashicorp/googlecompute" - } - ansible = { - version = "= 1.1.1" - source = "github.com/hashicorp/ansible" - } - } -} - source "googlecompute" "TEMPLATE_GOOGLE_COMPUTE" { ssh_username = "root" ssh_timeout = "5m"