From 3d1ac0a4e024c9d8d8c72879cef034682fa90c7c Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Thu, 4 May 2023 15:14:00 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Download=20latest=20HCP?= =?UTF-8?q?=20binary=20for=20worker=20config=20commands=20(#1680)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: ICU-7265 --- .../form/worker/create-worker-led/index.js | 6 +++-- .../tests/acceptance/workers/create-test.js | 24 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ui/admin/app/components/form/worker/create-worker-led/index.js b/ui/admin/app/components/form/worker/create-worker-led/index.js index 227bbd3cc..355f9ab64 100644 --- a/ui/admin/app/components/form/worker/create-worker-led/index.js +++ b/ui/admin/app/components/form/worker/create-worker-led/index.js @@ -118,8 +118,10 @@ ${listenerText} sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ;\\ sudo apt-get update && sudo apt-get install boundary ;\\ boundary server -config="${configPath}/pki-worker.hcl"`; - const hcpContent = `wget -q https://releases.hashicorp.com/boundary-worker/0.12.0+hcp/boundary-worker_0.12.0+hcp_linux_amd64.zip ;\\ -sudo apt-get update && sudo apt-get install unzip ;\\ + + const hcpContent = `sudo apt-get update && sudo apt-get install jq unzip ;\\ +wget -q "$(curl -fsSL "https://api.releases.hashicorp.com/v1/releases/boundary-worker/latest?license_class=hcp" \ +| jq -r '.builds[] | select(.arch == "amd64" and .os == "linux") | .url')" ;\\ unzip *.zip ;\\ ./boundary-worker server -config="${configPath}/pki-worker.hcl"`; diff --git a/ui/admin/tests/acceptance/workers/create-test.js b/ui/admin/tests/acceptance/workers/create-test.js index fefe6584c..f5f78b6f7 100644 --- a/ui/admin/tests/acceptance/workers/create-test.js +++ b/ui/admin/tests/acceptance/workers/create-test.js @@ -69,8 +69,16 @@ module('Acceptance | workers | create', function (hooks) { await visit(newWorkerURL); const createSection = findAll('.worker-create-section'); assert.false(featuresService.isEnabled('byow-pki-hcp-cluster-id')); - assert.dom(createSection[1]).includesText('curl -fsSL'); - assert.dom(createSection[1]).doesNotIncludeText('wget -q'); + assert + .dom(createSection[1]) + .includesText( + 'curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ;' + ); + assert + .dom(createSection[1]) + .doesNotIncludeText( + 'wget -q "$(curl -fsSL "https://api.releases.hashicorp.com/v1/releases/boundary-worker/latest?license_class=hcp"' + ); }); test('download and install step shows correct hcp instructions', async function (assert) { @@ -79,8 +87,16 @@ module('Acceptance | workers | create', function (hooks) { featuresService.enable('byow-pki-hcp-cluster-id'); await visit(newWorkerURL); const createSection = findAll('.worker-create-section'); - assert.dom(createSection[1]).includesText('wget -q'); - assert.dom(createSection[1]).doesNotIncludeText('curl -fsSL'); + assert + .dom(createSection[1]) + .includesText( + 'wget -q "$(curl -fsSL "https://api.releases.hashicorp.com/v1/releases/boundary-worker/latest?license_class=hcp"' + ); + assert + .dom(createSection[1]) + .doesNotIncludeText( + 'curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ;' + ); }); test('Users can navigate to new workers route with proper authorization', async function (assert) {