Resolving snapshot artifact dependencies via gradle

 I am attempting to resolve artifact dependencies via the REST API, though my ultimate purpose is to set up an artifact dependency in a Gradle build.

For some reason, I simply cannot find artifacts via a build configuration, though I can do it via a build number. For example:

http --json --body --auth x:y GET https://myserver/httpAuth/app/rest/builds/id:1702 | jq '{buildTypeId: .buildTypeId, buildType: .buildType}'

{
"buildTypeId": "LibProto_GradleBuildTopics",
"buildType": {
"id": "LibProto_GradleBuildTopics",
"name": "Gradle Build - Topics",
"projectName": "Lib Proto",
"projectId": "LibProto",
"href": "/httpAuth/app/rest/buildTypes/id:LibProto_GradleBuildTopics",
"webUrl": "https://myserver/viewType.html?buildTypeId=LibProto_GradleBuildTopics"
},
"branchName": "rg/TestBranch",
"status": "SUCCESS",
"state": "finished"
}

Ok, but now:

http --auth x:y GET 'https://myserver/httpAuth/app/rest/builds/buildType:(id:LibProto_GradleBuildTopics),branch:($base64:cmcvVGVzdEJyYW5jaAo=)/artifacts'
Responding with error, status code: 404 (Not Found). 
Details: jetbrains.buildServer.server.rest.errors.NotFoundException: Nothing is found by locator 'buildType:(id:LibProto_GradleBuildTopics),branch:rg/TestBranch
,count:1,state:finished,personal:false,canceled:false,failedToStart:false'.
Could not find the entity requested. Check the reference is correct and the user has permissions to access the entity.

NOTE I've used the base64 encoding for the branch name just to avoid any issues related to https://youtrack.jetbrains.com/issue/TW-19360#, however its the same problem with the `/` in the branch name URL escaped.

Why can't I locate the artifacts this way? And if this is the correct behavior how do I configure Gradle to find them?

Version: TeamCity Professional 2018.1.3 (build 58658)

0
2 comments

Only builds have artifacts, build configurations don't, so you cannot access the "artifacts of a build configuration", because that's not a concept that makes sense. A build configuration is the definition of how a build is performed, while the builds themselves generate the artifacts.

 

If you want to reference the artifacts of the last build of a configuration, you still need to access it via builds, here are some examples on accessing artifacts:

https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-BuildArtifacts

https://confluence.jetbrains.com/display/TCD18/Patterns+For+Accessing+Build+Artifacts

 

Also, you can set dependencies using TeamCity as an Ivy repository: https://confluence.jetbrains.com/display/TCD18/Artifact+Dependencies#ArtifactDependencies-xmlConfiguringArtifactDependenciesUsingAntBuildScript

The examples up there are for ant but gradle can also access them.

0

Perhaps I used the wrong wording "build configuration", but as you can see from my example REST calls, I am actually attempting to resolve the artifacts by "build", not "build configuration", and it isn't working:

http --auth x:y GET 'https://myserver/httpAuth/app/rest/builds/buildType:(id:LibProto_GradleBuildTopics),branch:($base64:cmcvVGVzdEJyYW5jaAo=)/artifacts

I am trying to locate the latest build by build type and branch. I've tried lots of variations of this with no luck.

0

Please sign in to leave a comment.