Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Support to run Server under Windows has been dismissed since version 7.14+
### Run inside docker

1. run `docker pull nolddor/atlassian-sdk:17-jdk`
2. run `docker run -it -p 7990:7990 -p 7999:7999 nolddor/atlassian-sdk:17-jdk`
2. run `docker run -it -p 7990:7990 -p 7999:7999 -v %USER%\.m2:/root/.m2 nolddor/atlassian-sdk:17-jdk`
3. Inside the container:
- install git with `apk add git`
- run `/opt/atlassian-plugin-sdk/bin/atlas-run-standalone --product bitbucket`
- run `/opt/atlassian-plugin-sdk/bin/atlas-run-standalone --product bitbucket --version 9.5.2`
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration;
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint;
import com.cloudbees.jenkins.plugins.bitbucket.impl.avatars.BitbucketTeamAvatarMetadataAction;
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils;
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketCredentials;
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.MirrorListSupplier;
import com.cloudbees.jenkins.plugins.bitbucket.server.BitbucketServerWebhookImplementation;
Expand Down Expand Up @@ -579,7 +580,7 @@
if (showAvatar()) {
avatarURL = team.getAvatar();
}
teamURL = team.getLink("html");
teamURL = BitbucketApiUtils.isCloud(client) ? team.getLink("html") : team.getLink("self");

Check warning on line 583 in src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMNavigator.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 583 is only partially covered, one branch is missing
teamDisplayName = StringUtils.defaultIfBlank(team.getDisplayName(), team.getName());
if (StringUtils.isNotBlank(teamURL)) {
if (team instanceof BitbucketCloudWorkspace wks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Map<String, List<BitbucketHref>> getLinks() {

@Override
public String getAvatar() {
return getLink("self") + "/avatar.png";
String baseURL = getLink("self").replace("/projects", "/rest/api/1.0/projects");
return baseURL + "/avatar.png";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketBuildStatus;
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketBuildStatus.Status;
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRepository;
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketTeam;
import com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketIntegrationClientFactory;
import com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketIntegrationClientFactory.BitbucketServerIntegrationClient;
import com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketIntegrationClientFactory.IRequestAudit;
Expand Down Expand Up @@ -237,6 +238,16 @@ void verify_getTag_request_URL() throws Exception {
.hasPath("/rest/api/1.0/projects/amuniz/repos/test-repos/tags/v0.0.0"));
}

@Issue("JENKINS-75440")
@Test
void verify_avatar_URL() throws Exception {
String serverURL = "http://localhost:7990/bitbucket";
BitbucketServerAPIClient client = (BitbucketServerAPIClient) BitbucketIntegrationClientFactory.getClient(serverURL, "amuniz", "test-repos");

BitbucketTeam project = client.getTeam();
assertThat(project.getAvatar()).isEqualTo("http://localhost:7990/bitbucket/rest/api/1.0/projects/amuniz/avatar.png");
}

@Issue("JENKINS-75119")
@Test
void verify_HttpHost_built_when_server_has_context_root() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"key": "amuniz",
"id": 1,
"name": "Project 1",
"description": "Default configuration project #1",
"public": false,
"type": "NORMAL",
"links": {
"self": [
{
"href": "http://localhost:7990/bitbucket/projects/amuniz"
}
]
}
}
Loading