download_data.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright 2021 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. name: Download data
  16. inputs:
  17. - {name: Url, type: URI}
  18. - {name: curl options, type: string, default: '--location', description: 'Additional options given to the curl program. See https://curl.haxx.se/docs/manpage.html'}
  19. outputs:
  20. - {name: Data}
  21. metadata:
  22. annotations:
  23. author: Alexey Volkov <alexey.volkov@ark-kun.com>
  24. implementation:
  25. container:
  26. # image: curlimages/curl # Sets a non-root user which cannot write to mounted volumes. See https://github.com/curl/curl-docker/issues/22
  27. image: byrnedo/alpine-curl@sha256:548379d0a4a0c08b9e55d9d87a592b7d35d9ab3037f4936f5ccd09d0b625a342
  28. command:
  29. - sh
  30. - -exc
  31. - |
  32. url="$0"
  33. output_path="$1"
  34. curl_options="$2"
  35. mkdir -p "$(dirname "$output_path")"
  36. curl --get "$url" --output "$output_path" $curl_options
  37. - inputValue: Url
  38. - outputPath: Data
  39. - inputValue: curl options