Skip to content

Serialize builds #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ use Mix.Config
# metadata: [:user_id]

config :autostart,
register_queues: true
register_queues: true

config :openaperture_workflow_orchestrator,
queued_builds_check_delay: "15000"
21 changes: 12 additions & 9 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ use Mix.Config
# metadata: [:user_id]

config :autostart,
register_queues: true
register_queues: true

config :openaperture_manager_api,
manager_url: System.get_env("MANAGER_URL"),
oauth_login_url: System.get_env("OAUTH_LOGIN_URL"),
oauth_client_id: System.get_env("OAUTH_CLIENT_ID"),
oauth_client_secret: System.get_env("OAUTH_CLIENT_SECRET")
config :openaperture_manager_api,
manager_url: System.get_env("MANAGER_URL"),
oauth_login_url: System.get_env("OAUTH_LOGIN_URL"),
oauth_client_id: System.get_env("OAUTH_CLIENT_ID"),
oauth_client_secret: System.get_env("OAUTH_CLIENT_SECRET")

config :openaperture_overseer_api,
module_type: :workflow_orchestrator,
exchange_id: System.get_env("EXCHANGE_ID"),
broker_id: System.get_env("BROKER_ID")
module_type: :workflow_orchestrator,
exchange_id: System.get_env("EXCHANGE_ID"),
broker_id: System.get_env("BROKER_ID")

config :openaperture_workflow_orchestrator,
queued_builds_check_delay: "15000" # ms
27 changes: 14 additions & 13 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ use Mix.Config
# metadata: [:user_id]

config :autostart,
register_queues: false
register_queues: false

config :openaperture_manager_api,
manager_url: "https://openaperture-mgr.host.co",
oauth_login_url: "https://auth.host.co",
oauth_client_id: "id",
oauth_client_secret: "secret"
config :openaperture_manager_api,
manager_url: "https://openaperture-mgr.host.co",
oauth_login_url: "https://auth.host.co",
oauth_client_id: "id",
oauth_client_secret: "secret"

config :openaperture_workflow_orchestrator,
exchange_id: "1",
broker_id: "1"
config :openaperture_workflow_orchestrator,
exchange_id: "1",
broker_id: "1",
queued_builds_check_delay: "3"

config :openaperture_overseer_api,
module_type: :test,
autostart: false,
exchange_id: "1",
broker_id: "1"
module_type: :test,
autostart: false,
exchange_id: "1",
broker_id: "1"
47 changes: 28 additions & 19 deletions lib/workflow_orchestrator/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,86 @@ defmodule OpenAperture.WorkflowOrchestrator.Configuration do

@doc """
Method to retrieve the currently assigned exchange id

## Options

## Return values

The exchange identifier
"""
"""
@spec get_current_exchange_id() :: String.t()
def get_current_exchange_id do
get_config("EXCHANGE_ID", :openaperture_workflow_orchestrator, :exchange_id)
end

@doc """
Method to retrieve the currently assigned exchange id

## Options

## Return values

The exchange identifier
"""
"""
@spec get_current_broker_id() :: String.t()
def get_current_broker_id do
get_config("BROKER_ID", :openaperture_workflow_orchestrator, :broker_id)
end

@doc """
Method to retrieve the currently assigned queue name (for "workflow_orchestration")

## Options

## Return values

The exchange identifier
"""
"""
@spec get_current_queue_name() :: String.t()
def get_current_queue_name do
get_config("QUEUE_NAME", :openaperture_overseer, :queue_name)
end

@doc """
Method to retrieve the associated UI's url

## Options

## Return values

The exchange identifier
"""
"""
@spec get_ui_url() :: String.t()
def get_ui_url do
get_config("UI_URL", :openaperture_overseer, :ui_url)
end

def get_queue_build_delay do
{delay, _} =
"QUEUED_BUILDS_CHECK_DELAY"
|> get_config(:openaperture_workflow_orchestrator, :queued_builds_check_delay)
|> Integer.parse

delay
end

@doc false
# Method to retrieve a configuration option from the environment or config settings
#
#
## Options
#
#
# The `env_name` option defines the environment variable name
#
# The `application_config` option defines the config application name (atom)
#
# The `config_name` option defines the config variable name (atom)
#
#
## Return values
#
#
# Value
#
#
@spec get_config(String.t(), term, term) :: String.t()
defp get_config(env_name, application_config, config_name) do
System.get_env(env_name) || Application.get_env(application_config, config_name)
end
end
end
end
Loading