Artifacts are not deployed with SSH Upload in TeamCity - teamcity

So I have one job that produces artifacts, and another job with dependency on those artifacts from first job. I tried to use SSH Upload, however I inserted into field "Paths to sources" *.deb => /tmp
In order to download Debian packages from previous job to tmp, but it does not download anything
Logs from my job to deploy:
[21:54:49] Collecting changes in 1 VCS root
[21:54:54] The build is removed from the queue to be prepared for the start
[21:54:54] Starting the build on the agent "agent3"
[21:54:55] Updating tools for build
[21:54:55] Clearing temporary directory: /opt/buildagent/temp/buildTmp
[21:54:55] Publishing internal artifacts
[21:54:55] Full checkout enforced. Reason: [Checkout directory is empty or doesn't exist]
[21:54:55] Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[21:54:55] Checkout directory: /opt/buildagent/work/245575fe8c01221b
[21:54:55] Resolving artifact dependencies
[21:54:55] [Resolving artifact dependencies] Destination directory [/tmp] cleaned
[21:54:55] [Resolving artifact dependencies] Downloading files from <Xenoss.test / Build job of deb/rpm packages, build #0.0.2 [id 15836]> for pattern [*.deb => /tmp
*.rpm => /tmp]
[21:54:55] [Resolving artifact dependencies] 2 files retrieved
[21:54:55] Step 1/1: Upload deb/rpm package to destination server (SSH Upload) (1s)
[21:54:55] [Step 1/1] Permanently added '139.59.178.103' (EDDSA) to the list of known hosts.
[21:54:56] [Step 1/1] Starting upload via SCP to host [139.59.178.103:22]
[21:54:56] [Step 1/1] Uploaded [0] files for [] pattern
[21:54:56] Publishing internal artifacts
[21:54:56] [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[21:54:56] [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisherImpl]
[21:54:56] Build finished

You should to fix your artifact dependency rule. In your setup:
TeamCity downloads artifacts to /tmp directory
TeamCity tries to upload *.deb from directory folder which is not equal to /tmp
So correct artfact dependency rule should look like this:
*.deb => .

Related

NoSuchFileException: plugin-descriptor.properties for custom plugin

I'm creating a Java plugin for Elasticsearch version 7.17.6.
The zip file is built using:
gradle distZip
When the generated zip file is unzipped all files, including plugin-descriptor.properties, are in the root folder.
This command is run to install the plugin:
elasticsearch-plugin install file:///plugins/elasticsearch_plugin-1.0.zip -v
However the plugin installation fails with:
sh-5.0# elasticsearch-plugin install file:/plugins/elasticsearch_plugin-1.0.zip -v
-> Installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Downloading file:/plugins/elasticsearch_plugin-1.0.zip
Retrieving zip from file:/plugins/elasticsearch_plugin-1.0.zip
[=================================================] 100%??
-> Failed installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolling back file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolled back file:/plugins/elasticsearch_plugin-1.0.zip
Exception in thread "main" java.nio.file.NoSuchFileException: /usr/share/elasticsearch/plugins/.installing-4054247711532660111/plugin-descriptor.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
at java.base/java.nio.file.Files.newInputStream(Files.java:160)
at org.elasticsearch.plugins.PluginDescriptor.readFromProperties(PluginDescriptor.java:183)
at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:827)
at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887)
at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)
What can be the cause of the issue? plugin-descriptor.properties exists in the zip file in the root folder but when extracted as part of the install process it is not finding it.
plugin-descriptor.properties contains:
type=isolated
description=My custom plugin for Elasticsearch
version=1.0.0
name=myplugin
classname=com.example.MyPlugin
java.version=1.8
elasticsearch.version=7.17.6
*** Update ***
I found a temporary workaround by copying the zip file to the docker container, extracting it and then moving the extracted folder to
/usr/share/elasticsearch/plugins
and restarting the container. The plugin is then loaded and works as expected.

Publish build artifact from folder without including root folder

