Skip to content

Commit 36f3eb0

Browse files
authored
Merge pull request #46 from vrushaliwaykole/username-password-support-for-git-hg-material
Document Support for username and password field while specifying git and hg material.
2 parents 6b6936d + 6dfdbdf commit 36f3eb0

File tree

1 file changed

+73
-12
lines changed

1 file changed

+73
-12
lines changed

README.md

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ you can find examples of correct environments [below](#environment).
121121

122122
Please note that it is now recommended to declare the _same_ `format_version` in each `*.gopipeline.json` or `*.goenvironment.json` file.
123123

124-
#### GoCD server version from 19.3.0 and beyond
124+
#### GoCD server version from 19.4.0 and beyond
125+
126+
Supports `format_version` value of `5`. In this version, support of `username` and `encrypted_password` for [git](#git-material-update) and [hg](#hg-material-update) material has been added. In addition to that, [hg](#hg-material-update) will also support `branch` attribute.
127+
128+
Using a newer `format_version` includes all the behavior of the previous versions too.
129+
130+
#### GoCD server version from 19.3.0 to 19.4.0
125131

126132
Supports `format_version` value of `4`. In this version, support has been added to control the [display order of pipelines](#display-order-of-pipelines).
127133

@@ -529,17 +535,42 @@ All scm materials can have filter object:
529535
"auto_update": false,
530536
"name": "gitMaterial1",
531537
"type": "git",
532-
"shallow_clone": true
538+
"shallow_clone": true,
539+
"username": "user1",
540+
"encrypted_password": "encrypted_value"
541+
}
542+
```
543+
<a name="git-material-update"/>
544+
545+
For **GoCD >= 19.4.0 and `format_version: 5` and above**:
546+
547+
You are advised to utilize `username` and `encrypted_password` for passing in material credentials as:
548+
549+
```json
550+
{
551+
"url": "http://my.git.repository.com",
552+
"branch": "feature12",
553+
"username": "user1",
554+
"encrypted_password": "encrypted_value"
533555
}
534556
```
535557

558+
- Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.
559+
- Specifying credentials both in `attributes` and `url` will result in a validation error e.g.
560+
```log
561+
INVALID MERGED CONFIGURATION
562+
Number of errors: 1+
563+
1. Ambiguous credentials, must be provided either in URL or as attributes.;;
564+
- For Config Repo: https://your.config.repo.url at cbb047d78c239ab23b9565099e800c6fe4cc0anc
565+
```
566+
536567
## Svn
537568

538569
```json
539570
{
540571
"url": "http://svn",
541572
"username": "user1",
542-
"password": "pass1",
573+
"encrypted_password": "encrypted_value",
543574
"check_externals": true,
544575
"filter": {
545576
"ignore": [
@@ -554,8 +585,7 @@ All scm materials can have filter object:
554585
}
555586
```
556587

557-
Instead of plain `password` you may specify `encrypted_password` with encrypted content
558-
which usually makes more sense considering that value is stored in SCM.
588+
Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.
559589

560590
## Hg
561591

@@ -571,7 +601,40 @@ which usually makes more sense considering that value is stored in SCM.
571601
"destination": "dir1",
572602
"auto_update": false,
573603
"name": "hgMaterial1",
574-
"type": "hg"
604+
"type": "hg",
605+
"username": "user1",
606+
"encrypted_password": "encrypted_value",
607+
"branch": "feature"
608+
}
609+
```
610+
<a name="hg-material-update"/>
611+
612+
For **GoCD >= 19.4.0 and `format_version: 5` and above**:
613+
614+
You are advised to utilize `username` and `encrypted_password` for passing in material credentials as:
615+
616+
```json
617+
{
618+
"url": "repos/myhg",
619+
"username": "user1",
620+
"encrypted_password": "encrypted_value"
621+
}
622+
```
623+
624+
- Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.
625+
- Specifying credentials both in `attributes` and `url` will result in a validation error e.g.
626+
```log
627+
INVALID MERGED CONFIGURATION
628+
Number of errors: 1+
629+
1. Ambiguous credentials, must be provided either in URL or as attributes.;;
630+
- For Config Repo: https://your.config.repo.url at cbb047d78c239ab23b9565099e800c6fe4cc0anc
631+
```
632+
633+
In addition to that, you can also leverage `branch` attribute to specify the branch for material
634+
635+
```json
636+
{
637+
"branch": "feature"
575638
}
576639
```
577640

@@ -581,7 +644,7 @@ which usually makes more sense considering that value is stored in SCM.
581644
{
582645
"port": "10.18.3.102:1666",
583646
"username": "user1",
584-
"password": "pass1",
647+
"encrypted_password": "encrypted_value",
585648
"use_tickets": false,
586649
"view": "//depot/dev/src... //anything/src/...",
587650
"filter": {
@@ -597,8 +660,7 @@ which usually makes more sense considering that value is stored in SCM.
597660
}
598661
```
599662

600-
Instead of plain `password` you may specify `encrypted_password` with encrypted content
601-
which usually makes more sense considering that value is stored in SCM.
663+
Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.
602664

603665
## Tfs
604666

@@ -607,7 +669,7 @@ which usually makes more sense considering that value is stored in SCM.
607669
"url": "url3",
608670
"username": "user4",
609671
"domain": "example.com",
610-
"password": "pass",
672+
"encrypted_password": "encrypted_value",
611673
"project": "projectDir",
612674
"filter": {
613675
"ignore": [
@@ -622,8 +684,7 @@ which usually makes more sense considering that value is stored in SCM.
622684
}
623685
```
624686

625-
Instead of plain `password` you may specify `encrypted_password` with encrypted content
626-
which usually makes more sense considering that value is stored in SCM.
687+
Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.
627688

628689
## Dependency
629690

0 commit comments

Comments
 (0)