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 compare CS engine versions #170

Open
vlobzakov opened this issue May 21, 2019 · 0 comments
Open

Ability to compare CS engine versions #170

vlobzakov opened this issue May 21, 2019 · 0 comments
Assignees

Comments

@vlobzakov
Copy link
Contributor

Ticket: https://jelastic.team/browse/JE-43816
Ниже предложение по размещению и наполнению обновления.

Обновление добавляется после подраздела:
Default Values of Placeholders (http://docs.cloudscripting.com/creating-manifest/placeholders/#default-values-of-placeholders)
####################Начало обновления###############

Engine Placeholder

The ${engine} placeholder returns a Cloud Scripting engine version that is supported by the platform the manifest is executed on.

  • ${engine} - CS engine version

It can be complemented with function placeholders ${fn.compareEngine(version)} and ${fn.compare(version1, version2)} that can be used to determine whether JPS manifest is supported by the platform’s engine version or not.

@@@

type: install
name: JE-43816 Ability co compare CS engine versions

onInstall:
- assert:
  - "'${engine}'.split('.').length > 0"
  - "'${fn.compare}' == 0"
  - "'${fn.compare(5.4.1, 5.4.2)}' == -1"
  - "'${fn.compare(5.5, 5.4.2)}' == 1"
  - "'${fn.compare(5.4.0, 5.4.0.0)}' == 0"
  - "'${fn.compareEngine}' == 0"
  - "'${fn.compareEngine(1.5.1)}' == 1"
  - "'${fn.compareEngine(1000000)}' == -1"
{
  "type": "install",
  "name": "JE-43816 Ability co compare CS engine versions",
  "onInstall": [
    {
      "assert": [
        "'${engine}'.split('.').length > 0",
        "'${fn.compare}' == 0",
        "'${fn.compare(5.4.1, 5.4.2)}' == -1",
        "'${fn.compare(5.5, 5.4.2)}' == 1",
        "'${fn.compare(5.4.0, 5.4.0.0)}' == 0",
        "'${fn.compareEngine}' == 0",
        "'${fn.compareEngine(1.5.1)}' == 1",
        "'${fn.compareEngine(1000000)}' == -1"
      ]
    }
  ]
}

@@!
###################конец обновления################

В разделе https://docs.cloudscripting.com/creating-manifest/placeholders/#function-placeholders
После
The function parameter can be passed from existing placeholders, for example:
${fn.md5([fn.random])} - md5 encoding random password
${fn.base64([user.email])} - base64 encoding user email address

Вставляем

####################Начало обновления###############

  • ${fn.compareEngine(version)} - compares, supported by the hoster platform, CS engine version with the given version. Returns result:
    0 - version equals CS engine version
    1 - CS engine version greater than version
    -1 - CS engine version less than version

  • ${fn.compare(version1, version2)} - compares two given versions separated by dots. Returns result:
    0 - version1 equals version2
    1 - version1 greater than version2
    -1 - version1 less than version2

###################конец обновления################

Может есть смысл еще такой пример дать:

@@@

type: update
name: CS Engine compatibility test1
onInstall:
   - if (${fn.compareEngine(1.6)} > 0):
      cmd[cp]:
        echo "Engine ${engine} is supported" >> /tmp/engine.txt
      user: root
{
  "type": "update",
  "name": "CS Engine compatibility test",
  "onInstall": [
    {
      "if (${fn.compareEngine(1.6)} > 0)": {
        "cmd[cp]": "echo \"Engine ${engine} is supported\" >> /tmp/engine.txt",
        "user": "root"
      }
    }
  ]
}

@@!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants