Skip to content
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

Add option to provide file with arguments to start/deploy sequence #971

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

patuwwy
Copy link
Member

@patuwwy patuwwy commented Oct 27, 2023

What?

Why?
All parameters user can provide in command line can be supplied with config file.

Usage:
seq-startup-config.json:

{
    "outputTopic": "test-topic",
    "args": ["arg1", "arg2"],
    "limits": {
        "memory": 64
    },
    "appConfig": { "a": 1 }
}

Test with args-config-test Sequence
https://github.com/scramjetorg/reference-apps/blob/main/js/args-config-test/index.ts

si seq <start|deploy> --startup-config seq-startup-config.json
si seq deploy packages/args-config-test.tar.gz --startup-config seq-startup-config.json
Request ok: http://127.0.0.1:8000/api/v1/sequence status: 200 OK
{"_id":"0e55aae1-25a5-4f0d-82ac-1b7192a4c788","host":{"apiBase":"http://127.0.0.1:8000/api/v1"},"sequenceURL":"sequence/0e55aae1-25a5-4f0d-82ac-1b7192a4c788"}
Request ok: http://127.0.0.1:8000/api/v1/sequence/0e55aae1-25a5-4f0d-82ac-1b7192a4c788/start status: 200 OK
{"host":{"apiBase":"http://127.0.0.1:8000/api/v1"},"_id":"db06246c-996b-49f7-9f0a-be79c01413f2","instanceURL":"instance/db06246c-996b-49f7-9f0a-be79c01413f2"}
Done in 5.92s.
$ si topic get test-topic
Request ok: http://127.0.0.1:8000/api/v1/topic/test-topic status: 200 OK
config: {"a":1}
string, "arg1"
string, "arg2"

params from file can be overwritten with cli params, ie:

si seq deploy packages/args-config-test.tar.gz --startup-config seq-startup-config.json --output-topic other-topic
Request ok: http://127.0.0.1:8000/api/v1/sequence status: 200 OK
{"_id":"8c72da12-a69c-4fbc-aeb1-2d7fad84e140","host":{"apiBase":"http://127.0.0.1:8000/api/v1"},"sequenceURL":"sequence/8c72da12-a69c-4fbc-aeb1-2d7fad84e140"}
Request ok: http://127.0.0.1:8000/api/v1/sequence/8c72da12-a69c-4fbc-aeb1-2d7fad84e140/start status: 200 OK
{"host":{"apiBase":"http://127.0.0.1:8000/api/v1"},"_id":"e4c4ea28-0ab8-4760-a22e-d2d98fc7c4d4","instanceURL":"instance/e4c4ea28-0ab8-4760-a22e-d2d98fc7c4d4"}
Done in 6.04s.
$ si topic get other-topic
Request ok: http://127.0.0.1:8000/api/v1/topic/other-topic status: 200 OK
config: {"a":1}
string, "arg1"
string, "arg2"

Review checks:

These aspects need to be checked by the reviewer:

  • Verify and confirm operation (please post a screenshot)
  • All STH tests pass
  • All Scramjet Cloud Platform tests pass
  • Documentation is updated or no changes

@piotrek6641 piotrek6641 mentioned this pull request Nov 6, 2023
@patuwwy patuwwy mentioned this pull request Nov 6, 2023
4 tasks
@patuwwy patuwwy merged commit 48eade6 into devel Nov 7, 2023
38 checks passed
@patuwwy patuwwy deleted the feat/cli-seq-start-cfg branch November 7, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants