diff --git a/builder/vsphere/examples/supervisor/jenkins-template.pkr.hcl b/builder/vsphere/examples/supervisor/jenkins-template.pkr.hcl index c29217ed6..cbc8d1a62 100644 --- a/builder/vsphere/examples/supervisor/jenkins-template.pkr.hcl +++ b/builder/vsphere/examples/supervisor/jenkins-template.pkr.hcl @@ -119,9 +119,14 @@ EOF provisioner "shell" { inline = [ - # Install Jenkins and its dependencies. - "curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null", - "echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null", + # Download Jenkins repository key and add it to the trusted keyrings. + "curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo gpg --dearmor -o /usr/share/keyrings/jenkins-keyring.gpg", + "echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.gpg] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list", + + # Download the new Kubernetes community-owned repository key and add it to the trusted keyrings (to get apt-get update working). + "curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /usr/share/keyrings/kubernetes-apt-keyring.gpg", + "echo deb [signed-by=/usr/share/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ / | sudo tee /etc/apt/sources.list.d/kubernetes.list", + # Sometimes apt-get uses IPv6 and causes failure, force to use IPv4 address. "sudo apt-get -qq -o Acquire::ForceIPv4=true update", "sudo apt-get -qq -o Acquire::ForceIPv4=true install -f -y ca-certificates openjdk-11-jre-headless",