1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-19 19:44:27 +02:00
Julian Schmitt dd0aae6ded
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>
2022-06-15 09:41:02 +02:00

1.7 KiB

${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.
  • 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.
  • 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:

{
  "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

azureBlobUpload(
    script: this,
    azureCredentialsId: "Azure_Credentials",
    filePath: "test.txt"
)