On Azure DevOps, I have some files I want to publish:
$(Build.ArtifactStagingDirectory)/dist/app/index.html
$(Build.ArtifactStagingDirectory)/dist/app/bundle.js
I want to publish them into an artifact app.zip which contains, at the root level:
- index.html
- bundle.js
However when I use the "Publish Build Artifacts" tasks with the path set to $(Build.ArtifactStagingDirectory)/dist/app, I get the following contents in app.zip:
app/
index.html
bundle.js
I tried setting the publish path to:
$(Build.ArtifactStagingDirectory)/dist/app/**
$(Build.ArtifactStagingDirectory)/dist/app/*
$(Build.ArtifactStagingDirectory)/dist/app/*.*
but all of these fail the build with the error Not found PathtoPublish
if I understand your question , you trying to publish 2 files as your atficats.
as you are already ready with app.zip
may be first retry copying it to another staging folder and then try to copy it from there. or see the below pattern to traverse through the directories.
then you need
- task: PublishBuildArtifacts
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/**/*
artifactName: MyBuildOutputs
Cheers.
AJ

Error while bulding maven project - TeamCity

Everytime I try to build a Maven project hosted on a gitlab server with TeamCity, I get an error from the buildAgent. Both TeamCity and GitLab are on the same server.
It seems that the agent can't connect to gitlab but it does, because when I have to specify the pom.xml path in the build configuration section, I can navigate through the repository folders(http://prntscr.com/i8pyjf).
I have already tried different solutions:
I added both the root ssh and the ssh key of the ser that is running teamcity, both of them seem to work cause the test connection was succesful(http://prntscr.com/i8q0jf);
I added teamcity.git.use.native.ssh true in the buildAgent conf and the error log changed a little (the error is still the same but I get less lines)
I added teamcity.git.use.native.ssh true as a configuration parameter -> http://prntscr.com/i8pnqp (not sure if I did it right)
I tried adding the runAs plugin to force the user agent to use root
TeamCity version -> TeamCity Professional 2017.2.2 (build 50909)
Here's the error log:
[22:03:51] The build is removed from the queue to be prepared for the start
[22:03:51] Collecting changes in 1 VCS root
[22:03:51] [Collecting changes in 1 VCS root] VCS Root details
[22:03:51] [VCS Root details] "git#151.80.136.106:Developer/BanlogBridge.git" {instance id=11, parent internal id=1, parent id=Ban_Git15180136106DeveloperBanlogBridgeGit, description: "git#151.80.136.106:Developer/BanlogBridge.git#master"}
[22:03:51] [Collecting changes in 1 VCS root] Compute revision for 'git#151.80.136.106:Developer/BanlogBridge.git'
[22:03:51] [Compute revision for 'git#151.80.136.106:Developer/BanlogBridge.git'] Upper limit revision: 0d41a12c788798152c7da9327ef63b759f7d5b4c
[22:03:51] [Compute revision for 'git#151.80.136.106:Developer/BanlogBridge.git'] Cannot find modification with revision 0d41a12c788798152c7da9327ef63b759f7d5b4c
[22:03:51] [Compute revision for 'git#151.80.136.106:Developer/BanlogBridge.git'] No modification from VCS root is attached to build configuration, use upper limit revision
[22:03:51] [Compute revision for 'git#151.80.136.106:Developer/BanlogBridge.git'] Computed revision: 0d41a12c788798152c7da9327ef63b759f7d5b4c
[22:03:51] Starting the build on the agent Default Agent
[22:03:52] Clearing temporary directory: /usr/local/teamcity/buildAgent/temp/buildTmp
[22:03:52] Publishing internal artifacts
[22:03:52] [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[22:03:52] [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[22:03:52] Using vcs information from agent file: db80d9c7294729d5.xml
[22:03:52] Checkout directory: /usr/local/teamcity/buildAgent/work/db80d9c7294729d5
[22:03:52] Updating sources: auto checkout (on agent)
[22:03:52] [Updating sources] Will use agent side checkout
[22:03:52] [Updating sources] VCS Root: git#151.80.136.106:Developer/BanlogBridge.git
[22:03:52] [VCS Root: git#151.80.136.106:Developer/BanlogBridge.git] revision: 0d41a12c788798152c7da9327ef63b759f7d5b4c
[22:03:52] [VCS Root: git#151.80.136.106:Developer/BanlogBridge.git] Git version: 2.7.4.0
[22:03:52] [VCS Root: git#151.80.136.106:Developer/BanlogBridge.git] Will use native ssh (teamcity.git.use.native.ssh=true)
[22:03:52] [VCS Root: git#151.80.136.106:Developer/BanlogBridge.git] Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)
[22:03:52] [Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)] /usr/bin/git config core.sparseCheckout true
[22:03:52] [Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)] /usr/bin/git show-ref
[22:03:52] [Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)] /usr/bin/git show-ref refs/remotes/origin/master
[22:03:52] [Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)] Commit '0d41a12c788798152c7da9327ef63b759f7d5b4c' is not found in local clone. Running 'git fetch'...
[22:03:52] [Update checkout directory (/usr/local/teamcity/buildAgent/work/db80d9c7294729d5)] /usr/bin/git fetch --progress origin +refs/heads/master:refs/remotes/origin/master
[22:03:52] [Updating sources] Failed to perform checkout on agent: '/usr/bin/git fetch --progress origin +refs/heads/master:refs/remotes/origin/master' command failed.
exit code: 128
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[22:03:52] Publishing internal artifacts
[22:03:52] [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[22:03:52] [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[22:03:52] Build failed to start. Artifacts will not be published for this build
[22:03:52] Build finished
Thank you for your help!
It happens because known hosts database on the TeamCity agent machine doesn't contain the fingerprint of the Gitlab server. You can add it by running some command via ssh, e.g. git ls-remote <your repository url>, and agree to add the fingerprint if it's correct.
Actually TeamCity checks out code with known hosts database check disabled. Please check if you have anything related to Gitlab in the .ssh/config on the TeamCity agent machine.

How to upload an artifact to Jfrog Artifactory using Jfrog CLI?

I'm trying to upload an artifact from Bamboo CI using CLI for Jfrog Artifactory
I need to upload .p2 plugins and I have two options:
Upload the .zip and deploy it as Bundle Artifact
Upload the uncompressed folder with all subfolders and data.
I'm trying to upload the uncompressed folder with all the subfolders and data using this command:
jfrog rt upload --include-dirs=true ${bamboo.build.working.directory}/unzip/${bamboo.public.name-update-site}/* p2-release-local/${bamboo.public.name-update-site}/
But the problem is that the subfolders are empty.
Also I try to use this command:
jfrog rt upload --flat=false ${bamboo.build.working.directory}/unzip/${bamboo.public.name-update-site}/* p2-release-local/${bamboo.public.name-update-site}/
This command upload all the subfolders with all the data but the path isn't correct because is:
/name-update-site/datos/agents-home/xml-data/build-dir/PREDEL-RELPLU-JOB1/unzip/name-update-site
The content of the variable ${bamboo.build.working.directory} is
/datos/agents-home/xml-data/build-dir/PREDEL-RELPLU-JOB1/
EDITED: Log info:
INFO: Listing Bamboo directory
prueba-update-site.zip
unzip
INFO: Listing files from unzip folder
prueba-update-site
INFO: Listing files from custom folder
artifacts.jar
content.jar
features
plugins
site.xml
uninstall_fortify_plugins.cmd
Any help?
Thanks.
Solved!
The solution is:
Unzip the artifact .zip archive
Upload with this command:
jfrog rt upload --flat=false "${bamboo.public.name-update-site}/*" p2-release-local/
Thanks.

Publish Maven artifacts on FTP with Hudson FTP Publisher Plugin

I'm building a number of artefacts (zip files for different environments: test, dev) using the maven-assembly-plugin using a specialized Maven profile. These artefacts I want to copy/collect on on a FTP server keeping the version (01.07.10.16.Wed-1626) as a folder, so I need to copy from test/build/01.07.10.16.Wed-1626/ to ftp://my-ftp-server:21/projects/myserver-1.7/01.07.10.16.Wed-1626/
The layout for the Maven output is this:
target/
build/
01.07.10.16.Wed-1626/
my-server-01.07.10.16.Wed-1626-dev.zip
my-server-01.07.10.16.Wed-1626-test.zip
For copying the artefacts I'm using FTP Publisher Plugin but it seams I miss something since that even the build is OK and the artefacts are build without problem but the job is finishing without copying the artefacts, and in the console there is no log info about copying the artefacts
My FTP publisher config (FTP repository hosts) is:
Hostname: my-ftp-server
Port: 21
Timeout: 10000
Root Repository Path: projects
User Name: my-user
Password: my-pass
My Hudson job FTP publisher config (Publish artifacts to FTP) is:
FTP site: my-ftp-server
Files to upload
Source: target/build/**
Destination: myserver-1.7
Additional issues:
1: There is any log (hou can the FTP Uploader log can be enabled) to check if there are any FTP copy errors ?
2: There is any problem with the file pattern (source) or with the dest ?
3: I can also use maven-antrun-plugin for upload but since this post-buil task should be used just by Hudson, should be defined outside of the POM.
Have you looked at Hudson's Artifactory Plugin ? http://wiki.hudson-ci.org/display/HUDSON/Artifactory+Plugin

Resources