Upload files

Upload files#

The cli can be used to upload files to sharepoint. The files 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 files 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 files to it, otherwise the upload will fail.

The sharepoint upload-files command offers the following options:

Usage: python -m grow.sharepoint.cli upload-files [OPTIONS]

  Upload files to SharePoint.

Options:
  --file TEXT                 File to upload  [required]
  -p, --sharepoint-path TEXT  SharePoint path  [required]
  -f, --force                 Force upload even if file exists
  --colors / --no-colors      Enable or disable colors in output
  --help                      Show this message and exit.

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 files 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"}' > git-fetcher-data.json
      sharepoint upload-files --file git-fetcher-data.json --sharepoint-path "Documents"
      echo '{"status": "GREEN", "comment": "This evaluation would be done by some evaluator"}'
    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
finalize:
  run: |
    html-finalizer
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-request-autopilot