Travis not publishing to Bintray properly - travis-ci

I'm trying to publish a java lib to Bintray, and then using that lib in another project by defining the bintray repo in gradle.
This all works when deploying to Bintray from my local machine, but when I try to get it working from Travis CI it doesn't seem to publish properly.
When I try to add a dependency in a different gradle project it cannot find the artefact, even though I know where it is and that the files have been uploaded.
I have noticed that the maven-metadata.xml doesn't seem to be created properly when I use Travis, I was under the impression that Bintray would create it for me.
.travis.yml
language: java
before_install:
- if [ -n "$TRAVIS_TAG" ]; then ./travis_prebuild.sh; fi
script:
- echo "Building artifacts"
- gradle clean build
- if [ -n "$TRAVIS_TAG" ]; then gradle createPom; fi
before_deploy:
- echo "Creating description file for bintray."
- ./travis_postbuild.sh
deploy:
provider: bintray
file: "descriptor.json"
user: $BINTRAY_USER
key: $BINTRAY_API_KEY
passphrase: $BINTRAY_GPG_PASSWORD
skip_cleanup: true
on:
tags: true
bintray-conf.json
{
"package": {
"name": "core",
"repo": "Qatja",
"subject": "wetcat",
"issue_tracker_url": "https://github.com/Qatja/core/issues",
"vcs_url": "https://github.com/Qatja/core.git",
"labels": ["MQTT", "Java"],
"public_download_numbers": true,
"public_stats": true
},
"version": {
"name": "#VERSION#",
"gpgSign": true
},
"files":
[
{"includePattern": "build/libs/(.*\.jar)", "uploadPattern": "#VERSION#/$1"},
{"includePattern": "build/(.*\.pom)", "uploadPattern": "#VERSION#/$1"}
],
"publish": true
}
Bintray repo
Github repo

I guess you need to rename the "descriptor.json" to "bintray-conf.json". The rest looks pretty much the same as my working configuration.
deploy:
provider: bintray
file: ./bintray-conf.json

Related

AWS CDK Pipeline: Assets stage fails to find buildSpec FileAsset.yaml when publishAssetsInParallel is disabled

We are trying to get our multi-stack application deployed using the cdk pipeline library.
We have recently disabled the publishAssetsInParallel flag, as with the default setting our pipeline would create >20 FileAsset objects under the Assets stage, which AWS then complains as being too many CodeBuild projects running parallel.
However, with this property now disabled, I'm getting the following error for the Assets stage:
[Container] 2022/11/14 12:04:24 Phase complete: DOWNLOAD_SOURCE State: FAILED
[Container] 2022/11/14 12:04:24 Phase context status code: YAML_FILE_ERROR Message: stat /codebuild/output/src112668013/src/buildspec-c866864112c35d54804951dbe96b99440c9b891fde-FileAsset.yaml: no such file or directory
I'm assuming this is supposed to be a build spec that is create by cdk pipeline, as we didn't need to create a build spec when things were running in parallel.
Here is the current pipeline code:
const pipeline = new CodePipeline(this, 'Pipeline', {
publishAssetsInParallel: false,
selfMutation: false,
pipelineName: fullStackName('Pipeline', app),
synth: new CodeBuildStep('SynthStep', {
input: CodePipelineSource.codeCommit(repo, repoBranchName, {codeBuildCloneOutput: true}),
buildEnvironment: {computeType: ComputeType.MEDIUM},
installCommands: [
'npm install -g yarn',
'yarn install',
'cd apps/cloud-app',
'yarn install',
'yarn global add aws-cdk'
],
commands: [
'yarn build',
'cdk synth'
],
primaryOutputDirectory: 'apps/cloud-app/cdk.out'
}
)
});
UPDATE:
I reverted the publishAssetsInParallel flag to its default setting to compare, and it seems there is a fundamental difference in the way it creates the FileAsset CodeBuild projects based on this flag. With it enabled, when I inspect the build details for one of the FileAsset projects that is created, I can see under the buildspec section it contains a concrete implementation of a build spec, eg:
{
"version": "0.2",
"phases": {
"install": {
"commands": [
"npm install -g cdk-assets#2"
]
},
"build": {
"commands": [
"cdk-assets --path \"MyStack.assets.json\" --verbose publish \"2357296280127ce793d8dbb13e6c907db22f5dcc57a173ba77fcd19a76d8f444:12345678910-eu-west-2\""
]
}
}
}
With the flag disabled, the buildspec simply contains a pointer to a buildspec file as below, which it then fails to find...
buildspec-c866864112c35d54804951dbe96b99440c9b891fde-FileAsset.yaml
Self-mutation has to be enabled - currently, asset updates mutate the pipeline.
Reference: https://github.com/aws/aws-cdk/issues/9080

Problem when generating JUnit report on Jenkins Pipeline

