Publishing zip from TeamCity to Artifactory using FileSpec, does it even work? - artifactory

I've tried everything I can think of to get this to work but in every attempt NO errors are returned (the logs say everything succeeded and one file was uploaded) but in artifactory, although the build info is published, nothing appears in the target repo.
I tried using powershell and the rest api to publish, but that just gave me (502 gateway error). Again, no matter what combination of values I used, always this useless error.
I have been forced to revert to using the 'legacy patterns' because this is the only thing that works AT ALL.
The pattern I am using is:
%ProjectPublishDir%\**\*.* => path/to/my/APP/%Major-Version%.%Minor-Version%/%ArtifactNamePrefix%/%ArtifactFileName%
Where all these values are parameters defined in TeamCity. This works like a charm.
However, if I add this at the end of my powershell to create the artifact:
#Write-Host "##teamcity[publishArtifacts '%ProjectPublishDir%\**\*.* => %ArtifactsDir%\%ArtifactFileName%']"
Then I replace legacy patterns with file specs for my powershell step, then I use this file spec:
{
"files": [
{
"pattern": "%ArtifactsDir%\%ArtifactFileName%",
"target": "my_repo_name/path/to/my/APP/%Major-Version%.%Minor-Version%/%ArtifactNamePrefix%/",
"props": "type=zip;status=ready"
}
]
}
The log says the artifact was generated (which I verified on the build agent is true) and that it was sent to Artifactory successfully, but when I check in artifactory, the build info is there but the artifact is missing.
Every example everywhere I can find is too simple and from the basic examples out there, what I have above should work. So what are the docs missing that I am not doing/doing incorrectly?

Related

Correctly packaging CSS files for deployment to Azure CDN as part of Azure DevOps extension

