Skip to content

Commit 15c954c

Browse files
authored
Upgrade to track 2 SDK, v6 => v12 (#15)
1 parent 78e7767 commit 15c954c

File tree

19 files changed

+662
-863
lines changed

19 files changed

+662
-863
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ hs_err_pid*
3333
*.settings
3434
*.project
3535
*.classpath
36-
*.iml
36+
*.iml
37+
.env
38+
testvirtualfile*
39+
testartifact*

README.md

+14-76
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,16 @@
22

33
> ***Important***: This plug-in is maintained by the Jenkins community and won’t be supported by Microsoft as of February 29, 2024.
44
5-
## Using Credentials Binding and Az CLI
6-
7-
[Credentials Binding](https://plugins.jenkins.io/credentials-binding/) and Az CLI is the recommended way to integrate with Azure services.
8-
9-
1. Make sure you have [Az CLI installed](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), version 2.0.67 or higher.
10-
2. Create a service principal using Az CLI:
11-
12-
```bash
13-
az ad sp create-for-rbac
14-
```
15-
16-
3. Make sure the [Credentials plugin](https://plugins.jenkins.io/credentials/) is installed and add a credential in Jenkins Credentials page.
17-
18-
Ensure that the credential kind is ***Username with password*** and enter the following items:
19-
* Username - The ***accountName*** of the storage account created.
20-
* Password - The ***accessKey*** of the storage account created.
21-
* ID - Credential identifier such as AzureServicePrincipal
22-
23-
Sample Jenkinsfile (declarative pipeline)
24-
25-
Upload to blob
26-
```groovy
27-
pipeline {
28-
agent any
29-
30-
stages {
31-
stage('Hello') {
32-
steps {
33-
withCredentials([usernamePassword(credentialsId: 'myAzureStorage', passwordVariable: 'ACCOUNT_KEY', usernameVariable: 'ACCOUNT_NAME')]) {
34-
sh 'az storage blob upload-batch --destination <containerName> --source <yourSourceDirectory> --pattern <pattern> --account-key $ACCOUNT_KEY --account-name $ACCOUNT_NAME'
35-
}
36-
37-
}
38-
}
39-
}
40-
}
41-
```
42-
Upload to file share
43-
```groovy
44-
pipeline {
45-
agent any
46-
47-
stages {
48-
stage('Hello') {
49-
steps {
50-
withCredentials([usernamePassword(credentialsId: 'myAzureStorage', passwordVariable: 'ACCOUNT_KEY', usernameVariable: 'ACCOUNT_NAME')]) {
51-
sh 'az storage file upload-batch --destination <fileShareName> --source <yourSourceDirectory> --pattern <pattern> --account-key $ACCOUNT_KEY --account-name $ACCOUNT_NAME'
52-
}
53-
54-
}
55-
}
56-
}
57-
}
58-
```
59-
60-
---
61-
# About this plugin
62-
Azure Artifact Manager plugin is an Artifact Manager that allows you store your artifacts into Azure Blob Storage. Azure Artifact Manager plugin works transparently to Jenkins and your jobs, it is like the default Artifact Manager.
5+
Azure Artifact Manager plugin is an Artifact Manager that allows you store your artifacts into Azure Blob Storage.
6+
Azure Artifact Manager plugin works transparently to Jenkins and your jobs, it is like the default Artifact Manager.
637

648
## Configuration
659

66-
1. At least one Azure storage account must be configured in the global configuration before the plugin can be used in build steps. To add a storage account, go to Manage Jenkins | Configure System | Microsoft Azure Storage Account Configuration and fill out the needed information.
10+
1. At least one Azure storage account must be configured in the global configuration before the plugin can be used in build steps.
11+
To add a storage account, go to Manage Jenkins | Configure System | Microsoft Azure Storage Account Configuration and fill out the needed information.
6712

68-
2. In Manage Jenkins | Configure System | Artifact Management for Builds, choose Azure Storage as the cloud provider. Choose the storage Credentials created in step one, and choose your container name and prefix.
13+
2. In Manage Jenkins | Configure System | Artifact Management for Builds, choose Azure Storage as the cloud provider.
14+
Choose the storage Credentials created in step one, and choose your container name and prefix.
6915

7016
![configuration](images/configuration.png)
7117

@@ -78,7 +24,7 @@ To use Azure Artifact Manager, you can use the artifact step to archive/unarchiv
7824
Azure Artifact Manager plugin can be used in a pipeline job. You can use `archiveArtifacts` step to archive artifacts into Azure Blob Storage.
7925

8026
```
81-
node() {
27+
node {
8228
//...
8329
stage('Archive') {
8430
archiveArtifacts "pattern"
@@ -89,18 +35,19 @@ node() {
8935
To unarchive artifacts, you can use the `unarchive` step which will retrieve the artifacts from Azure Blob Storage.
9036

9137
```
92-
node() {
38+
node {
9339
//...
9440
stage('Unarchive') {
9541
unarchive mapping: ["pattern": '.']
9642
}
9743
}
9844
```
9945

100-
To save a set of files so that you can use them later in the same build(generally on another node or workspace), you can use `stash` step to store files into Azure Blob Storage for later use.
46+
To save a set of files so that you can use them later in the same build (generally on another node or workspace),
47+
you can use `stash` step to store files into Azure Blob Storage for later use.
10148

10249
```
103-
node() {
50+
node {
10451
//...
10552
stash name: 'name', includes: '*'
10653
}
@@ -117,20 +64,11 @@ node() {
11764

11865
### FreeStyle Job
11966

120-
For FreeStyle jobs, you can archive artifacts by adding a `Post-build Actions` of type `Archive the artifacts`, and this will use the Azure Artifact Manager plugin to store the artifacts into Azure Blob Storage.
67+
For FreeStyle jobs, you can archive artifacts by adding a `Post-build Actions` of type `Archive the artifacts`,
68+
and this will use the Azure Artifact Manager plugin to store the artifacts into Azure Blob Storage.
12169

12270
![freestyle-archive](images/freestyle-archive.png)
12371

12472
## Contributing
12573

126-
This project welcomes contributions and suggestions. Most contributions require you to agree to a
127-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
128-
the rights to use your contribution. For details, visit https://cla.microsoft.com.
129-
130-
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
131-
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
132-
provided by the bot. You will only need to do this once across all repos using our CLA.
133-
134-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
135-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
136-
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
74+
See [CONTRIBUTING.md](https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md) for the contribution guidelines.

checkstyle.xml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC
33
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4-
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

66
<!--
77
Based on the sun_checks.xml https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml
@@ -45,6 +45,10 @@
4545
<property name="message" value="Line has trailing spaces."/>
4646
</module>
4747

48+
<module name="LineLength">
49+
<property name="max" value="120"/>
50+
</module>
51+
4852
<module name="TreeWalker">
4953
<!-- Checks for Javadoc comments. -->
5054
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
@@ -73,9 +77,6 @@
7377

7478
<!-- Checks for Size Violations. -->
7579
<!-- See http://checkstyle.sf.net/config_sizes.html -->
76-
<module name="LineLength">
77-
<property name="max" value="120"/>
78-
</module>
7980
<module name="MethodLength"/>
8081

8182
<!-- Checks for whitespace -->
@@ -133,9 +134,7 @@
133134
<!-- See http://checkstyle.sf.net/config_misc.html -->
134135
<module name="ArrayTypeStyle"/>
135136
<module name="UpperEll"/>
136-
<module name="FileContentsHolder"/>
137+
<module name="SuppressionCommentFilter"/>
137138
</module>
138139

139-
<module name="SuppressionCommentFilter"/>
140-
141140
</module>

0 commit comments

Comments
 (0)