I'm creating a post job on Jenkins pipeline to publish test results using junit, html and cobertura. The code looks like this
post {
always {
publishTestResults(
script: this,
junit: [
active:true,
allowEmptyResults:true,
archive: true,
pattern: '**/reports/mocha.xml',
updateResults: true
],
cobertura: [
active:true,
allowEmptyResults:true,
archive:true,
pattern: '**/coverage/cobertura/cobertura-coverage.xml'
],
html: [
active:true,
allowEmptyResults:true,
archive:true,
name: 'NYC/Mocha',
path: '**/coverage/html'
],
lcov: [
active:true,
allowEmptyResults:true,
archive:true,
name: 'LCOV Coverage',
path: '**/coverage/lcov/lcov-report'
]
)
cobertura coberturaReportFile: 'coverage/cobertura/cobertura-coverage.xml'
junit 'reports/mocha.xml'
cleanWs()
// deleteDir()
script {
FAILED_STAGE = env.STAGE_NAME
}
}
}
}
The problem is when I execute the job on Jenkins I receive an error message:
find . -wholename **/reports/mocha.xml -exec touch {} ;
touch: cannot touch './reports/mocha.xml': Permission denied
I suppose the issue raised by junit command. How could I solve this problem?
P/S: Jenkins server runs on Ubuntu. I tried to modify /etc/sudoers and add this line to make Jenkins executes command as root. It still could not solve my problem.
jenkins ALL=(ALL) NOPASSWD: ALL
From checking the code at: https://github.com/SAP/jenkins-library/blob/5c13a0e2a20132336824c70b743c364bcb5341f4/vars/testsPublishResults.groovy#L136
Looks like you can avoid the issue by setting updateResults to false
If you absolutely have to update the timestamp on the result file, you'll have to open a terminal session, go to the project workspace (with jenkins user) and try to run touch ./reports/mocha.xml and then debug it from there.

Electron-builder release tries to publish to Github and complains about GH_Token

running the release script without publish option tries to publish the build to GitHub ( and fails while complaining about not being able to find GHToken! )
Error: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
Setting "publish": "never" will fail also complaining about not being able to find module electron-publisher-never!
Error: Cannot find module 'electron-publisher-never'
It all happens while the project is built but build scripts exits non-zero!
I'm using the latest version of electron-builder.
my build script:
"build": {
"appId": "eu.armand.[****]",
"copyright": "Copyright © 2017 mim_Armand",
"productName": "[****]",
"mac": {
"publish": "never",
"category": "public.app-category.[****]",
"icon": "assets/icons/mac/icon.icns"
}
Any idea what's going on or if I'm doing it wrong?!
,m
try building with
"build": "electron-builder --publish never"
to never publish.
rename your script to something else.
if the script name is release → publish is set to always
the documentation states this:
CLI --publish option values:
...
If npm script named release, — always.
Add to scripts in the development package.json:
"release": "build"
and if you run yarn release, a release will be drafted (if doesn’t
already exist) and artifacts published.
I solved it this way, because I didn't need to put it in any repository
"build":{
"appId": "XXX",
"productName": "XXX",
"directories":{
"output": "build"
},
"win":{
"target": "nsis",
"publish" : []
}
}
https://www.electron.build/configuration/publish

nyc coveralls integration not working

I try to make nyc working with coveralls following the instruction:
https://github.com/istanbuljs/nyc#integrating-with-coveralls
But I can't get it to work. Here is an example repo:
https://github.com/unional/showdown-highlightjs-extension
Travis build is successful: https://travis-ci.org/unional/showdown-highlightjs-extension
And Coveralls notice the build, but does not seem to get any data:
https://coveralls.io/github/unional/showdown-highlightjs-extension
Here is my .travis.yml:
language: node_js
notifications:
email:
on_success: never
on_failure: change
node_js:
- "stable"
before_install:
- npm install -g npm
script:
- npm run verify
after_script:
- npm install coveralls && npm run coveralls
And here is my package.json:
{
...
"scripts": {
"coverage": "npm test && nyc check-coverage --branches 85 --functions 85 --lines 85",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "npm run clean && tsc && nyc ava"
...
},
"nyc": {
"exclude": [
"scripts",
"**/*.spec.*",
"**/fixtures/**/*"
]
},
...
}
Try adding your Coveralls repo API token (which can be found on the Coveralls page for your repo) to a new COVERALLS_REPO_TOKEN encrypted environment variable on Travis, as per the (somewhat sketchy) documentation on the Coveralls site.
I found out the issue is in my tsconfig.json:
{
"compilerOptions": {
"sourceRoot": "/showdown-highlight-extension"
...
}
}
This setting gives me the correct (I assume) source map in the browser. See What's the proper way to set sourceRoot in typescript?
But is not liked by the coverage tool.
Once I remove it, it starts working.
Need to find an answer to that question.

Travis-ci and bintray deployment

I am trying to deploy my code to bintray through travis.
The deploy part of my .travis.yml
- provider: bintray
file: bintray.json
user: triberraar
key:
secure: <encrypted key>
on:
repo: triberraar/triber-todo-config-server
branch: develop
tags: true
And the bintray.json file:
{
"package": {
"name": "triber-todo-config-server",
"repo": "maven",
"vcs_url": "https://github.com/triberraar/triber-todo-config-server",
"github_use_tag_release_notes": true,
"licenses": [
"MIT"
],
"public_download_numbers": false,
"public_stats": false
},
"version": {
"name": "${project.version}",
"vcs_tag": "${project.version}",
"released": "${build.timestamp}"
},
"files": [
{
"includePattern": "triber-todo-config-server/target/(.*\.jar)",
"uploadPattern": "be/tribersoft/triber-todo-config-server/0.0.1-SNAPSHOT/$1"
},
{
"includePattern": "triber-todo-config-server/pom.xml",
"uploadPattern": "be/tribersoft/triber-todo-config-server/${project.version}/triber-todo-config-server-${project.version}.pom"
}
],
"publish": true
}
However when i the build runs on travis the deploy fails due to:
Unexpected HTTP response code 405 returned from Bintray while checking if package 'triber-todo-config-server' exists. Response message: Method Not Allowed
Anyone have experience with this?
You can see the travis log here: travis build
Any help is appreciated.

Resources