Refactor arvbox federation test scripts, no issue #
[arvados.git] / sdk / python / tests / fed-migrate / fed-migrate.cwl
index 313946dd3db5c43493b4f2c9bae813284e52be01..19c2b58ef7ca4aee10af8413155042eb418d56b1 100644 (file)
@@ -131,6 +131,7 @@ $graph:
             - class: EnvVarRequirement
               envDef:
                 ARVADOS_API_HOST: $(inputs.host)
+                ARVADOS_API_HOST_INSECURE: '1'
                 ARVADOS_API_TOKEN: $(inputs.token)
           steps:
             - id: main_2_embed_1
@@ -334,6 +335,11 @@ $graph:
       - default: arv-federation-migrate
         id: fed_migrate
         type: string
+      - id: arvbox_bin
+        type: File
+      - default: master
+        id: refspec
+        type: string
     outputs:
       - id: supertok
         outputSource: main_2/supertok
@@ -369,6 +375,8 @@ $graph:
               type: string
       - id: main_2
         in:
+          arvbox_bin:
+            source: arvbox_bin
           cluster_id:
             source: arvados_cluster_ids
           container:
@@ -377,6 +385,8 @@ $graph:
             source: arvados_api_hosts
           logincluster:
             source: main_1/logincluster
+          refspec:
+            source: refspec
         out:
           - supertok
         run:
@@ -391,29 +401,29 @@ $graph:
               type: string
             - id: logincluster
               type: string
+            - id: arvbox_bin
+              type: File
+            - id: refspec
+              type: string
           outputs:
             - id: supertok
-              outputSource: superuser_tok_3/superuser_token
+              outputSource: superuser_tok_2/superuser_token
               type: string
           requirements:
-            - class: EnvVarRequirement
-              envDef:
-                ARVBOX_CONTAINER: $(inputs.container)
+            InlineJavascriptRequirement: {}
           steps:
             - id: main_2_embed_1
               in:
-                cluster_id:
-                  source: cluster_id
+                arvbox_bin:
+                  source: arvbox_bin
                 container:
                   source: container
-                logincluster:
-                  source: logincluster
-                set_login:
-                  default:
-                    class: File
-                    location: set_login.py
+                host:
+                  source: host
+                refspec:
+                  source: refspec
               out:
-                - c
+                - d
               run:
                 arguments:
                   - sh
@@ -423,98 +433,67 @@ $graph:
                 inputs:
                   - id: container
                     type: string
-                  - id: cluster_id
-                    type: string
-                  - id: logincluster
+                  - id: host
                     type: string
-                  - id: set_login
+                  - id: arvbox_bin
                     type: File
+                  - id: refspec
+                    type: string
                 outputs:
-                  - id: c
+                  - id: d
                     outputBinding:
                       outputEval: $(inputs.container)
                     type: string
                 requirements:
                   InitialWorkDirRequirement:
                     listing:
-                      - entry: >
-                          set -x
+                      - entry: >+
+                          set -xe
 
-                          docker cp
-                          $(inputs.container):/var/lib/arvados/cluster_config.yml.override
-                          .
+                          export ARVBOX_CONTAINER="$(inputs.container)"
 
-                          chmod +w cluster_config.yml.override
+                          $(inputs.arvbox_bin.path) pipe <<EOF
 
-                          python $(inputs.set_login.path)
-                          cluster_config.yml.override $(inputs.cluster_id)
-                          $(inputs.logincluster)
+                          cd /usr/src/arvados
 
-                          docker cp cluster_config.yml.override
-                          $(inputs.container):/var/lib/arvados
-                        entryname: _script
-                  InlineJavascriptRequirement: {}
-            - id: main_2_embed_2
-              in:
-                c:
-                  source: main_2_embed_1/c
-                container:
-                  source: container
-                host:
-                  source: host
-              out:
-                - d
-              run:
-                arguments:
-                  - sh
-                  - _script
-                class: CommandLineTool
-                id: main_2_embed_2_embed
-                inputs:
-                  - id: container
-                    type: string
-                  - id: host
-                    type: string
-                  - id: c
-                    type: string
-                outputs:
-                  - id: d
-                    outputBinding:
-                      outputEval: $(inputs.c)
-                    type: string
-                requirements:
-                  InitialWorkDirRequirement:
-                    listing:
-                      - entry: >
-                          set -x
+                          git fetch
+
+                          git checkout -f $(inputs.refspec)
+
+                          git pull
+
+                          chown arvbox:arvbox -R .
+
+                          EOF
+
+
+                          $(inputs.arvbox_bin.path) hotreset
 
-                          arvbox hotreset
 
                           while ! curl --fail --insecure --silent
                           https://$(inputs.host)/discovery/v1/apis/arvados/v1/rest
                           >/dev/null ; do sleep 3 ; done
 
-                          export ARVADOS_API_HOST=$(inputs.host)
 
-                          export ARVADOS_API_TOKEN=\$(arvbox cat
-                          /var/lib/arvados/superuser_token)
+                          ARVADOS_VIRTUAL_MACHINE_UUID=\$($(inputs.arvbox_bin.path)
+                          cat /var/lib/arvados/vm-uuid)
 
-                          export ARVADOS_API_HOST_INSECURE=1
+                          ARVADOS_API_TOKEN=\$($(inputs.arvbox_bin.path) cat
+                          /var/lib/arvados/superuser_token)
 
-                          ARVADOS_VIRTUAL_MACHINE_UUID=\$(arvbox cat
-                          /var/lib/arvados/vm-uuid)
+                          while ! curl --fail --insecure --silent -H
+                          "Authorization: Bearer $ARVADOS_API_TOKEN"
+                          https://$(inputs.host)/arvados/v1/virtual_machines/$ARVADOS_VIRTUAL_MACHINE_UUID
+                          >/dev/null ; do sleep 3 ; done
 
-                          while ! python -c "import arvados ;
-                          arvados.api().virtual_machines().get(uuid='$ARVADOS_VIRTUAL_MACHINE_UUID').execute()"
-                          2>/dev/null ; do sleep 3; done
                         entryname: _script
                   InlineJavascriptRequirement: {}
-            - id: superuser_tok_3
+            - id: superuser_tok_2
               in:
                 container:
                   source: container
                 d:
-                  source: main_2_embed_2/d
+                  source: main_2_embed_1/d
               out:
                 - superuser_token
               run: '#superuser_tok'