Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 86 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,23 @@
</scm>

<properties>
<bamboo.version>9.6.0</bamboo.version>
<bamboo.version>10.2.0</bamboo.version>
<bamboo.data.version>${bamboo.version}</bamboo.data.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- This plugin key is to be used as a unique ID of the plugin incl.
version and not as a key regarding the Atlassian plugin descriptor -->
<plugin.key>${project.groupId}.${project.artifactId}-${project.version}</plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!--Skip integration tests unless explicitly requested with -DskipITs=false-->
<skipITs>true</skipITs>
<buildinfo.version>2.41.14</buildinfo.version>
<buildinfo.version>2.41.22</buildinfo.version>
<buildinfo.gradle.version>4.33.13</buildinfo.gradle.version>
<amps.version>8.11.4</amps.version>
<amps.version>9.1.4</amps.version>
<atlassian.spring.scanner.version>5.0.2</atlassian.spring.scanner.version>
</properties>

<profiles>
Expand Down Expand Up @@ -113,6 +114,7 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -170,6 +172,10 @@
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -209,6 +215,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -221,6 +231,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -241,6 +255,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -269,18 +291,40 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jfrog.artifactory.client</groupId>
<artifactId>artifactory-java-client-api</artifactId>
<version>2.17.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.14.1</version>
<version>2.17.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.1</version>
<version>2.17.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.17.2</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand All @@ -306,6 +350,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -344,6 +392,10 @@
<groupId>com.tek42.perforce</groupId>
<artifactId>p4java</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand All @@ -357,6 +409,10 @@
<groupId>com.tek42.perforce</groupId>
<artifactId>p4java</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -445,6 +501,12 @@
<artifactId>atlassian-plugins-osgi</artifactId>
<version>7.1.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -455,9 +517,9 @@
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>1.2.13</version>
<scope>runtime</scope>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>

</dependencies>
Expand Down Expand Up @@ -493,7 +555,6 @@
<configuration>
<productVersion>${bamboo.version}</productVersion>
<productDataVersion>${bamboo.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<productDataPath>${basedir}/src/test/resources/bamboo-home.zip</productDataPath>
<jvmArgs>-Xms512m -Xmx1024m -server
-Datlassian.bamboo.build.disable=true -Datlassian.bamboo.branch.detection.disable=true
Expand All @@ -502,7 +563,19 @@
<systemPropertyVariables>the active branch
<GIT_BRANCH>${git.branch}</GIT_BRANCH>
</systemPropertyVariables>
<extractDependencies>false</extractDependencies>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Bundle-SymbolicName>${atlassian.plugin.key}</Bundle-SymbolicName>
<Spring-Context>*</Spring-Context>
<Export-Package>
</Export-Package>
<Import-Packages>
!com.opensymphony.*,
!org.objectweb.asm.*,
*;resolution:="optional",
</Import-Packages>
<skipManifestValidation>true</skipManifestValidation>
</instructions>
<products>
<product>
<id>bamboo</id>
Expand Down Expand Up @@ -536,7 +609,7 @@
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.13</version>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -688,7 +761,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.jfrog.bamboo.admin;

import com.atlassian.plugin.spring.scanner.annotation.imports.BambooImport;
import com.atlassian.sal.api.user.UserManager;
import com.atlassian.sal.api.user.UserProfile;
import org.apache.commons.httpclient.HttpStatus;
Expand All @@ -26,6 +27,7 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -44,9 +46,10 @@ public class ArtifactoryConfigServlet extends HttpServlet {

private static final Logger log = LogManager.getLogger(ArtifactoryConfigServlet.class);
private ServerConfigManager serverConfigManager;
private final UserManager userManager;
private UserManager userManager;

public ArtifactoryConfigServlet(ServerConfigManager serverConfigManager, UserManager userManager) {
@Inject
public ArtifactoryConfigServlet(@BambooImport UserManager userManager, ServerConfigManager serverConfigManager) {
this.userManager = userManager;
this.serverConfigManager = serverConfigManager;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.jfrog.build.extractor.clientConfiguration.ArtifactoryManagerBuilder;
import org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager;

import javax.inject.Inject;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand All @@ -48,15 +49,17 @@ public class ArtifactoryServerConfigAction extends BambooActionSupport implement
private String password;
private int timeout;
private String isSendTest;
@Inject
private ServerConfigManager serverConfigManager;


private transient ServerConfigManager serverConfigManager;

public ArtifactoryServerConfigAction(ServerConfigManager serverConfigManager) {
this.serverConfigManager = serverConfigManager;
public ArtifactoryServerConfigAction() {
mode = "add";
timeout = 300;
}
}

public void setServerConfigManager(ServerConfigManager serverConfigManager) {
this.serverConfigManager = serverConfigManager;
}

@Override
public void validate() {
Expand All @@ -80,6 +83,10 @@ public String doAdd() throws Exception {
return INPUT;
}

public String create() throws Exception {
return doCreate();
}

public String doCreate() throws Exception {
if (isTesting()) {
testConnection();
Expand All @@ -91,15 +98,22 @@ public String doCreate() throws Exception {
return SUCCESS;
}

public String doEdit() throws Exception {
public String edit() throws IllegalArgumentException {
return doEdit();
}

public String doEdit() throws IllegalArgumentException {
ServerConfig serverConfig = serverConfigManager.getServerConfigById(serverId);
if (serverConfig == null) {
throw new IllegalArgumentException("Could not find Artifactory server configuration by the ID " + serverId);
}
updateFieldsFromServerConfig(serverConfig);
return INPUT;
}
}

public String update() throws Exception {
return doUpdate();
}

public String doUpdate() throws Exception {
// Decrypt password from UI, if encrypted.
Expand All @@ -114,6 +128,10 @@ public String doUpdate() throws Exception {
return SUCCESS;
}

public String delete() throws Exception {
return doDelete();
}

public String doDelete() throws Exception {
serverConfigManager.deleteServerConfiguration(getServerId());
return SUCCESS;
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/org/jfrog/bamboo/admin/BuildServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.logging.log4j.Logger;
import org.jfrog.bamboo.util.ConstantValues;

import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -43,11 +44,16 @@
public class BuildServlet extends HttpServlet {

private static final Logger log = LogManager.getLogger(BuildServlet.class);
@Inject
private PlanManager planManager;
private final UserManager userManager;
@Inject
private UserManager userManager;

public BuildServlet(UserManager userManager) {
planManager = (PlanManager) ContainerManager.getComponent("planManager");
public void setPlanManager(PlanManager planManager) {
this.planManager = planManager;
}

public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.atlassian.bamboo.ww2.actions.admin.user.AbstractEntityPagerSupport;
import com.atlassian.bamboo.ww2.aware.permissions.GlobalAdminSecurityAware;

import javax.inject.Inject;
import java.util.List;

/**
Expand All @@ -29,11 +30,12 @@
*/
public class ExistingArtifactoryServerAction extends AbstractEntityPagerSupport implements GlobalAdminSecurityAware {

private ServerConfigManager serverConfigManager;
@Inject
private ServerConfigManager serverConfigManager;

public ExistingArtifactoryServerAction(ServerConfigManager serverConfigManager) {
this.serverConfigManager = serverConfigManager;
}
public void setServerConfigManager(ServerConfigManager serverConfigManager) {
this.serverConfigManager = serverConfigManager;
}

public String doBrowse() throws Exception {
return super.execute();
Expand Down
Loading
Loading