Suddenly, the built artifacts of my project are not published properly in the artifacts tab. From one commit to the next, they stopped being collected - only my JUnit test result XML files are getting collected (from the $CIRCLE_TEST_RESULTS directory)
This is what I tried:
I SSHed into my build and verified the files are there.
I copied all files from the directories they were in into the $CIRCLE_ARTIFACTS directory.
I specified the artifact paths in the circle.yml as
Relative to the build directory (/build/libs/*.jar)
Relative to the home (~/Kayon/build/libs/*.jar, where Kayon is the name of the project)
This is a minimal circle.yml file representing my setup:
general:
artifacts:
- "build/libs/*.jar"
All of the above does not cause the jar files in the specified directory being collected. The âcollecting artifactsâ step just wonât go over them, as if they do not exist.
This issue came out of nowhere - the build when it stopped working properly did not change anything significant on the circle.yml - I even tried reverting the circle.yml to what it looked like before the commit where it started.
It does not look like there are any issues when transferring the files to Amazon Web Services. The process starts off wanting to collect 14 artifacts (from the test result directory) - and it finished having collected those correctly. The gist below is a sample of what I am getting.
(Sorry - apparently the link counting feature counts in the parsed markdown - which generates 3 links (one to gist.github.com, the title is linked and âshow untruncated fileâ at the bottom) in one embedded gist âwidgetâ and I can only post up to 2 links - just copy it into your browser address bar)
Imagine you had not setup the circle.yml file to collect artifacts at all, thatâs how it is behaving. You never see any notice about something failing, never do you see your directories specified mentioned anywhere. Not that thatâs an issue, normally they would not get logged as well, but there are no (additionally to normal) traces to find in the logs is what I wanted to say.
So apparently, I was doing the copying wrongly. I am now using gradle to copy the artifacts to $CIRCLE_ARTIFACTS and they are getting collected like expected. It just wonât collect from the directories specified in circle.yml. This is the gradle task I am using:
task copyCIArtifacts << { // because why not, doubleshift and nested copy (intuitive, isn't it?)
copy {
from(file('build/libs/').listFiles() + file('build/distributions/').listFiles())
into System.getenv('CIRCLE_ARTIFACTS')
}
}
Somebody decent at bash could probably come up with something better than this, but I am only good in JVM languages generally, thatâs why I did it with gradle.
Where did you call this task? I looked at the sample circle.yml for an âafter the buildâ hook but couldnât find one⌠Would you mind sharing your circle.yml?
task copyCIArtifacts << { // because why not, doubleshift and nested copy (intuitive, isn't it?)
if (System.getenv("CIRCLECI").equals("true")) {
copy {
from(file('build/libs/').listFiles() + file('build/distributions/').listFiles())
into System.getenv('CIRCLE_ARTIFACTS')
}
}
}
Basically, gradle is a build system for the Java Virtual Machine (Java, Groovy, Scala, Kotlin, etcâŚ). I just added a new task to the set of existing ones (like compileJava, classes, jar, test, etcâŚ) that does this utility, since I am mostly experienced in Java-like languages. The job this accomplishes could also easily done with bash. It just copies my artifacts to the $CIRCLE_ARTIFACTS directory.