Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #85. Add support for multiple server ids. #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drewctaylor
Copy link

This PR does not fully address #85; it does not allow the user to specify a list of servers as follows:

server-list:
  - server-id: value-of-server-id-1
    server-username: SERVER_USERNAME_1
    server-password: SERVER_PASSWORD_1
  - server-id: value-of-server-id-2
    server-username: SERVER_USERNAME_2
    server-password: SERVER_PASSWORD_2

As GitHub Actions do not appear to support YAML parameters.

However, it does allow the user to specify a list of server ids as follows:

- name: Step 2 - Setup Java.
  uses: drewctaylor/setup-java@actions-setup-java-85-b
  with:
    java-version: 11
    server-id-list: require, type-encoded, github
    server-username: SERVER_USERNAME
    server-password: SERVER_PASSWORD

- name: Step 3 - Maven Deploy.
  run: mvn -B deploy
  env:
    SERVER_USERNAME: ${{ github.actor }}
    SERVER_PASSWORD: ${{ github.token }}

Which produces a settings xml as follows:

<server>
  <id>github</id>
  <username>value-of-server-username</username>
  <password>value-of-server-password</password>
</server>
<server>
  <id>require</id>
  <username>value-of-server-username</username>
  <password>value-of-server-password</password>
</server>
<server>
  <id>type-encoded</id>
  <username>value-of-server-username</username>
  <password>value-of-server-password</password>
</server>

In general, the action concatenates the value of server-id to the value of server-id-list, removes any duplicates, and produces one server entry per value.

For example,

  • if the client specifies neither server-id nor server-id-list, the action concatenates the default value of server-id (github) to the default value of server-id-list ([github]), producing ([github, github]); the action then removes the duplicate github and produces one server entry for the remaining github.
  • if the client specifies server-id but not server-id-list, the action concatenates the value of server-id (say, server) and the default value of server-id-list ([github]), producing ([github, server]); the action then produces two server entries, one for github and one for server.
  • similarly, if the client specifies server-id-list but not server-id, the action concatenates the default value of server-id (github) to the value of server-id-list (say, [server1, server2]), producing ([github, server1, server2]); the action then produces three server entries, one for github, one for server1, and one for server2.

A successful run of this PR is here:

https://github.com/drewctaylor/constrain/actions/runs/191542087/workflow

@GavinF17
Copy link

I would be interested in seeing this merged, or better yet a full fix for #85

Out of interest, is there any reason you chose to switch to server-id-list over the full fix of server-list?

@drewctaylor
Copy link
Author

drewctaylor commented Oct 27, 2020

@GavinF17 - I switched from server-list to server-id-list because it doesn't appear to be possible to receive values (such as server-list) as anything but strings. If it were possible to receive the value of server-list as, say, a JSON structure, I would have implemented the full fix.

@rachit-rw
Copy link

@thboop @chrispat @tbroyer Can we think about merging this. We need this feature for our org and it would be very useful for many people.

@sbesson sbesson mentioned this pull request Dec 10, 2020
@IvanZosimov IvanZosimov linked an issue Jul 3, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for multiple servers.
4 participants