How to delete build artifacts when a build result is deleted
I'm looking for some advice or best practice for my problem. I've not found a way to accomplish what I want without writing code, so I wanted to check if there was a way before going down that path.
My build produces binary output. I copy this output to a file-server at the end of the build and use the artifact link task to make a link to it in the build result.
All is well at this point.
Now at some point in the future, the build result will get pruned, assuming that deletion of the result is allowed. I would like to also delete the binary artifacts on the file server when the build result is deleted, in order to conserve space. This deletion doesn't need to be synchronous or anything like that, I'd just like it to happen periodically, maybe once or twice a day.
First I looked for a Ant task to tell me if a build result was deleted, but I couldn't find one. I thought that I could have a process running that tries to update all the builds results that I have artifacts for, and if it fails decide that the build result is gone. But this isn't good b/c I'm always updating the build results and a failure for another reason(like network) might make me think that I should delete the artifacts.
At this point, I'm thinking that I'd need to write a plain java program in order to find out if the build result is gone.
Any advice is greatly appreciated.
Thanks,
James
My build produces binary output. I copy this output to a file-server at the end of the build and use the artifact link task to make a link to it in the build result.
All is well at this point.
Now at some point in the future, the build result will get pruned, assuming that deletion of the result is allowed. I would like to also delete the binary artifacts on the file server when the build result is deleted, in order to conserve space. This deletion doesn't need to be synchronous or anything like that, I'd just like it to happen periodically, maybe once or twice a day.
First I looked for a Ant task to tell me if a build result was deleted, but I couldn't find one. I thought that I could have a process running that tries to update all the builds results that I have artifacts for, and if it fails decide that the build result is gone. But this isn't good b/c I'm always updating the build results and a failure for another reason(like network) might make me think that I should delete the artifacts.
At this point, I'm thinking that I'd need to write a plain java program in order to find out if the build result is gone.
Any advice is greatly appreciated.
Thanks,
James
5 answers
James,
There is nothing that ships out of the box that will clean these up for you.
We had a similar problem for all our builds. I wrote an ant task for releng
that cleans them up. It's invoked as part of a clean up build definition
that is automatically run on a continuous interval like any other build.
There are more details about the task and mechanism used in workitem 46698.
Don Weinand
Jazz Foundation Team
"james.branigan" <jb> wrote in message
news:guiipp$5a4$1@localhost.localdomain...
There is nothing that ships out of the box that will clean these up for you.
We had a similar problem for all our builds. I wrote an ant task for releng
that cleans them up. It's invoked as part of a clean up build definition
that is automatically run on a continuous interval like any other build.
There are more details about the task and mechanism used in workitem 46698.
Don Weinand
Jazz Foundation Team
"james.branigan" <jb> wrote in message
news:guiipp$5a4$1@localhost.localdomain...
I'm looking for some advice or best practice for my problem. I've not
found a way to accomplish what I want without writing code, so I
wanted to check if there was a way before going down that path.
My build produces binary output. I copy this output to a file-server
at the end of the build and use the artifact link task to make a link
to it in the build result.
All is well at this point.
Now at some point in the future, the build result will get pruned,
assuming that deletion of the result is allowed. I would like to
also delete the binary artifacts on the file server when the build
result is deleted, in order to conserve space. This deletion doesn't
need to be synchronous or anything like that, I'd just like it to
happen periodically, maybe once or twice a day.
First I looked for a Ant task to tell me if a build result was
deleted, but I couldn't find one. I thought that I could have a
process running that tries to update all the builds results that I
have artifacts for, and if it fails decide that the build result is
gone. But this isn't good b/c I'm always updating the build results
and a failure for another reason(like network) might make me think
that I should delete the artifacts.
At this point, I'm thinking that I'd need to write a plain java
program in order to find out if the build result is gone.
Any advice is greatly appreciated.
Thanks,
James
Don,
Thanks for the reply. That's what I was thinking was the case. One thing that I've wondered is if it would be possible for the Build Result Pruning Task to produce a feed that identifies the builds that its pruned.
Then I could just write a small script that grabs the feed and removes any associated files from the file server.
Thanks,
James
Thanks for the reply. That's what I was thinking was the case. One thing that I've wondered is if it would be possible for the Build Result Pruning Task to produce a feed that identifies the builds that its pruned.
Then I could just write a small script that grabs the feed and removes any associated files from the file server.
Thanks,
James
James,
There is nothing that ships out of the box that will clean these up for you.
We had a similar problem for all our builds. I wrote an ant task for releng
that cleans them up. It's invoked as part of a clean up build definition
that is automatically run on a continuous interval like any other build.
There are more details about the task and mechanism used in workitem 46698.
Don Weinand
Jazz Foundation Team
"james.branigan" <jb> wrote in message
news:guiipp$5a4$1@localhost.localdomain...
I'm looking for some advice or best practice for my problem. I've not
found a way to accomplish what I want without writing code, so I
wanted to check if there was a way before going down that path.
My build produces binary output. I copy this output to a file-server
at the end of the build and use the artifact link task to make a link
to it in the build result.
All is well at this point.
Now at some point in the future, the build result will get pruned,
assuming that deletion of the result is allowed. I would like to
also delete the binary artifacts on the file server when the build
result is deleted, in order to conserve space. This deletion doesn't
need to be synchronous or anything like that, I'd just like it to
happen periodically, maybe once or twice a day.
First I looked for a Ant task to tell me if a build result was
deleted, but I couldn't find one. I thought that I could have a
process running that tries to update all the builds results that I
have artifacts for, and if it fails decide that the build result is
gone. But this isn't good b/c I'm always updating the build results
and a failure for another reason(like network) might make me think
that I should delete the artifacts.
At this point, I'm thinking that I'd need to write a plain java
program in order to find out if the build result is gone.
Any advice is greatly appreciated.
Thanks,
James
Hi James,
Providing a feed for deleted builds (whether deleted by the pruner or manually) is a good idea. I've filed 85166: Provide a feed for deleted builds.
Another option is to use the REST interface to query all builds for a given definition, then go and clean up files for any builds not in the list.
e.g. try: https://jazz.net/jazz/resource/virtual/build/results?definition=continuous.buildsystem.jazz&profile=REDUCED&_mediaType=text/json&_prettyPrint=true
The last two query args are just for debugging, making it easier to read.
Normally you'd specify the media type in the Accept header of the HTTP GET.
Providing a feed for deleted builds (whether deleted by the pruner or manually) is a good idea. I've filed 85166: Provide a feed for deleted builds.
Another option is to use the REST interface to query all builds for a given definition, then go and clean up files for any builds not in the list.
e.g. try: https://jazz.net/jazz/resource/virtual/build/results?definition=continuous.buildsystem.jazz&profile=REDUCED&_mediaType=text/json&_prettyPrint=true
The last two query args are just for debugging, making it easier to read.
Normally you'd specify the media type in the Accept header of the HTTP GET.
I downloaded the PruneBuildResults task and the GetBuildResultLabels task, and started off with GetBuildResultLabels as practice before using Prune... task. I am getting the following error when executed inside Jazz Build Egine. In short, error message is "java.lang.IllegalAccessError: tried to access method com.ibm.team.build.ant.task.AbstractTeamBuildTask.getTeamBuildClient()". My only thought is that JazzBldUser which is my standalone Jazz user for builds only needs to have a higher access permission, but that doesn't make much sense since it is the same user id that created all of the Build Results to begin with. I even upgraded to a Jazz 3.0 build toolkit even though am running against a 2.0 server just to see if there were any bug fixes that might help. Please help.
checkEnvForJazz:
Using repositoryAddress = https://myserver:9443/jazz/
Using userId = JazzBldUser
getCurrentBuildResults:
Class java.util.HashMap loaded from parent loader (parentFirst)
Class java.util.Properties loaded from parent loader (parentFirst)
Class java.io.File loaded from parent loader (parentFirst)
Class java.lang.String loaded from parent loader (parentFirst)
Class com.ibm.team.build.ant.task.AbstractTeamBuildTask$FileAntAttribute loaded from parent loader (parentFirst)
Class java.util.List loaded from parent loader (parentFirst)
Class com.ibm.team.build.ant.task.AbstractTeamBuildTask$AntAttribute loaded from parent loader (parentFirst)
Finding class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
Loaded from C:\RTC-BuildSystemToolkit-3.0M4-Win\jazz\buildsystem\buildengine\eclipse\build\com.panasonic.pasa.pmt.tool\jbe\lib\GetBuildResultLabels.jar com/ibm/team/build/ant/task/GetBuildResultLabelsTask$1.class
Class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1 loaded from ant loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class com.ibm.team.repository.common.TeamRepositoryException loaded from parent loader (parentFirst)
Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
Class java.util.StringTokenizer loaded from parent loader (parentFirst)
BUILD FAILED
C:\RTC-BuildSystemToolkit-3.0M4-Win\jazz\buildsystem\buildengine\eclipse\build\com.panasonic.pasa.pmt.tool\jbe\build.xml:31: java.lang.IllegalAccessError: tried to access method com.ibm.team.build.ant.task.AbstractTeamBuildTask.getTeamBuildClient()Lcom/ibm/team/build/client/ITeamBuildClient; from class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.IllegalAccessError: tried to access method com.ibm.team.build.ant.task.AbstractTeamBuildTask.getTeamBuildClient()Lcom/ibm/team/build/client/ITeamBuildClient; from class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
at com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1.validate(GetBuildResultLabelsTask.java:97)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.validateAttribute(AbstractTeamBuildTask.java:560)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.validateAntTaskAttributes(AbstractTeamBuildTask.java:532)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.execute(AbstractTeamBuildTask.java:432)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
checkEnvForJazz:
Using repositoryAddress = https://myserver:9443/jazz/
Using userId = JazzBldUser
getCurrentBuildResults:
Class java.util.HashMap loaded from parent loader (parentFirst)
Class java.util.Properties loaded from parent loader (parentFirst)
Class java.io.File loaded from parent loader (parentFirst)
Class java.lang.String loaded from parent loader (parentFirst)
Class com.ibm.team.build.ant.task.AbstractTeamBuildTask$FileAntAttribute loaded from parent loader (parentFirst)
Class java.util.List loaded from parent loader (parentFirst)
Class com.ibm.team.build.ant.task.AbstractTeamBuildTask$AntAttribute loaded from parent loader (parentFirst)
Finding class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
Loaded from C:\RTC-BuildSystemToolkit-3.0M4-Win\jazz\buildsystem\buildengine\eclipse\build\com.panasonic.pasa.pmt.tool\jbe\lib\GetBuildResultLabels.jar com/ibm/team/build/ant/task/GetBuildResultLabelsTask$1.class
Class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1 loaded from ant loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class com.ibm.team.repository.common.TeamRepositoryException loaded from parent loader (parentFirst)
Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
Class java.util.StringTokenizer loaded from parent loader (parentFirst)
BUILD FAILED
C:\RTC-BuildSystemToolkit-3.0M4-Win\jazz\buildsystem\buildengine\eclipse\build\com.panasonic.pasa.pmt.tool\jbe\build.xml:31: java.lang.IllegalAccessError: tried to access method com.ibm.team.build.ant.task.AbstractTeamBuildTask.getTeamBuildClient()Lcom/ibm/team/build/client/ITeamBuildClient; from class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.IllegalAccessError: tried to access method com.ibm.team.build.ant.task.AbstractTeamBuildTask.getTeamBuildClient()Lcom/ibm/team/build/client/ITeamBuildClient; from class com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1
at com.ibm.team.build.ant.task.GetBuildResultLabelsTask$1.validate(GetBuildResultLabelsTask.java:97)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.validateAttribute(AbstractTeamBuildTask.java:560)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.validateAntTaskAttributes(AbstractTeamBuildTask.java:532)
at com.ibm.team.build.ant.task.AbstractTeamBuildTask.execute(AbstractTeamBuildTask.java:432)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
James,
There is nothing that ships out of the box that will clean these up for you.
We had a similar problem for all our builds. I wrote an ant task for releng
that cleans them up. It's invoked as part of a clean up build definition
that is automatically run on a continuous interval like any other build.
There are more details about the task and mechanism used in workitem 46698.
Don Weinand
Jazz Foundation Team
"james.branigan" <jb> wrote in message
news:guiipp$5a4$1@localhost.localdomain...
I'm looking for some advice or best practice for my problem. I've not
found a way to accomplish what I want without writing code, so I
wanted to check if there was a way before going down that path.
My build produces binary output. I copy this output to a file-server
at the end of the build and use the artifact link task to make a link
to it in the build result.
All is well at this point.
Now at some point in the future, the build result will get pruned,
assuming that deletion of the result is allowed. I would like to
also delete the binary artifacts on the file server when the build
result is deleted, in order to conserve space. This deletion doesn't
need to be synchronous or anything like that, I'd just like it to
happen periodically, maybe once or twice a day.
First I looked for a Ant task to tell me if a build result was
deleted, but I couldn't find one. I thought that I could have a
process running that tries to update all the builds results that I
have artifacts for, and if it fails decide that the build result is
gone. But this isn't good b/c I'm always updating the build results
and a failure for another reason(like network) might make me think
that I should delete the artifacts.
At this point, I'm thinking that I'd need to write a plain java
program in order to find out if the build result is gone.
Any advice is greatly appreciated.
Thanks,
James
AbstractTeamBuildTask.getTeamBuildClient() is a protected method, meaning that it can only be called by that class or a subclass (or another class in the same package). Assuming GetBuildResultLabelsTask does extend AbstractTeamBuildTask, and that it was properly compiled, this points to a class loader configuration problem whereby GetBuildResultLabelsTask is getting loaded by a different class loader than AbstractTeamBuildTask.
How is GetBuildResultLabelsTask packaged (relative to the other build toolkit tasks), and how are you configuring Ant and the taskdefs to find the classes?
Also note that to talk to a 2.x server, you need to use the 2.x client library.
How is GetBuildResultLabelsTask packaged (relative to the other build toolkit tasks), and how are you configuring Ant and the taskdefs to find the classes?
Also note that to talk to a 2.x server, you need to use the 2.x client library.