Is there an API in stash for uploading a plugin via command line?

Does anyone have an example for doing this? It looks like we are going to have several customized plugins, so I'd like to automate the procedure for building and updating them on our production server.

thanks,

Garret

1 answer

1 accepted

1 vote
Accepted answer

Hi Garret,

Is this what you had in mind?

https://developer.atlassian.com/display/DOCS/atlas-install-plugin

Cheers,

Charles

Hi Charles,

This looks exactly like what I'm looking for. I'm having problems getting it to work though. Here's a snippet. Note that our server is hosted at https://stash.pv.com and we only have HTTPS on port 443 exposed.

$ atlas-install-plugin -e --http-port 443 --context-path / --username pickgr --password ***** --server stash.pv.com --plugin-key com.atlassian.stash.stash-enforce-message-hook-plugin

Executing: /opt/atlassian-plugin-sdk/apache-maven/bin/mvn com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.1.6:install -e -Dhttp.port='443' -Dcontext.path='/' -Dusername='pickgr' -Dpassword='*****' -Dserver='stash.pv.com' -Datlassian.plugin.key='com.atlassian.stash.stash-enforce-message-hook-plugin'

Warning: JAVA_HOME environment variable is not set.

+ Error stacktraces are turned on.

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Building Enforce Commit Message Hook

[INFO] task-segment: [com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.1.6:install]

[INFO] ------------------------------------------------------------------------

[INFO] [amps-dispatcher:install]

[INFO] [stash:install {execution: virtual-execution}]

[INFO] [atlassian-pdk:install]

[INFO] Install Plugin: Couldn't get the token from upm. Headers. Falling back to legacy upload.

log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).

log4j:WARN Please initialize the log4j system properly.

[INFO] Install Plugin: Uploading 'stash-enforce-message-hook-plugin-1.1.jar' to server: http://stash.pv.com:443/

org.apache.commons.httpclient.HttpRecoverableException: org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the status line from the response: unable to find line starting with "HTTP"

at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1962)

Hi Garret,

I can't be sure, but I wonder whether it's trying to connect via http over 443, rather than actually using https. What happens when you try:

atlas-install-plugin -e --username pickgr --password ***** --server https://stash.pv.com  --plugin-key com.atlassian.stash.stash-enforce-message-hook-plugin--http-port 443 --context-path /

Otherwise this might be relevant.

Charles

Thank you Charles! Modifying the server option to use the full URL did the trick.

[INFO] Install Plugin: Uploading 'stash-enforce-message-hook-plugin-1.1.jar' to server: https://stash.pv.com:443/
[INFO] Install Plugin: Completed successfully[200].
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

251 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you