StackStorm / orquestaconvert

Converts Mistral workflows into Orchestra workflows
Apache License 2.0
13 stars 7 forks source link

Handle Mistral transition strings #5

Closed blag closed 6 years ago

blag commented 6 years ago

Some Mistral transitions can simply be the names of the next task to run (see promote_package.yaml in st2ci for more):

      download_trusty:
        action: core.local
        input:
          cmd: "wget -O /tmp/st2-up/ubuntu/trusty/<% $.deb %> https://packagecloud.io/StackStorm/<% $.source %>/ubuntu/pool/trusty/main/<% $.package.substring(0,1) %>/<% $.package %>/<% $.deb %>"
          timeout: <% $.timeout %>
        on-success: upload_trusty  # <--

Previously the converter script expected a list, so it would split the string up into each character, and treat each character as a task to run:

      next:
        # ...
        do:
          - u
          - p
          - l
          - o
          - a
          - d
          - _
          - t
          - r
          - u
          - s
          - t
          - y

Because the single-letter tasks are not defined, this fails the Orquesta validation, and the script aborts converting the workflow.

This PR recognizes if the transition is a simple (single) string, and creates a list of one element containing that string:

      next:
        # ...
        do:
          - upload_trusty
codecov-io commented 6 years ago

Codecov Report

Merging #5 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #5      +/-   ##
==========================================
+ Coverage   99.68%   99.68%   +<.01%     
==========================================
  Files           9        9              
  Lines         320      322       +2     
==========================================
+ Hits          319      321       +2     
  Misses          1        1
Impacted Files Coverage Δ
orquestaconvert/workflows/base.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2844518...03fddb7. Read the comment docs.