Upload a folder

Upload a folder#

The cli can be used to upload a folder to sharepoint. This includes all files and sub folders recursively. The folder will be uploaded to the Sharepoint instance specified by the environment variable SHAREPOINT_PROJECT_SITE. Authentication is done using the environment variables SHAREPOINT_USERNAME and SHAREPOINT_PASSWORD. The folder will be uploaded to the path specified by the --sharepoint-path option. The --sharepoint-path option is relative to the root of the Sharepoint instance and does always start with Documents (e.g. Documents/my-results-folder). Make sure that the path exists before uploading a folder to it, otherwise the upload will fail. This can be used to e.g. upload the complete run result of an Automated Software Release to a Sharepoint folder.

The sharepoint upload-folder command offers the following options:

Usage: sharepoint upload-folder [OPTIONS] FOLDER

  Upload a folder to SharePoint.

Options:
  -p, --sharepoint-path TEXT  SharePoint path  [required]
  -f, --force                 Force upload even if folder exists
  --help                      Show this message and exit.

The environment variables are the same as for the sharepoint upload-files command. In order to use the uploader in your qg configuration, make sure to add the mandatory environment variables, arguments and options. This is a complete example of a qg configuration using the sharepoint cli to upload the run result to a Sharepoint instance:

metadata:
  version: v1
header:
  name: MACMA
  version: 1.16.0
autopilots:
  open-pull-request-autopilot:
    run: |
      echo '{"message": "This data would be fetched from some data source/server"}' > ${evidence_path}/git-fetcher-data.json
      echo '{"status": "GREEN", "comment": "This evaluation would be done by some evaluator"}'

finalize:
  run: |
    sharepoint upload-folder ${result_path} --sharepoint-path "Documents"
  env:
    SHAREPOINT_PROJECT_SITE: "https://mycompany.sharepoint.com/sites/my-site"
    SHAREPOINT_USERNAME: ${{ secrets.SHAREPOINT_USERNAME }}
    SHAREPOINT_PASSWORD: ${{ secrets.SHAREPOINT_PASSWORD }}
    SHAREPOINT_FORCE_IP: 10.139.201.176
    no_proxy: 10.139.201.176

chapters:
  "1":
    title: Project management
    requirements:
      "1.15":
        title: Make sure all release required changes are done
        text: >-
          Make sure all release required changes are done
        checks:
          "1":
            title: Check the status of all pull requests
            automation:
              autopilot: open-pull-requests-autopilot