From 5051785caadc5a2941af1a08a469a6384a72fc68 Mon Sep 17 00:00:00 2001 From: Dylan Griffith <dyl.griffith@gmail.com> Date: Mon, 9 Sep 2024 10:18:37 +1000 Subject: [PATCH] Update duo-workflow-executor binary needs to be tar gz I was originally planning on getting clients to download the exeucutable file but it turns out this was tricky for our clients to use as the [docker API](https://docs.docker.com/reference/api/engine/v1.43/#tag/Container/operation/PutContainerArchive) we are using to copy the file into the container expects an archive to expand. The `.tar.gz` file has the added benefit that it is about half the size. --- DUO_WORKFLOW_EXECUTOR_VERSION | 2 +- config/initializers/1_settings.rb | 5 +++-- ee/spec/initializers/1_settings_spec.rb | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DUO_WORKFLOW_EXECUTOR_VERSION b/DUO_WORKFLOW_EXECUTOR_VERSION index ba2906d0666c..41a2819543b7 100644 --- a/DUO_WORKFLOW_EXECUTOR_VERSION +++ b/DUO_WORKFLOW_EXECUTOR_VERSION @@ -1 +1 @@ -main +v0.0.7 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 1bd41459fbd6..542ca358fe72 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -1030,10 +1030,11 @@ # Gitlab.ee do Settings['duo_workflow'] ||= {} + executor_version = File.read('DUO_WORKFLOW_EXECUTOR_VERSION').chomp Settings.duo_workflow.reverse_merge!( secure: true, - executor_binary_url: 'https://gitlab.com/api/v4/projects/58711783/releases/permalink/latest', - executor_version: 'latest' + executor_binary_url: "https://gitlab.com/api/v4/projects/58711783/packages/generic/#{executor_version}/duo-workflow-executor.tar.gz", + executor_version: executor_version ) # Default to proxy via Cloud Connector diff --git a/ee/spec/initializers/1_settings_spec.rb b/ee/spec/initializers/1_settings_spec.rb index 624578ea6752..83bec44693ed 100644 --- a/ee/spec/initializers/1_settings_spec.rb +++ b/ee/spec/initializers/1_settings_spec.rb @@ -79,6 +79,8 @@ Settings.duo_workflow = config end + let(:config) { {} } + context 'when service_url is set' do let(:config) do { @@ -119,6 +121,15 @@ expect(Settings.duo_workflow.secure).to eq(false) end end + + it 'reads executor details from DUO_WORKFLOW_EXECUTOR_VERSION file' do + version = File.read('DUO_WORKFLOW_EXECUTOR_VERSION').chomp + + load_settings + + expect(Settings.duo_workflow.executor_binary_url).to eq("https://gitlab.com/api/v4/projects/58711783/packages/generic/#{version}/duo-workflow-executor.tar.gz") + expect(Settings.duo_workflow.executor_version).to eq(version) + end end def load_settings -- GitLab