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

Ability to override API_SANDBOXES_OPERATION_TIMEOUT #109

Closed
astound-ci opened this issue Mar 20, 2020 · 8 comments · Fixed by #113
Closed

Ability to override API_SANDBOXES_OPERATION_TIMEOUT #109

astound-ci opened this issue Mar 20, 2020 · 8 comments · Fixed by #113
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@astound-ci
Copy link

There was a strange situation yesterday, request for sandbox creation took 41 minutes. And taking to account that API_SANDBOXES_OPERATION_TIMEOUT const is set to 10 minutes w/o ability to override - automated process failed w/o any error. Proposal is to add ability to override this const, additionally would be nice to have a reasonable error message in case default timeout exceeded.

Command used:
sfcc-ci-linux sandbox:create --json --sync --realm ${SANDBOX_REALM_ID} --ttl ${TTL}

@tobiaslohr tobiaslohr added the enhancement New feature or request label Mar 20, 2020
@astound-ci
Copy link
Author

@tobiaslohr, please make API_SANDBOXES_OPERATION_TIMEOUT at least 15-20 minutes, because now option --sync for sandbox creation is useless as it fails in 80% cases.

@astound-ci
Copy link
Author

In case it for any reason not appropriate to increase API_SANDBOXES_OPERATION_TIMEOUT to a greater value just return sandbox id which is still creating/starting so that it can be handled in any CI tool.

@sholsinger
Copy link

As a workaround... @astound-ci you should be able to remove the --sync option and get the UUID back. Then you can have a script sit in a tight loop polling for the status to become 'created' or 'up' or whatever it says when a sandbox is created and running.

@astound-ci
Copy link
Author

astound-ci commented Mar 25, 2020

Yeah @sholsinger, as you mentioned this is a workaround and not quite optimal as there will be many API requests sent, polling the status. Moreover we have a process that is bind to a created sandbox so than it can be assigned users and so on. And that process waits for a json file with initial data set.

@tobiaslohr
Copy link
Contributor

@astound-ci we will leave API_SANDBOXES_OPERATION_TIMEOUT at 10 mins and come up with a new env var to overwrite this. With that you can set it to 15 or 20 mins if needed.

@astound-ci
Copy link
Author

Thanks @tobiaslohr, that will help us much. When do you plan to release?

@tobiaslohr
Copy link
Contributor

When do you plan to release?

Currently planned for 2.4.x release. We will most likely build and release v2.3.1 today, then start working on 2.4.x. Contributions are welcome :)

In case it for any reason not appropriate to increase API_SANDBOXES_OPERATION_TIMEOUT to a greater value just return sandbox id which is still creating/starting so that it can be handled in any CI tool.

@astound-ci the sandbox id is included in the creation result in any case. In case of --sync mode, and the creation runs into the operation timeout, the message is containing the sandbox id already. See below for an example:

{
  "message": "Creation of new sandbox 001 for realm zzzz triggered and ongoing. Sandbox id is e7e3d222-291d-49a9-97ad-c69a126f527c, status of sandbox is new. You may use `sfcc-ci sandbox:list` to check the status of the sandbox. New sandbox host zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com added to list of instances using alias \"zzzz-001\". New sandbox set as default instance.",
  "sandbox": {
    "id": "e7e3d222-291d-49a9-97ad-c69a126f527c",
    "realm": "zzzz",
    "instance": "001",
    "versions": {
      "app": "20.3.2.579",
      "web": "19.8.4.0"
    },
    "state": "starting",
    "createdAt": "2020-03-24T15:22:16.799Z",
    "createdBy": "user@org.com",
    "eol": "2020-03-24T18:22:16.795Z",
    "links": {
      "bm": "https://zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site",
      "ocapi": "https://zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com/s/-/dw/data/",
      "impex": "https://zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.servlet/webdav/Sites/Impex",
      "code": "https://zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.servlet/webdav/Sites/Cartridges",
      "logs": "https://zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.servlet/webdav/Sites/Logs"
    }
  },
  "instance": {
    "host": "zzzz-001.sandbox.us01.dx.commercecloud.salesforce.com",
    "alias": "zzzz-001",
    "default": true
  },
  "error": "Sandbox creation timeout has been exceeded."
}

What exactly is missing?

@astound-ci
Copy link
Author

@tobiaslohr we figured out how to overcome this error by redirecting stderr to stdout and wrapping to try/catch, all needed info is there. But still would be nice to have ENV var for timeout override. Thanks

@tobiaslohr tobiaslohr added this to the 2.3.2 milestone Mar 25, 2020
@tobiaslohr tobiaslohr self-assigned this Mar 25, 2020
tobiaslohr added a commit to tobiaslohr/sfcc-ci that referenced this issue Mar 25, 2020
tobiaslohr added a commit to tobiaslohr/sfcc-ci that referenced this issue Mar 25, 2020
@tobiaslohr tobiaslohr modified the milestones: 2.3.2, 2.4.x Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants