jfrog / teamcity-artifactory-plugin

TeamCity plugin that enables traceable build artifacts with Artifactory
https://www.jfrog.com/confluence/display/JFROG/TeamCity+Artifactory+Plug-in
Apache License 2.0
42 stars 47 forks source link

Adding support of Connections to set up Artifactory URL #115

Closed Linfar closed 1 year ago

Linfar commented 2 years ago

Motivation: Currently, the only way to configure Artifactory is to add a URL on the global administration level. This could be done by users having Change Server Settings only. This permission is prohibited for users of TeamCity Cloud. My PR introduces a new way to configure the Artifactory URL – through the native Connections feature. This allows a user with Edit Project permission to configure the URL to be used in builds. Configuring one on the Root project level is practically the same as configuring it on the global administration level.

Implemented:

  1. UI and backend to configure Artifactory Connections
  2. API to lookup URLs by project feature ID. This required refactoring 3. since project feature ID is a String.
  3. Refactored URL IDs to be a String instead of a long.
  4. Implemented showing Connections in Runner extensions, trigger, etc
  5. Use the new API in Runner extensions, trigger, etc

Tested:

  1. Plugin loading and unloading in runtime
  2. Adding/modifying/deleting new Connections and old global-scoped URLs – for both "Use Single Resolver Credentials" and "Use Different Resolver Credentials" modes
  3. Test Connection works properly
  4. Secrets are stored in the project XML file in a secure manner and are properly unscrambled by the TeamCity Core when needed
  5. Adding Artifactory Build Trigger works
  6. Adding Runner extensions for CMD, Maven, Ant, NAnt, Grade, MSBuild, FXCop
  7. Build with a CMD + Artifactory starts. Unfortunately, I got a cryptic 405 error without any details. So I wasn't able to check a file will be actually uploaded.

Trade-offs:

  1. Validating parameters for Runner extensions and trigger is not possible for Connections since corresponding methods don't receive build configuration in the context
  2. Same for the trigger description – it always says just "Triggers builds following changes of watched items in a configured Artifactory server." without the URL
image

Btw: I tried to follow the https://github.com/jfrog/teamcity-artifactory-plugin/blob/9abe319ab2ad4068b662ea331f3bc62cfea43ba5/CONTRIBUTING.md, but the link says "This agreement is no longer accessible for signature. If you feel you have reached this page in error please contact the person who directed you to this page to sign the agreement."

github-actions[bot] commented 2 years ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Linfar commented 2 years ago

I have read the CLA Document and I hereby sign the CLA

Linfar commented 2 years ago

Any comments to the PR?

talarian1 commented 2 years ago

Hi @Linfar, Thanks for your contribution and effort! Sorry for our late response. We will do our best to review this PR soon.

Linfar commented 2 years ago

Any news? May be I can help somehow?

Linfar commented 1 year ago

Friendly ping

eyalbe4 commented 1 year ago

Thanks a lot of this PR @Linfar! It has been pending for too long sorry about that... Let us look into this soon.

eyalbe4 commented 1 year ago

Thanks so much for this awesome contribution and my applogies for the long overdue review. Will you be able to also suggest here changes to the plugin's documentation following your changes, such as updates screenshots?

Linfar commented 1 year ago

Sure. I'd make 'Configuring System-wide Artifactory Servers' a deprecated option, or even hide it. Instead of this block (or before it), I suggest to add a similar one covering the Connections option:

Configuring Artifactory Servers

To make Artifactory servers available to project runner configurations, they must be defined in the Connections section for a Project where they should be accessible. To enable global access to an Artifactory server, it can be added to the Root project.

Select Add Connection, choose the JFrog Artifactory in the Connection type and fill in the URL of the Artifactory server.

Deployer credentials can be set at the global level for all builds, but they can also be overridden and set at a project build level.

Specifying a username and password for the resolver repository is optional. It is only used when querying Artifactory's REST API for a list of configured repositories and then only if the target instance does not allow anonymous access.

image
Linfar commented 1 year ago

Hi! Any news? I had to resolve a merge conflict.

Linfar commented 1 year ago

@yahavi Thank you for the review! I've applied all suggestions

Linfar commented 1 year ago

🎉