如何使用 Jenkins 上传到 Azure Data Lake Storage Gen1?

How to use Jenkins to upload to Azure Data Lake Storage Gen1?

我找到了 Windows 用于 Jenkins 的 Azure 存储插件。但它似乎只适用于 blob 存储。 有没有办法从 Jenkins 将文件上传到 Azure Data Lake Storage Gen1? 感谢您的帮助!

据我所知,目前没有 Jenkins 插件可以将文件从 Jenkins 上传到 Azure Data Lake Storae Gen1。 您可以使用 Azure PowerShell 或 Azure CLI 来完成您的要求。

示例 Azure PowerShell 命令:

Import-AzDataLakeStoreItem -AccountName $dataLakeStorageGen1Name -Path "C:\sampledata\vehicle1_09142014.csv" -Destination $myrootdir\mynewdirectory\vehicle1_09142014.csv

示例 Azure CLI 命令:

az dls fs upload --account mydatalakestoragegen1 --source-path "C:\SampleData\AmbulanceData\vehicle1_09142014.csv" --destination-path "/mynewfolder/vehicle1_09142014.csv"

更多信息,请参考以下文章:

https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-powershell#upload-data-to-your-data-lake-storage-gen1-account

https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-cli-2.0

https://docs.microsoft.com/en-us/powershell/module/az.datalakestore/import-azdatalakestoreitem?view=azps-1.5.0

https://docs.microsoft.com/en-us/cli/azure/dls/fs?view=azure-cli-latest#az-dls-fs-upload

使这项工作没有任何问题的先决条件是:

  1. 在您 运行 命令所在的节点中安装 Azure PowerShell / Azure CLI。

  2. 按照此处的说明将 Azure 服务主体添加到 Jenkins 凭证 -> https://docs.microsoft.com/en-us/azure/jenkins/execute-cli-jenkins-pipeline#add-azure-service-principal-to-jenkins-credential

希望对您有所帮助!!干杯!!