57 Commits

Author SHA1 Message Date
e967605742 update dependency after merge from master 2021-02-28 20:25:07 +01:00
e65dc96bde Merge remote-tracking branch 'origin/master' into releases/v2 2021-02-28 20:22:43 +01:00
b742fc533f prepare release 2.4.0 2021-02-28 20:20:35 +01:00
d1f8f65870 Merge pull request #97 from s4u/dependabot/github_actions/actions/setup-node-v2.1.5
Bump actions/setup-node from v2.1.4 to v2.1.5
2021-02-28 11:42:22 +01:00
de53ea431e Bump actions/setup-node from v2.1.4 to v2.1.5
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.4...46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-23 09:00:30 +00:00
cd16d8406c Completed the attribute support for servers. (#95)
* Completed the attribute support for servers, and password is optional. Resolves #92.

* Updated oracleServers.xml template to match new servers.xml template.

* Revised tests to match code and template changes.

* Added documentation for server attributes.

* Added additional use cases to exercise server attribute handling.
2021-02-16 22:46:27 +01:00
abf1253b29 Merge pull request #94 from awhitford/typos
Corrected typos. Resolves #93.
2021-02-16 08:29:57 +01:00
7a5cb7ba33 Merge pull request #91 from s4u/dependabot/npm_and_yarn/eslint-7.20.0
Bump eslint from 7.19.0 to 7.20.0
2021-02-16 08:27:27 +01:00
7799be5210 Bump eslint from 7.19.0 to 7.20.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.19.0 to 7.20.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.19.0...v7.20.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 07:19:24 +00:00
82e778d8d7 File sync from s4u/.github 2021-02-16 07:05:18 +00:00
175b85e48d Corrected typos. Resolves #93. 2021-02-15 14:23:05 -08:00
40cb7c6ba4 Merge pull request #89 from s4u/dependabot/npm_and_yarn/eslint-7.19.0
Bump eslint from 7.18.0 to 7.19.0
2021-02-07 14:43:44 +01:00
a154ae5bb3 Bump eslint from 7.18.0 to 7.19.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.18.0 to 7.19.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.18.0...v7.19.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 09:06:12 +00:00
26b06607c7 Merge pull request #88 from s4u/dependabot/npm_and_yarn/eslint-7.18.0
Bump eslint from 7.17.0 to 7.18.0
2021-01-18 20:00:27 +01:00
5391894326 Bump eslint from 7.17.0 to 7.18.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.17.0 to 7.18.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.17.0...v7.18.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-18 09:01:10 +00:00
a9c25dcc48 Merge pull request #87 from s4u/dependabot/npm_and_yarn/eslint-7.17.0
Bump eslint from 7.16.0 to 7.17.0
2021-01-04 11:22:39 +01:00
6240d8dec2 Bump eslint from 7.16.0 to 7.17.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.16.0 to 7.17.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.16.0...v7.17.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 09:01:04 +00:00
0ae2055ed1 File sync from s4u/.github 2020-12-29 18:32:24 +00:00
eb98cf558d File sync from s4u/.github 2020-12-28 00:31:56 +00:00
df02243d71 update dependency after merge from master 2020-12-21 23:49:59 +01:00
a2731cf297 Merge remote-tracking branch 'origin/master' into releases/v2 2020-12-21 23:46:41 +01:00
fe12eba098 prepare release 2.3.0 2020-12-21 23:44:58 +01:00
fa0be5f968 refresh package-lock.json 2020-12-21 23:38:49 +01:00
2a1bf9c27e Merge pull request #86 from s4u/fix-84
Allow defining custom configuration for server
2020-12-21 23:35:13 +01:00
060e4442b5 Allow defining custom configuration for server
fix #84
2020-12-21 23:28:12 +01:00
4309eaf1f7 Merge pull request #85 from s4u/dependabot/npm_and_yarn/eslint-7.16.0
Bump eslint from 7.15.0 to 7.16.0
2020-12-21 15:56:32 +01:00
530d13699b Bump eslint from 7.15.0 to 7.16.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.15.0 to 7.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.15.0...v7.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-21 09:01:10 +00:00
78af212661 Merge pull request #83 from s4u/dependabot/github_actions/actions/setup-node-v2.1.4
Bump actions/setup-node from v2.1.3 to v2.1.4
2020-12-18 14:01:45 +01:00
6781626242 Bump actions/setup-node from v2.1.3 to v2.1.4
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.3 to v2.1.4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.3...c46424eee26de4078d34105d3de3cc4992202b1e)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-17 09:00:28 +00:00
c2d71a67ea Merge pull request #82 from jimmyd-be/master
Add note to explain situation with actions/cache
2020-12-15 10:49:53 +01:00
25300b87d9 Add note to explain situation with actions/cache 2020-12-14 21:01:26 +01:00
75f172be63 Merge pull request #80 from s4u/dependabot/github_actions/actions/setup-node-v2.1.3
Bump actions/setup-node from v2.1.2 to v2.1.3
2020-12-12 20:47:49 +01:00
7e15ec568d Bump actions/setup-node from v2.1.2 to v2.1.3
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.2 to v2.1.3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.2...27082cecf3ff7a1742dbd5e12605f0cb59dce2d9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-12 19:43:35 +00:00
a8a028af57 File sync from s4u/.github 2020-12-12 11:38:50 +00:00
2426826ebc File sync from s4u/.github 2020-12-12 11:32:50 +00:00
b1f588d74f Merge pull request #79 from s4u/dependabot/npm_and_yarn/eslint-7.15.0
Bump eslint from 7.14.0 to 7.15.0
2020-12-10 01:22:34 +01:00
bfee59b12a Bump eslint from 7.14.0 to 7.15.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.14.0 to 7.15.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.14.0...v7.15.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 09:01:15 +00:00
d016a0cc3c Merge pull request #78 from rnc/BR1
Issue #77 : Clarify documentation for secrets
2020-12-02 23:08:08 +01:00
fbff164add Issue #77 : Clarify documentation for secrets 2020-12-02 15:58:33 +00:00
96e7617cbc Merge pull request #76 from s4u/dependabot/npm_and_yarn/eslint-7.14.0
Bump eslint from 7.13.0 to 7.14.0
2020-11-23 16:33:35 +01:00
e970e3e5f9 Bump eslint from 7.13.0 to 7.14.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.13.0 to 7.14.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.13.0...v7.14.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 09:01:17 +00:00
07702512f4 Merge pull request #75 from s4u/dependabot/npm_and_yarn/eslint-7.13.0
Bump eslint from 7.12.1 to 7.13.0
2020-11-10 15:58:30 +01:00
d07365e2cd Bump eslint from 7.12.1 to 7.13.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.12.1 to 7.13.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.12.1...v7.13.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-10 07:49:31 +00:00
7b2fa81b55 Merge pull request #74 from s4u/dependabot/npm_and_yarn/jest-26.6.3
Bump jest from 26.6.1 to 26.6.3
2020-11-10 08:48:26 +01:00
772d1cd04c Bump jest from 26.6.1 to 26.6.3
Bumps [jest](https://github.com/facebook/jest) from 26.6.1 to 26.6.3.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.6.1...v26.6.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-10 07:45:40 +00:00
3d63f86fbc Merge pull request #73 from s4u/dependabot/github_actions/actions/checkout-v2.3.4
Bump actions/checkout from v2.3.3 to v2.3.4
2020-11-10 08:44:33 +01:00
54bf9b072d Bump actions/checkout from v2.3.3 to v2.3.4
Bumps [actions/checkout](https://github.com/actions/checkout) from v2.3.3 to v2.3.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.3...5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-05 22:19:11 +00:00
bda41227d8 File sync from s4u/.github 2020-11-05 22:11:09 +00:00
9c42cb38ac Merge pull request #70 from s4u/dependabot/npm_and_yarn/xmldom-0.4.0
Bump xmldom from 0.3.0 to 0.4.0
2020-11-01 20:51:35 +01:00
b034b76077 Bump xmldom from 0.3.0 to 0.4.0
Bumps [xmldom](https://github.com/xmldom/xmldom) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-01 19:46:59 +00:00
ed5f8cf141 Merge pull request #69 from s4u/dependabot/npm_and_yarn/eslint-7.12.1
Bump eslint from 7.11.0 to 7.12.1
2020-11-01 20:45:51 +01:00
ae0dfdae9b Bump eslint from 7.11.0 to 7.12.1
Bumps [eslint](https://github.com/eslint/eslint) from 7.11.0 to 7.12.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.11.0...v7.12.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-01 19:22:05 +00:00
f033cb9cb6 File sync from s4u/.github 2020-11-01 19:20:46 +00:00
e7ad595eea Merge pull request #68 from s4u/dependabot/npm_and_yarn/jest-26.6.1
Bump jest from 26.6.0 to 26.6.1
2020-10-27 22:35:55 +01:00
4037eb19d4 Bump jest from 26.6.0 to 26.6.1
Bumps [jest](https://github.com/facebook/jest) from 26.6.0 to 26.6.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.6.0...v26.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 09:01:08 +00:00
c5205056ba Merge pull request #66 from s4u/dependabot/npm_and_yarn/jest-26.6.0
Bump jest from 26.5.3 to 26.6.0
2020-10-21 14:26:06 +02:00
cdd3549d27 Bump jest from 26.5.3 to 26.6.0
Bumps [jest](https://github.com/facebook/jest) from 26.5.3 to 26.6.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.5.3...v26.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 09:01:18 +00:00
22 changed files with 8743 additions and 2513 deletions

40
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,40 @@
categories:
- title: 'New features'
labels:
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'bug'
- title: 'Maintenance'
labels:
- 'code quality'
- 'documentation'
- title: 'Dependency updates'
labels:
- 'dependencies'
change-template: '- $TITLE #$NUMBER'
sort-direction: 'ascending'
template: |
# What's Changed
$CHANGES
# Thanks
Many thanks for collaboration on this release for: $CONTRIBUTORS
replacers:
- search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g'
replace: ''
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
replace: ''
- search: '/(?:and )?Github Action(?:\[bot\])?,?/g'
replace: ''

View File

@ -17,9 +17,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.3
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.2
- uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'

19
.github/workflows/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Release Drafter
on:
push:
branches:
- 'master'
jobs:
update_release_draft:
name: Update Release Draft
runs-on: ubuntu-latest
if: >
github.repository_owner == 's4u'
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
steps:
- uses: release-drafter/release-drafter@v5.14.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -17,9 +17,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.3
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.2
- uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'

132
README.md
View File

@ -25,84 +25,176 @@ or use automatic tools like [Dependabot](https://dependabot.com/).
# Usage
See [action.yml](action.yml)
Create default ```settings.xml```:
## default ```settings.xml```
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
```
Create ```settings.xml``` with servers section:
## ```settings.xml``` with servers section
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```
Create ```settings.xml``` with mirrors section:
All `server` attributes may be specified:
* `id` _(required)_
* `username`
* `password`
* `privateKey`
* `passphrase`
* `filePermissions`
* `directoryPermissions`
* `configuration`
Please refer to the [servers](http://maven.apache.org/settings.html#Servers) documentation for more information.
## ```settings.xml``` with servers section and additional configuration
``` yml
steps:
- uses: s4u/maven-settings-action@v2.4.0
with:
servers: |
[{
"id": "serverId",
"configuration": {
"item1": "value1",
"item2": {
"item21": "value21",
"item22": "value22"
}
}
}]
```
result will be:
```xml
<server>
<id>serverId</id>
<configuration>
<item1>value1</item1>
<item2>
<item21>value21</item21>
<item22>value22</item22>
</item1>
</configuration>
</server></servers>
```
## ```settings.xml``` with mirrors section
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
```
Create ```settings.xml``` with maven properties:
## ```settings.xml``` with properties
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
```
Create ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
## ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
sonatypeSnapshots: true
```
Create ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
## ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
apacheSnapshots: true
```
Do not override existing ```settings.xml```, from version 2.0 file is override by default :
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
override: false
```
Do not add github to server in ```settings.xml```, by default is added:
## Do not add github to server in ```settings.xml```, by default is added:
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
githubServer: false
```
Create ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
## ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```
Create ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
```yml
steps:
- uses: s4u/maven-settings-action@v2.2.0
- uses: s4u/maven-settings-action@v2.4.0
with:
oracleRepo: true
```
## GitHub actions secrets
It is also possible pass in Github Secrets e.g.
``` yml
steps:
- uses: s4u/maven-settings-action@v2.4.0
with:
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
```
**Note**: secrets are *not* passed in if the workflow is triggered from a forked repository. See [here](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow) for further information. This can be avoided by using `if` triggers on the job e.g. `if: github.event_name == 'push'`.
# Notes
**maven-settings-action** should be put at the latest position before maven run in order to avoid override ```setting.xml``` by another action
```yml
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: s4u/maven-settings-action@v2.4.0
- run: mvn verify
```
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)

View File

@ -1,4 +1,4 @@
name: 'maven-setings-action'
name: 'maven-settings-action'
description: 'Prepare maven settings.xml'
branding:
@ -7,7 +7,7 @@ branding:
inputs:
servers:
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
required: false
mirrors:
description: 'mirrors definition in json array, eg: [{"id": "id", "name": "name", "mirrorOf": "mirrorOf", "url": "url"}]'
@ -32,7 +32,7 @@ inputs:
default: "true"
required: false
oracleServers:
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
required: false
oracleRepo:
description: 'add Oracle Maven Repository'

View File

@ -63,11 +63,11 @@ afterAll(() => {
test('run with all feature', () => {
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword"}]';
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
process.env['INPUT_GITHUBSERVER'] = true;
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword", "configuration": {"props1": "value1"}}]';
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
process.env['INPUT_GITHUBSERVER'] = true;
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
process.env['INPUT_APACHESNAPSHOTS'] = true;
@ -80,7 +80,7 @@ test('run with all feature', () => {
expect(settingsStatus.isFile()).toBeTruthy();
expect(settingsStatus.size).toBeGreaterThan(0);
const settingsBody = fs.readFileSync(settingsPath).toString();
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^\s*$(?:\r\n?|\n)/gm, '');
expect(settingsBody).toBe(`<settings>
<interactiveMode>false</interactiveMode>
<profiles>
@ -186,6 +186,7 @@ test('run with all feature', () => {
<id>serverId</id>
<username>sUsername</username>
<password>sPassword</password>
<configuration><props1>value1</props1></configuration>
</server>
<server>
<id>oServerId</id>

21
node_modules/.package-lock.json generated vendored Normal file
View File

@ -0,0 +1,21 @@
{
"name": "maven-settings-action",
"version": "2.4.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@actions/core": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
},
"node_modules/xmldom": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.4.0.tgz",
"integrity": "sha512-2E93k08T30Ugs+34HBSTQLVtpi6mCddaY8uO+pMNk1pqSjV5vElzn4mmh6KLxN3hki8rNcHSYzILoh3TEWORvA==",
"engines": {
"node": ">=10.0.0"
}
}
}
}

171
node_modules/xmldom/CHANGELOG.md generated vendored
View File

@ -1,82 +1,175 @@
## 0.4.0
[Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.4.0)
### Fixes
- **BREAKING** Restore `&nbsp;` behavior from v0.1.27 [`#67`](https://github.com/xmldom/xmldom/pull/67)
- **BREAKING** Typecheck source param before parsing [`#113`](https://github.com/xmldom/xmldom/pull/113)
- Include documents in package files list [`#156`](https://github.com/xmldom/xmldom/pull/156)
- Preserve doctype with sysid [`#144`](https://github.com/xmldom/xmldom/pull/144)
- Remove ES6 syntax from getElementsByClassName [`#91`](https://github.com/xmldom/xmldom/pull/91)
- Revert "Add lowercase of åäö in entityMap" due to duplicate entries [`#84`](https://github.com/xmldom/xmldom/pull/84)
- fix: Convert all line separators to LF [`#66`](https://github.com/xmldom/xmldom/pull/66)
### Docs
- Update CHANGELOG.md through version 0.3.0 [`#63`](https://github.com/xmldom/xmldom/pull/63)
- Update badges [`#78`](https://github.com/xmldom/xmldom/pull/78)
- Add .editorconfig file [`#104`](https://github.com/xmldom/xmldom/pull/104)
- Add note about import [`#79`](https://github.com/xmldom/xmldom/pull/79)
- Modernize & improve the example in readme.md [`#81`](https://github.com/xmldom/xmldom/pull/81)
### CI
- Add Stryker Mutator [`#70`](https://github.com/xmldom/xmldom/pull/70)
- Add Stryker action to update dashboard [`#77`](https://github.com/xmldom/xmldom/pull/77)
- Add Node GitHub action workflow [`#64`](https://github.com/xmldom/xmldom/pull/64)
- add & enable eslint [`#106`](https://github.com/xmldom/xmldom/pull/106)
- Use eslint-plugin-es5 to enforce ES5 syntax [`#107`](https://github.com/xmldom/xmldom/pull/107)
- Recover `vows` tests, drop `proof` tests [`#59`](https://github.com/xmldom/xmldom/pull/59)
- Add jest tessuite and first tests [`#114`](https://github.com/xmldom/xmldom/pull/114)
- Add jest testsuite with `xmltest` cases [`#112`](https://github.com/xmldom/xmldom/pull/112)
- Configure Renovate [`#108`](https://github.com/xmldom/xmldom/pull/108)
- Test European HTML entities [`#86`](https://github.com/xmldom/xmldom/pull/86)
- Updated devDependencies
### Other
- Remove files that are not of any use [`#131`](https://github.com/xmldom/xmldom/pull/131), [`#65`](https://github.com/xmldom/xmldom/pull/65), [`#33`](https://github.com/xmldom/xmldom/pull/33)
## 0.3.0
- Node >=10.x now required.
- Added getElementsByClassName method.
- Added Node to the list of exports
- Added lowercase of åäö in entityMap.
- Moved existing sources into `lib` subdirectory.
- Removed `.npmignore` in favor of `files` entry in package.json.
- More `package.json` refactoring.
- Replaced CHANGELOG with more rigorous file.
- Replaced LICENSE with more rigorous file.
- Removed component.json (deprecated package manager https://github.com/componentjs/guide)
- `proof` devDep updated to latest.
- Fixed CI.
- README updates.
[Commits](https://github.com/xmldom/xmldom/compare/0.2.1...0.3.0)
- **BREAKING** Node >=10.x is now required.
- **BREAKING** Remove `component.json` (deprecated package manager https://github.com/componentjs/guide)
- **BREAKING** Move existing sources into `lib` subdirectory.
- **POSSIBLY BREAKING** Introduce `files` entry in `package.json` and remove use of `.npmignore`.
- [Add `Document.getElementsByClassName`](https://github.com/xmldom/xmldom/issues/24).
- [Add `Node` to the list of exports](https://github.com/xmldom/xmldom/pull/27)
- [Add lowercase of åäö in `entityMap`](https://github.com/xmldom/xmldom/pull/23).
- Move CHANGELOG to markdown file.
- Move LICENSE to markdown file.
## 0.2.1
- More package.json refactoring.
[Commits](https://github.com/xmldom/xmldom/compare/0.2.0...0.2.1)
- Correct `homepage`, `repository` and `bugs` URLs in `package.json`.
## 0.2.0
- Now publishing under xmldom npm package again; retiring xmldom-alpha.
- Remove coveralls.
- Disable cache in travis.
- Other refactoring.
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...0.2.0)
## 0.1.28 (via xmldom-alpha npm package)
- Includes all **BREAKING** changes introduced in [`xmldom-alpha@v0.1.28`](#0128) by the original authors.
- **POSSIBLY BREAKING** [remove the `Object.create` check from the `_extends` method of `dom.js` that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/0be2ae910a8a22c9ec2cac042e04de4c04317d2a#diff-7d1c5d97786fdf9af5446a241d0b6d56L19-L22) ().
- **POSSIBLY BREAKING** [remove code that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/366159a76a181ce9a0d83f5dc48205686cfaf9cc)
- formatting/corrections in `package.json`
- Removed __proto__ accessor.
- Appended HTML entities defaults.
## 0.1.31
## 0.1.27 (via xmldom-alpha npm package)
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...v0.1.31)
The patch versions (`v0.1.29` - `v0.1.31`) that have been released on the [v0.1.x branch](https://github.com/xmldom/xmldom/tree/0.1.x), to reflect the changed maintainers, **are branched off from [`v0.1.27`](#0127) so they don't include the breaking changes introduced in [`xmldom-alpha@v0.1.28`](#0128)**:
## Maintainer changes
After the last commit to the original repository <https://github.com/jindw/xmldom> on the 9th of May 2017, the first commit to <https://github.com/xmldom/xmldom> is from the 19th of December 2019. [The fork has been announced in the original repository on the 2nd of March 2020.](https://github.com/jindw/xmldom/issues/259)
The versions listed below have been published to one or both of the following packages:
- <https://www.npmjs.com/package/xmldom-alpha>
- <https://www.npmjs.com/package/xmldom>
It is currently not planned to continue publishing the `xmldom-alpha` package.
The new maintainers did not invest time to understand changes that led to the last `xmldom` version [`0.1.27`](#0127) published by the original maintainer, but consider it the basis for their work.
A timeline of all the changes that happened from that version until `0.3.0` is available in <https://github.com/xmldom/xmldom/issues/62>. Any related questions should be asked there.
## 0.1.28
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...xmldom-alpha@v0.1.28)
Published by @jindw on the 9th of May 2017 as
- `xmldom-alpha@0.1.28`
- **BREAKING** includes [regression regarding `&nbsp;` (issue #57)](https://github.com/xmldom/xmldom/issues/57)
- [Fix `license` field in `package.json`](https://github.com/jindw/xmldom/pull/178)
- [Conditional converting of HTML entities](https://github.com/jindw/xmldom/pull/80)
- Fix `dom.js` serialization issue for missing document element ([example that failed on `toString()` before this change](https://github.com/xmldom/xmldom/blob/a58dcf7a265522e80ce520fe3be0cddb1b976f6f/test/parse/unclosedcomment.js#L10-L11))
- Add new module `entities.js`
## 0.1.27
Published by @jindw on the 28th of Nov 2016 as
- `xmldom@0.1.27`
- `xmldom-alpha@0.1.27`
- Various bug fixes.
- Don't ask why 0.1.26 and 0.1.25 were skipped. `¯\_(ツ)_/¯`
## 0.1.24 (via xmldom-alpha package)
## 0.1.26
Published on the 18th of Nov 2016
as `xmldom@0.1.26`
- Details unknown
## 0.1.25
Published on the 18th of Nov 2016 as
- `xmldom@0.1.25`
- Details unknown
## 0.1.24
Published on the 27th of November 2016 as
- `xmldom@0.1.24`
- `xmldom-alpha@0.1.24`
- Added node filter.
## 0.1.23 (via xmldom-alpha npm package)
## 0.1.23
- Added namespace support for nest node serialize.
Published on the 5th of May 2016 as
- `xmldom-alpha@0.1.23`
- Add namespace support for nest node serialize.
- Various other bug fixes.
## 0.1.22
- Merge XMLNS serialization.
- Removed \r from source string.
- Remove \r from source string.
- Print namespaces for child elements.
- Switch references to nodeType to use named constants.
- Add nodelist toString support.
## 0.1.21
- Fixed serialize bug.
- Fix serialize bug.
## 0.1.20
- Optimized invalid XML support.
- Added toString sorter for attributes output.
- Added html self closed node button.
- Added `*` NS support for getElementsByTagNameNS.
- Converted attribute's value to string in setAttributeNS.
- Added support for HTML entities for HTML docs only.
- Fixed TypeError when Document is created with DocumentType.
- Optimize invalid XML support.
- Add toString sorter for attributes output.
- Add html self closed node button.
- Add `*` NS support for getElementsByTagNameNS.
- Convert attribute's value to string in setAttributeNS.
- Add support for HTML entities for HTML docs only.
- Fix TypeError when Document is created with DocumentType.
## 0.1.19
- Fixed issue #68, infinite loop on unclosed comment.
- Added error report for unclosed tag.
- Fix [infinite loop on unclosed comment (jindw/xmldom#68)](https://github.com/jindw/xmldom/issues/68)
- Add error report for unclosed tag.
- Various other fixes.
## 0.1.18
- Added default `ns` support.
- Add default `ns` support.
- parseFromString now renders entirely plain text documents as textNode.
- Enabled option to ignore white space on parsing.
- Enable option to ignore white space on parsing.
## 0.1.17
**Details missing for this and potential earlier version**
## 0.1.16

2
node_modules/xmldom/lib/.eslintrc.yml generated vendored Normal file
View File

@ -0,0 +1,2 @@
extends:
- 'plugin:es5/no-es2015'

View File

@ -21,7 +21,7 @@ DOMParser.prototype.parseFromString = function(source,mimeType){
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
}
defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace';
if(source){
if(source && typeof source === 'string'){
sax.parse(source,defaultNSMap,entityMap);
}else{
sax.errorHandler.error("invalid doc source");

6
node_modules/xmldom/lib/dom.js generated vendored
View File

@ -609,10 +609,10 @@ Document.prototype = {
},
getElementsByClassName: function(className) {
const pattern = new RegExp(`(^|\\s)${className}(\\s|$)`);
return new LiveNodeList(this, base => {
var pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
return new LiveNodeList(this, function(base) {
var ls = [];
_visitNode(base.documentElement, node => {
_visitNode(base.documentElement, function(node) {
if(node !== base && node.nodeType == ELEMENT_NODE) {
if(pattern.test(node.getAttribute('class'))) {
ls.push(node);

View File

@ -9,9 +9,7 @@ exports.entityMap = {
Acirc: "Â",
Atilde: "Ã",
Auml: "Ä",
auml: "ä",
Aring: "Å",
aring: "å",
AElig: "Æ",
Ccedil: "Ç",
Egrave: "È",
@ -29,7 +27,6 @@ exports.entityMap = {
Ocirc: "Ô",
Otilde: "Õ",
Ouml: "Ö",
ouml: "ö",
Oslash: "Ø",
Ugrave: "Ù",
Uacute: "Ú",
@ -69,7 +66,7 @@ exports.entityMap = {
yacute: "ý",
thorn: "þ",
yuml: "ÿ",
nbsp: " ",
nbsp: "\u00a0",
iexcl: "¡",
cent: "¢",
pound: "£",
@ -244,4 +241,3 @@ exports.entityMap = {
hearts: "♥",
diams: "♦"
};
//for(var n in exports.entityMap){console.log(exports.entityMap[n].charCodeAt())}

12
node_modules/xmldom/lib/sax.js generated vendored
View File

@ -531,8 +531,16 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
var len = matchs.length;
if(len>1 && /!doctype/i.test(matchs[0][0])){
var name = matchs[1][0];
var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0]
var sysid = len>4 && matchs[4][0];
var pubid = false;
var sysid = false;
if(len>3){
if(/^public$/i.test(matchs[2][0])){
pubid = matchs[3][0];
sysid = len>4 && matchs[4][0];
}else if(/^system$/i.test(matchs[2][0])){
sysid = matchs[3][0];
}
}
var lastMatch = matchs[len-1]
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));

34
node_modules/xmldom/package.json generated vendored
View File

@ -1,6 +1,6 @@
{
"name": "xmldom",
"version": "0.3.0",
"version": "0.4.0",
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
"keywords": [
"w3c",
@ -19,17 +19,39 @@
},
"main": "lib/dom-parser.js",
"files": [
"CHANGELOG.md",
"LICENSE.md",
"readme.md",
"lib"
],
"scripts": {
"test": "proof platform win32 && proof test */*/*.t.js || t/test"
"lint": "npm-run-all lint:eslint",
"lint:eslint": "eslint lib test",
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test'",
"stryker": "stryker run",
"test": "npm-run-all test:unit lint",
"test:unit": "npm-run-all test:jest",
"test:jest": "jest"
},
"engines": {
"node": ">=10.0.0"
},
"dependencies": {},
"devDependencies": {
"proof": "~7.0.9"
"@stryker-mutator/core": "^3.3.1",
"@stryker-mutator/javascript-mutator": "^3.3.1",
"dom-js": "0.0.9",
"eslint": "^7.12.0",
"eslint-config-prettier": "^6.14.0",
"eslint-plugin-es5": "^1.5.0",
"eslint-plugin-prettier": "^3.1.4",
"get-stream": "^6.0.0",
"jest": "^26.6.1",
"nodemon": "^2.0.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"xmltest": "^1.4.0",
"yauzl": "^2.10.0"
},
"maintainers": [
{
@ -69,8 +91,4 @@
"url": "https://github.com/xmldom/xmldom/issues"
},
"license": "(LGPL-2.0 OR MIT)"
,"_resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.3.0.tgz"
,"_integrity": "sha512-z9s6k3wxE+aZHgXYxSTpGDo7BYOUfJsIRyoZiX6HTjwpwfS2wpQBQKa2fD+ShLyPkqDYo5ud7KitmLZ2Cd6r0g=="
,"_from": "xmldom@0.3.0"
}
}

42
node_modules/xmldom/readme.md generated vendored
View File

@ -1,4 +1,10 @@
# XMLDOM [![Build Status](https://secure.travis-ci.org/xmldom/xmldom.png?branch=master)](http://travis-ci.org/xmldom/xmldom) [![NPM version](https://badge.fury.io/js/xmldom.png)](http://badge.fury.io/js/xmldom)
# XMLDOM
[![license](https://img.shields.io/npm/l/xmldom?color=blue&style=flat-square)](./LICENSE.md)
[![npm](https://img.shields.io/npm/v/xmldom?style=flat-square)](https://www.npmjs.com/package/xmldom)
[![bug issues](https://img.shields.io/github/issues/xmldom/xmldom/bug?color=red&style=flat-square)](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
[!["help wanted" issues](https://img.shields.io/github/issues/xmldom/xmldom/help%20wanted?color=darkgreen&style=flat-square)](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![Mutation report](https://camo.githubusercontent.com/ee312c4ebce7784ce9f785757eba5d6e33e6d950/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324662726f647962697473253246786d6c646f6d2532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/brodybits/xmldom/master)
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
compatible with `W3C DOM level2`; and some compatible with `level3`. Supports
@ -13,20 +19,30 @@ Install:
Example:
====
```javascript
var DOMParser = require('xmldom').DOMParser;
var doc = new DOMParser().parseFromString(
'<xml xmlns="a" xmlns:c="./lite">\n'+
'\t<child>test</child>\n'+
'\t<child></child>\n'+
'\t<child/>\n'+
'</xml>'
,'text/xml');
doc.documentElement.setAttribute('x','y');
doc.documentElement.setAttributeNS('./lite','c:x','y2');
var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
console.info(nsAttr)
const { DOMParser } = require('xmldom')
const doc = new DOMParser().parseFromString(
'<xml xmlns="a" xmlns:c="./lite">\n' +
'\t<child>test</child>\n' +
'\t<child></child>\n' +
'\t<child/>\n' +
'</xml>',
'text/xml'
)
doc.documentElement.setAttribute('x', 'y')
doc.documentElement.setAttributeNS('./lite', 'c:x', 'y2')
console.info(doc)
const nsAttr = doc.documentElement.getAttributeNS('./lite', 'x')
console.info(nsAttr)
```
Note: in Typescript and ES6 you can use the import approach, as follows:
```javascript
import { DOMParser } from 'xmldom'
```
API Reference
=====

10500
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "maven-settings-action",
"version": "2.2.0",
"version": "2.4.0",
"description": "Prepare maven settings",
"main": "index.js",
"scripts": {
@ -25,10 +25,10 @@
"homepage": "https://github.com/s4u/maven-settings-action#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"xmldom": "^0.3.0"
"xmldom": "^0.4.0"
},
"devDependencies": {
"eslint": "^7.11.0",
"jest": "^26.5.3"
"eslint": "^7.20.0",
"jest": "^26.6.3"
}
}

View File

@ -50,17 +50,55 @@ function writeSettings(settingsPath, templateXml) {
fs.writeFileSync(settingsPath, settingStr);
}
function fillServer(templateXml, templateName, id, username, password) {
function jsonToXml(templateXml, xmlTag, json) {
for (const key in json) {
const keyXml = templateXml.createElement(key);
const value = json[key];
if (value instanceof Object) {
jsonToXml(templateXml, keyXml, value);
} else {
keyXml.textContent = value;
}
xmlTag.appendChild(keyXml);
}
}
if (!id || !username || !password) {
core.setFailed(templateName + ' must contain id, username and password');
function fillServer(templateXml, templateName, id, username, password, privateKey, passphrase, filePermissions, directoryPermissions, configurations) {
if (!id || (!username && !configurations)) {
core.setFailed(templateName + ' must contain id, and username or configuration');
return;
}
const serverXml = getTemplate(templateName + '.xml')
serverXml.getElementsByTagName('id')[0].textContent = id;
serverXml.getElementsByTagName('username')[0].textContent = username;
serverXml.getElementsByTagName('password')[0].textContent = password;
const serverTags = {
'username': username,
'password': password,
'privateKey': privateKey,
'passphrase': passphrase,
'filePermissions': filePermissions,
'directoryPermissions': directoryPermissions
};
for (const tag in serverTags) {
const serverTag = serverXml.getElementsByTagName(tag)[0];
const tagValue = serverTags[tag];
if (tagValue) {
serverTag.textContent = tagValue;
} else {
serverXml.documentElement.removeChild(serverTag);
}
}
const configurationTag = serverXml.getElementsByTagName('configuration')[0];
if (configurations) {
jsonToXml(templateXml, configurationTag, configurations);
} else {
if (configurationTag.childNodes.length == 0) {
serverXml.documentElement.removeChild(configurationTag);
}
}
const serversXml = templateXml.getElementsByTagName('servers')[0];
serversXml.appendChild(serverXml);
@ -74,7 +112,11 @@ function fillServers(template, templateName) {
return;
}
JSON.parse(servers).forEach((server) => fillServer(template, templateName, server.id, server.username, server.password));
JSON.parse(servers).forEach((server) =>
fillServer(template, templateName, server.id, server.username,
server.password, server.privateKey, server.passphrase,
server.filePermissions, server.directoryPermissions,
server.configuration));
}
function fillMirror(template, id, name, mirrorOf, url) {

View File

@ -38,6 +38,14 @@ const settingsPath = path.join(testHomePath, '.m2', 'settings.xml');
var consoleOutput = [];
function stringAsXml(str) {
return new DOMParser().parseFromString(str, 'text/xml');
}
function xmlAsString(xml) {
return new XMLSerializer().serializeToString(xml).replace(/^\s*$(?:\r\n?|\n)/gm, '');
}
beforeAll(() => {
if (!fs.existsSync(testHomePath)) {
fs.mkdirSync(testHomePath);
@ -51,7 +59,7 @@ beforeAll(() => {
});
beforeEach(() => {
xmlTestProfile = new DOMParser().parseFromString(`<settings>
xmlTestProfile = stringAsXml(`<settings>
<profiles>
<profile>
<id>_properties_</id>
@ -119,7 +127,7 @@ test('xml should be write', () => {
test('fillServers do nothing if no params', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
settings.fillServers(xml, 'servers');
@ -130,15 +138,13 @@ test('fillServers do nothing if no params', () => {
test('fillServers one server', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username1</username>
@ -147,18 +153,133 @@ test('fillServers one server', () => {
});
test('fillServers with username and configuration', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username</username>
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
</server></servers>`);
});
test('fillServers with username, password and configuration', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "password": "password", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username</username>
<password>password</password>
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
</server></servers>`);
});
test('fillServers with username, privateKey', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa"}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username</username>
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
</server></servers>`);
});
test('fillServers with username, privateKey, and passphrase', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa", "passphrase": "secret"}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username</username>
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
<passphrase>secret</passphrase>
</server></servers>`);
});
test('fillServers with all attributes', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "server001", "username": "my_login", "password": "my_password", "privateKey": "${user.home}/.ssh/id_dsa", "passphrase": "some_passphrase", "filePermissions": "664", "directoryPermissions": "775", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"} }]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>server001</id>
<username>my_login</username>
<password>my_password</password>
<privateKey>\${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
</server></servers>`);
});
test('fillServers with configuration', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
</server></servers>`);
});
test('fillServers with configuration subLevel', () => {
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": {"prop11": "value11", "prop12": "value12"}, "prop2": "value2"}}]';
settings.fillServers(xml, 'servers');
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<configuration><prop1><prop11>value11</prop11><prop12>value12</prop12></prop1><prop2>value2</prop2></configuration>
</server></servers>`);
});
test('fillServers two servers', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"},\
{"id": "id2", "username": "username2", "password":"password2"}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username1</username>
@ -173,7 +294,7 @@ test('fillServers two servers', () => {
test('fill servers incorrect fields', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
@ -184,22 +305,20 @@ test('fill servers incorrect fields', () => {
expect(xmlStr).toBe('<servers/>');
expect(consoleOutput).toEqual(
expect.arrayContaining([
expect.stringMatching(/::error::servers must contain id, username and password/)
expect.stringMatching(/::error::servers must contain id, and username or configuration/)
])
);
});
test('fill oracleServers', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
settings.fillServers(xml, 'oracleServers');
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username1</username>
@ -226,15 +345,13 @@ test('fill oracleServers', () => {
test('fillServers github', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_GITHUBSERVER'] = 'true';
settings.fillServerForGithub(xml);
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>github</id>
<username>\${env.GITHUB_ACTOR}</username>
@ -245,7 +362,7 @@ test('fillServers github', () => {
test('fillMirrors do nothing if no params', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
settings.fillMirrors(xml);
@ -257,7 +374,7 @@ test('fillMirrors do nothing if no params', () => {
test('fillMirrors one mirror', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name", "mirrorOf":"mirrorOf", "url":"url"}]';
@ -277,7 +394,7 @@ test('fillMirrors one mirror', () => {
test('fillMirrors two mirrors', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name1", "mirrorOf":"mirrorOf1", "url":"url1"},{"id": "id2", "name": "name2", "mirrorOf":"mirrorOf2", "url":"url2"}]';
@ -303,7 +420,7 @@ test('fillMirrors two mirrors', () => {
test('fillMirrors incorrect fields', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
process.env['INPUT_MIRRORS'] = '[{"idx": "id1"}]';
@ -323,7 +440,7 @@ test('addApacheSnapshots', () => {
process.env['INPUT_APACHESNAPSHOTS'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addApacheSnapshots(xml);
@ -365,7 +482,7 @@ test('addSonatypeSnapshots', () => {
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addSonatypeSnapshots(xml);
@ -407,7 +524,7 @@ test('addOracleRepo', () => {
process.env['INPUT_ORACLEREPO'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addOracleRepo(xml);
@ -449,7 +566,7 @@ test('fillProperties', () => {
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.fillProperties(xml);

View File

@ -3,6 +3,10 @@
<id />
<username />
<password />
<privateKey />
<passphrase />
<filePermissions />
<directoryPermissions />
<configuration>
<basicAuthScope>
<host>ANY</host>

View File

@ -3,4 +3,9 @@
<id />
<username />
<password />
<privateKey />
<passphrase />
<filePermissions />
<directoryPermissions />
<configuration />
</server>