You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
Create azureBlobUpload (#3766)
* add Step azureBlobUpload * add azure sdk and unit tests * add Documentation * fix Groovy Wrapper * adopt the requested changes from awsS3Upload * fix lint tests * downgrade azure sdk to go 1.17 * multiple fixes e.g. use of temporary files for tests * fix tests * Update cmd/azureBlobUpload.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update cmd/azureBlobUpload.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update documentation/docs/steps/azureBlobUpload.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update documentation/docs/steps/azureBlobUpload.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update documentation/docs/steps/azureBlobUpload.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update documentation/docs/steps/azureBlobUpload.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * requested changes * use latest version of azure sdk after update to go 1.18 * change staticcheck from 1.1.0 to 1.2.0 * try to fix lint test by pre-compiling go 1.18 * fix caching for lint test * improve error handling by dividing runner * improve error handling and add validation * multiple naming fixes * add new test for unmarshalling JSON-Structs * Update cmd/azureBlobUpload_test.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update cmd/azureBlobUpload_test.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update cmd/azureBlobUpload_test.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * fix JSON unmarshall test * Update documentation/docs/steps/azureBlobUpload.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update cmd/azureBlobUpload_test.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * Update cmd/azureBlobUpload.go Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * fix uploadFunc Co-authored-by: Thorsten Duda <thorsten.duda@sap.com> Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
This commit is contained in:
48
documentation/docs/steps/azureBlobUpload.md
Normal file
48
documentation/docs/steps/azureBlobUpload.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# ${docGenStepName}
|
||||
|
||||
## ${docGenDescription}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* Before you can access Azure Storage, you will need an Azure subscription. If you do not have a subscription, create an [account](https://azure.microsoft.com/en-us/).
|
||||
* This step currently only supports authentication via Shared Access Signature (SAS).
|
||||
* You can generate a SAS token from the Azure Portal under [Create a service SAS](https://docs.microsoft.com/en-us/rest/api/storageservices/create-service-sas).
|
||||
* The SAS token must allow the actions "Write" and "Create" for the specified Azure Blob Storage.
|
||||
|
||||
## Set up the Azure Credentials
|
||||
|
||||
To make your Azure credentials available to the jenkins library, store them as Jenkins credentials of type "Secret Text". The "Secret Text" must be in JSON format and contain the "account_name", "container_name", as well as the "sas_token".
|
||||
|
||||
For Example:
|
||||
|
||||
```JSON
|
||||
{
|
||||
"account_name": "asdfg12345jhgfdwertz4et5",
|
||||
"container_name": "abcde-lkjhg-qwertzui-fghj-9876-1234-7594rbnsmncx-xyz",
|
||||
"sas_token": "sig=1234567890wertzuiopaYXCVBNMASDsdfghjkloi1234567890qwedf%1993-12-15opphehttpsqtgcshje1234-aqwe-1234-5678-t57894u875LH2%nv23"
|
||||
}
|
||||
```
|
||||
|
||||
If the JSON string contains additional information, this is not a problem. These are skipped.
|
||||
|
||||
## About Files/Directories to Upload
|
||||
|
||||
With this step you can upload single files as well as whole directories into your Azure Storage. File formats do not matter and directory structures are preserved.
|
||||
|
||||
**Note:** File paths must be specified in UNIX format. So the used path separator must be "/".
|
||||
|
||||
## ${docGenParameters}
|
||||
|
||||
## ${docGenConfiguration}
|
||||
|
||||
## ${docJenkinsPluginDependencies}
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
azureBlobUpload(
|
||||
script: this,
|
||||
azureCredentialsId: "Azure_Credentials",
|
||||
filePath: "test.txt"
|
||||
)
|
||||
```
|
||||
@@ -77,6 +77,7 @@ nav:
|
||||
- apiProxyUpload: steps/apiProxyUpload.md
|
||||
- artifactPrepareVersion: steps/artifactPrepareVersion.md
|
||||
- awsS3Upload: steps/awsS3Upload.md
|
||||
- azureBlobUpload: steps/azureBlobUpload.md
|
||||
- batsExecuteTests: steps/batsExecuteTests.md
|
||||
- buildExecute: steps/buildExecute.md
|
||||
- checkmarxExecuteScan: steps/checkmarxExecuteScan.md
|
||||
|
||||
Reference in New Issue
Block a user