How do I upload a file with metadata to jfrog artifactory with curl - rest

I upload a file like this:
curl -u ${CREDS} --upload-file ${file} ${url}
Is there a way to add a body or headers that will set some metadata for the file? Like build number.

You can actually deploy artifacts with properties to Artifactory OSS using matrix parameters, for example:
curl -uadmin:password -T file.tar "http://localhost:8081/artifactory/generic-local/file.tar;foo=bar;"
And get the artifact properties using REST API, for example:
curl -uadmin:password "http://localhost:8081/artifactory/api/storage/generic-local/file.tar?properties"
Viewing properties from the UI and other features are limited to the Pro edition.

Seems this is a pro feature. Documentation: Set Item Properties
PUT /api/storage/{repoKey}{itemPath}?properties=p1=v1[,v2][|p2=v3][&recursive=1]
Not helping me :-/

Related

How to use registry scopes with Yarn 2.0 and Azure Artifacts

I would like to use https://registry.yarnpkg.com as my package registry for all packages except 1 that I am hosting on Azure Artifacts.
I have the following .yarnrc.yml file
yarnPath: ".yarn/releases/yarn-berry.js"
npmScopese:
my-scope:
npmRegistryServer: 'https://pkgs.dev.azure.com/<my-org>/_packaging/<my-feed>/npm'/registry/'
npmAlwaysAuth: true
npmAuthIdent: 'my-auth-stuff'
then in the console I run
yarn add #my-scope/my-package#1.0.0
I get the following error
#my-scope/my-package#npm:1.0.0: Response code 404 (Not Found)
The following returns a 200 response
curl GET 'https://pkgs.dev.azure.com/<my-org>/_packaging/<my-feed>/npm/registry/<my-package>' --header 'Authorization: <my-auth>'
Not sure if am missing something. Any help would be appreciated.
For anybody who comes across this
I solved it by changed my package name to #my-scope/my-package in artifacts.

OpenShift RestAPI Equivalent of oc tag

What is the OpenShift RestAPI equivalent of oc tag some.docker.regiery some-image-tag:latest?
From the help page:
Tag existing images into image streams
The tag command allows you to take an existing tag or image from an image stream, or a Docker image pull spec, and set
it as the most recent image for a tag in 1 or more other image streams. It is similar to the 'docker tag' command, but
it operates on image streams instead.
Pass the --insecure flag if your external registry does not have a valid HTTPS certificate, or is only served over HTTP.
Pass --scheduled to have the server regularly check the tag for updates and import the latest version (which can then
trigger builds and deployments). Note that --scheduled is only allowed for Docker images.
Usage:
oc tag [--source=SOURCETYPE] SOURCE DEST [DEST ...] [flags]
Answering my own question for future reference:
Run the command as you would on the cli but add --loglevel=8. (i.e. oc tag some.docker.regiery some-image-tag:latest --loglevel=8).
Then you can see exactly what API call was used and exactly what params were used and you can replicate that! :)

IBM Urbancode Deploy get current component versions deployed to an environment

I am trying get current component version of component that is deployed to an environment in UCD via REST API/Curl command . Below is sample code which returns all versions of that component which is available in UCD. It does not give me latest version of that component deployed to an environment. Any help / suggestion?
curl -k -u userName:passw0rd \
-H "Accept: application/json" \
"https://myserver.example.com:8443/rest/deploy/environment/{environmentID}/versions/{componentID}"
uDeploy has a bunch of api endpoints that are undocumented. I could not figure out how to do this from their docs but inspecting the uDeploy web interface many times can help you find the endpoint to hit.
https://{your-udeploy-url}/rest/deploy/environment/{your-environment-id}/latestDesiredInventory/true?rowsPerPage=10000&pageNumber=1&orderField=name&sortType=desc
This will return json that you can parse to get the versions deployed in an environment.

Rest API to get list of artifacts from Nexus OSS 3.x Repository

I have created a raw repository in Nexus 3.x and I'm able to upload artifacts to the same. Now I want get the list of all artifacts residing inside that repo using Rest API.
Any help is appreciated.
in the current Nexus3.14.0-04 the REST API has become final (no longer "beta") and the curl you need is:
curl -X GET "http://localhost:8081/service/rest/v1/components?repository=central" -H "accept: application/json"
this will return each "component" (group, name, version) with all its assets = each individual file (pom, sha1, md5, jar) who constitue the component
The result is a JSON string.
If instead you want to perform a COMPONENTS search - based on a groupId, artifactId - you can use this curl:
curl -X GET "http://localhost:8081/service/rest/v1/search?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension=jar" -H "accept: application/json"
this returns COMPONENTS with child ASSETS.
The variant to retrieve only the ASSETS, without grouping them by COMPONENT, is GET /service/rest/v1/search/assets?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension=jar
You can use the - still in beta - new API for Nexus. It's available by default on the version 3.3.0 and more: http://localhost:8082/swagger-ui/
Basically, you retrieve the json output from this URL: http://localhost:8082/service/siesta/rest/beta/assets?repositoryId=YOURREPO
Only 10 records will be displayed at a time and you will have to use the continuationToken provided to request the next 10 records for your repository by calling: http://localhost:8082/service/siesta/rest/beta/assets?continuationToken=46525652a978be9a87aa345bdb627d12&repositoryId=YOURREPO
More information here: http://blog.sonatype.com/nexus-repository-new-beta-rest-api-for-content

How to upload file to Confluence on scheduled basis?

We use confluence as project(s) wiki etc.
There are plenty of useful docs, tables, etc. But many of them can be actual one day and not actual next day.
So, it will be just perfect to use/(implement?) feature, which will re-upload needed file(s) in confluence by schedule. Files will be (for example) get from git repository.
So, my question is: Does confluence have such feature ((re)uploading files by schedule)? If not, is there any way to implement this, except of new plugin writing?
If you have a CI server (like Jenkins), you can create a nightly job to upload the new version of the docs using the Confluence REST API.
Extract from the doc:
A simple example to upload a file called "myfile.txt" to the Attachment with id "456" in a container with id "123", with the comment updated, and minorEdit set to true:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=#myfile.txt" -F "minorEdit=true" -F "comment=This
is my updated File" http://myhost/rest/api/content/123/child/attachment/456/data