I'm developing an Azure DevOps extension, which displays the a summary of work items for the current Sprint for printing.
I am failing to get static CSS files to publish correctly.
I have the following configured in the manifest.json in the files section:
{
"path": "css/print.css",
"contentType": "text/css",
"addressable": true
},
{
"path": "css/screen.css",
"contentType": "text/css",
"addressable": true
},
The structure of the project is:
css/screen.css
css/print.css
board-cards.html
vss-extension.json
Reading this documentation: https://learn.microsoft.com/en-us/azure/devops/extend/develop/static-content indicates that the static content should be published to: https://publisher.gallery.vsassets.io.
When debugging - the following two 404's appear in the network log:
https://publisher.gallerycdn.vsassets.io/css/print.css
https://publisher.gallerycdn.vsassets.io/css/screen.css
(I've changed my publisher account name to the generic "publisher" string for ease)
I've opened the .vsix in 7zip, and the folder and css files are in the package. After many hours of Googling and hunting through stackoverflow, I'm unable to find a solution.
I tried changing the entry in "files" to be simply:
{
"path": "css",
"addressable": true
}
However this had no effect.
Is anyone able to advise me on what I'm missing or doing wrong?
Through further debugging I've found that the files do exist under a URL specific the the version published.
e.g. https://publisher.gallerycdn.vsassets.io/extensions/publisher/board-cards/1.0.64/1545996658773/css/screen.css
And then I checked the mark-up, and I realised I'd made an absolute reference to the CSS files. E.g.
/css/screen.css
By removing the first slash - this made the reference to the CSS file relative, which solved the problem.
HTML 101.

How to use complex-number of kairosdb from REST

I am checking if I can use kairosdb for my project. I was checking out the REST api's and I have a use case where I need to save both my device state and status (state tells if device is on or off and status tells if my device is occupied or empty)
kairosdb version: 1.1.1
I came across this link https://kairosdb.github.io/docs/build/html/restapi/AddDataPoints.html
but when I try to post data from REST client I am getting the error 400 BAD Request error. The error is
{"errors":["Unregistered data point type 'complex-number'"]}
My request I am posting is ,
{
"name": "device_data",
"type": "complex-number",
"datapoints": [
[
1470897496,
{
"state": 0,
"status": "empty"
}
]
],
"tags": {
"device_id": "abc123"
}
}
In tried doing the same in Java as specified in https://kairosdb.github.io/docs/build/html/kairosdevelopment/CustomData.html
I get the same error i
Please let me know how to use complex-numbers or custom data types from REST
Recently, I figured out how to use this.
Using the example from the official document of KairosDB.
create 2 files called ComplexDataPoint.java and ComplexDataPointFactory.java and then paste the code provided by the tutorial on the doc: https://kairosdb.github.io/docs/build/html/kairosdevelopment/CustomData.html#example-for-creating-custom-types
download the KairosDB source, then extract the .zip file.
paste the 2 files in /KAIROSDB_DOWNLOADED_SOURCE/src/main/java/org/kairosdb/core/datapoints/
configure the CoreModule.java at /KAIROSDB_DOWNLOADED_SOURCE/src/main/java/org/kairosdb/core/, add the following line in the function protected void configure():
bind(ComplexDataPointFactory.class).in(Singleton.class);
open terminal, cd to KAIROSDB_DOWNLOADED_SOURCE/, then follow the instruction in the file how_to_build.txt
when complete, it will create a folder called build, the compiled kairosdb jar file is located in KAIROSDB_DOWNLOADED_SOURCE/build/jar
in your kairosdb installation folder, backup the kairosdb-X.X.X.jar file in YOUR_KAIROSDB_INSTALLATION/lib
mv kairosdb-X.X.X.jar kairosdb-X.X.X.jar.backup
mv the newly compiled jar file to YOUR_KAIROSDB_INSTALLATION/lib
modify the configuration file by adding the following line:
kairosdb.datapoints.factory.complex=org.kairosdb.core.datapoints.ComplexDataPointFactory
restart your kairosdb
For your query, since the registered name is kairosdb.datapoints.factory.complex, replace complex-number with complex in your query string.
Hope this will help you! I am now having a problem to plot the complex data. I am still figuring out...

retrieve artifact with maven timestamp from artifactory

Is there a way to retrieve an artifact with the maven timestamp as it was originally uploaded by maven?
from jenkins logs:
Uploading: http://artifactory.foo/artifactory/libs-snapshot-local/com/foo/foo-web-service/1.16.0-SNAPSHOT/foo-web-service-1.16.0-20160504.182015-2.tar.gz
Results from artifactory REST api:
$ curl -X GET 'http://artifactory.foo/artifactory/api/search/gavc?g=com.foo&a=foo-web-service&v=1.16.0-SNAPSHOT&c=*&repos=libs-snapshot-local'
{
"results" : [ {
"uri" : "http://artifactory.foo/artifactory/api/storage/libs-snapshot-local/com/foo/foo-web-service/1.16.0-SNAPSHOT/foo-web-service-1.16.0-SNAPSHOT-sources.jar"
}, {
"uri" : "http://artifactory.foo/artifactory/api/storage/libs-snapshot-local/com/foo/foo-web-service/1.16.0-SNAPSHOT/foo-web-service-1.16.0-SNAPSHOT.pom"
}, {
"uri" : "http://artifactory.foo/artifactory/api/storage/libs-snapshot-local/com/foo/foo-web-service/1.16.0-SNAPSHOT/foo-web-service-1.16.0-SNAPSHOT.tar.gz"
}, {
"uri" : "http://artifactory.foo/artifactory/api/storage/libs-snapshot-local/com/foo/foo-web-service/1.16.0-SNAPSHOT/foo-web-service-1.16.0-SNAPSHOT.war"
} ]
}
I'd like to get the the same name as it was uploaded to via a wget or equivalent...
What I want to acheive:
jenkins uploads foo-web-service-1.16.0-20160504.182015-2.tar.gz to libs-snapshot-local
query REST api to get latest artifact link that includes the timestamps in the name with parameters a=foo-web-service&version=1.16.0&...
wget $artifact_link_with_timestamp
What I currently acheive that does not satisfy my need:
jenkins uploads foo-web-service-1.16.0-20160504.182015-2.tar.gz to libs-snapshot-local
query REST api via gavc search with parameters a=foo-web-service&version=1.16.0&...
wget $artifact_link
Conclusion as stated in the accepted answer, the problem was in the artifactory config itself. To achieve what I wanted, I needed the snapshots to be unique.
As long as your repository is configured to use unique snapshots (or to use client snapshot policy and you use Maven 3 and up), you can always use the Maven timestamp as a version. Replacing it with -SNAPSHOT is a "runtime" trick to make the resolution easier.
If your repository is configured to use non-unique snapshots, the files are actually stored with -SNAPSHOT instead of version and override previous snapshots (don't do that).

Issues with Artifactory after upgrade to 3.4

I followed the upgrade notes to upgrade from Artifactory 2.6.6 to 3.4.2, I reimported the artifacts but after that, artifact resolution often fails with 404.
Even previously deployed artifacts can not be resolved. The deploying Jenkins job runs fine, but when I open the URL from the log, I get that message:
{
"errors" : [ {
"status" : 404,
"message" : "Artifact not found: my/group/myapp/0.9.13-SNAPSHOT/myapp-0.9.13-SNAPSHOT.pom"
} ]
}
I also tried to export/import the whole system after upgrade, but nothing changed.
Does anyone know how to fix this?
I found out that the issue is related to the unique snapshot behaviour of Maven 3. In fact, there is no myapp-0.9.13-SNAPSHOT.pom, but one with a timestamp. The Rest API does not cover that and not all Jenkins plugins have support for that.

gclient runhooks fails

I'm trying to build Chrome under windows, I got the chromium trunk using tortoiseSVN and I believe I got everything correctly, but when I run "gclient runhooks" I get the error: "Error: client not configured; see 'gclient config'".
Now, I know that it happens because I don't have a ".gclient" file on the same directory, but I couldn't find .gclient file anywhere in the project. I tried to create .gclient file myself but it says there's a solution missing.
I'm probably missing something, can anyone help me with that? I'm pretty stuck!
Thanks!
gclient config http://src.chromium.org/svn/trunk/src
gclient runhooks
Or make a .gclient file with the following content, which skips the huge amount of webkit layout tests
solutions = [
{ "name" : "src",
"url" : "http://src.chromium.org/svn/trunk/src",
"deps_file" : "DEPS",
"managed" : True,
"custom_deps" : {
"src/third_party/WebKit/LayoutTests": None,
"src/chrome_frame/tools/test/reference_build/chrome": None,
"src/chrome/tools/test/reference_build/chrome_mac": None,
"src/chrome/tools/test/reference_build/chrome_win": None,
"src/chrome/tools/test/reference_build/chrome_linux": None,
},
"safesync_url": "",
},
]
The above solution is out-dated. Running with the SVN repository results in:
Error:
The chromium code repository has migrated completely to git.
Your SVN-based checkout is now obsolete; you need to create a brand-new
git checkout by following these instructions:
http://www.chromium.org/developers/how-tos/get-the-code
Now you need to create a .gclient file like this
solutions = [
{
"managed": False,
"name": "src",
"url": "https://chromium.googlesource.com/chromium/src.git",
"custom_deps": {},
"deps_file": ".DEPS.git",
"safesync_url": "",
},
]
and do:
gclient sync
Chromium does not include a preconfigured .gclient file for the Chromium build and does not automatically handle Visual Studio versioning changes and default Deploy toolkit hints. After you have successfully downloaded the deploy tools and the chromium source code as provided at chromium.org perform the following in the root directory where your deploy_tools and src code is located.
NOTE : If you receive errors try to start a new command prompt session and try again.
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION = 2015
gclient config https://chromium.googlesource.com/chromium/src.git
gclient sync
gclient runhooks
cd src
ninja -C out\Debug chrome
The build will take some time gclient runhooks should generate the build folder.

Resources