Travis-ci and bintray deployment - travis-ci

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.

Related

AWS CDK Code Pipeline Development - Typescript Error TS2307

Problem:
Whilst developing my Code Pipeline, I am experiencing a new error I did not receive with cdk deploy --all in the CLI. All stacks deploy successfully.
Code Build Error Message:
src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts(3,75): error TS2307: Cannot find module '#aws-sdk/client-sfn' or its corresponding type declarations.
Lambda Function Import Statements:
import { SFNClient, SendTaskSuccessCommand, SendTaskFailureCommand } from "#aws-sdk/client-sfn";
Lambda Function Package.json:
{
"name": "intomagentoqueueconsumer",
"module": "commonjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#aws-sdk/client-sfn": "^3.226.0",
"axios": "^1.2.1",
"axios-retry": "^3.3.1"
}
}
Lambda Function CDK Definition:
this.intoMagentoQueueConsumer = new NodejsFunction(this, `intoMagentoQueueConsumer`, {
runtime: Runtime.NODEJS_16_X,
handler: "handler",
depsLockFilePath: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/package-lock.json"),
entry: join(__dirname, "../../src/lambda-handlers/queue-consumers/intoMagentoQueueConsumer/index.ts"),
bundling: { minify: false, nodeModules: ["#aws-sdk/client-sfn", "axios", "axios-retry"], externalModules: ["aws-sdk", "crypto-js"] },
});
Porting the solution from the comments for posterity:
Do you have mismatched npm CLI versions? AWS CodeBuild tsc error TS2307: Cannot find module.
I understand your project has multiple package.json. In your pipeline ShellStep commands, make sure you are running npm ci for each one to install the dependencies.

Bitbucket cloud webhook Does not trigger Jenkins Build: No branch information

I am trying to integrate Bitbucket cloud with Jenkins. I have Bitbucket plugin installed in Jenkins. I have configured the webhook in bitbucket cloud for the repository with url http://<jenkins_url>/bitbucket-hook/
I set up Jenkins job (I tried both pipeline and multibranch pipeline). In the Pipeline I have selected "Build when a change is pushed to BitBucket" and In the pipeline I have stages to fetch from bitbucket and build. I have specified to get from branch develop.
case 1: After I set this up I pushed some code to my repository(branch develop). I expected the pipeline to be triggered(since I have a webhook setup) nothing happens.
I triggered the build manually. It builds the project. Now if I push something to the repository, the build is getting triggered. Question here is Why didn't it triggered the first time and works only after a manual build.
case 2: I setup another pipeline. Exactly as the one before. But with branch as master. I tried to follow the same step(triggered manually first). Now when i pushed something to master. Nothing happens(even after manual build).
When I analysed the jenkins log. I see that there is a notification from bitbucket cloud as soon as something is pushed. But the json which is sent doesn't has branch information. May be that is the reason Jenkins is not able to decide which pipeline to trigger when there are multiple pipelines talking to same repository. Is my assumption correct? Is it a bug in Bitbucket cloud
The json recieved from bitbucket cloud looks like this
{
"scm": "git",
"website": null,
"name": "myproject-api",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/my-team/myproject-api"
},
"html": {
"href": "https://bitbucket.org/my-team/myproject-api"
},
"avatar": {
"href": "https://bytebucket.org/ravatar/%7Bb07e7384-c622-44b1-8c5f-96104d36cfae%7D?ts=java"
}
},
"project": {
"key": "PB",
"type": "project",
"uuid": "{d9c0caa2-7d43-4a0e-8459-2c7c8c2bd287}",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/teams/my-team/projects/PB"
},
"html": {
"href": "https://bitbucket.org/account/user/my-team/projects/PB"
},
"avatar": {
"href": "https://bitbucket.org/account/user/my-team/projects/PB/avatar/32"
}
},
"name": "MyProject Backend"
},
"full_name": "my-team/myproject-api",
"owner": {
"username": "my-team",
"display_name": "my-team",
"type": "team",
"uuid": "{848f7612-ffbc-4dfb-8f67-ade4b604761c}",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/teams/%7B848f7612-ffbc-4dfb-8f67-ade4b604761c%7D"
},
"html": {
"href": "https://bitbucket.org/%7B848f7612-ffbc-4dfb-8f67-ade4b604761c%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/my-team/avatar/"
}
}
},
"type": "repository",
"is_private": true,
"uuid": "{b07e7384-c622-44b1-8c5f-96104d36cfae}"
}
Does anyone have any idea how to successfully get webhooks working with bitbucket cloud and Jenkins. Most of the questions on SO regarding this talks about Bitbucket server and not Bitbucket cloud.
I had similar issues solved by doing following steps:
Uninstall old 'Bitbucket' plugin
Removed webhook at bitbucket that was set as:
http://<Jenkins URL>/bitbucket-hook/
Install 'Bitbucket Branch Source Plugin'
Set new webhook at bitbucket repository as:
http://<Jenkins URL>/bitbucket-scmsource-hook/notify/
Cheers!!!

How to Publish to a Private GitHub with Electron-builder NSIS and AppImage?

Electron-builder Version: 20.38.5
Target: Windows ia32 and x64
I'm trying to push the project to GitHub releases in a private repository.
The main target is Win ia32 and x64.
I set the token in the console by:
set GH_TOKEN=<blabla>
And at the package.json file:
"publish": {
"provider": "github",
"repo": "electron-todo-tasks",
"owner": "AndreD23",
"host": "github.com",
"protocol": "https",
"releaseType": "draft",
"token": "<blablabla>",
"private": true
}
I'm the only one who will have access to the project, so updating the token in the file apparently not a problem.
But, when I run:
electron-builder --x64 --ia32 --publish always
It shows me the error:
Error: Cannot cleanup:
Error #1 --------------------------------------------------------------------------------
HttpError: 404 Not Found
"method: undefined url: https://github.com/repos/AndreD23/electron-todo-tasks/releases\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"
I'll attach the whole error.
2019-03-22T13_04_27_992Z-debug.log
electron publish error.txt
I tried to change the option always to onTag or onTagOrDraft and change releaseType to release.
I tried to manually create a draft on GitHub first, doesn't work.
I tried to make the repository public for tests, not working too.
I tried to regenerate the token twice and updated the envs, console and package.json, doesn't work.
Is there any configuration that I've missed? What I have to do for Electron to publish to GitHub?
At the error, it says that cannot find https://github.com/repos/AndreD23/electron-todo-tasks/releases. Opening it on the web browser, it returns 404. I find the link a bit strange because it adds the word repos after github.com, and removing it in the browser it loads fine. This word is setting automatically?
Thanks #edelCustodio
Reference: https://github.com/electron-userland/electron-builder/issues/3776#issuecomment-486888574
This worked for me, on PowerShell type this
[Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User")
and be sure that you package.json will be like this:
"build": {
"appId": "com.friasoftit.electron-auto-update",
"productName": "Electron Auto Update",
"publish": [
{
"provider": "github",
"owner": "edelCustodio",
"repo": "electron-auto-update"
}
],
"win": {
"publish": [
"github"
],
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
]
}
},
And then I run this command yarn run publish and this is how my publish is on my package.json
"publish": "build --win -p always"
Don't forget to close and open a new PowerShell terminal.
Run windows powerShell from Administrator
Execute [Environment]::SetEnvironmentVariable("GH_TOKEN","<git_hub_token>","User")
Launch or full restart your IDE
Run bozon package windows --publish
Config:
{
"name": "",
"version": "",
"description": "",
"author": "",
"repository": "<repo_url>",
"dependencies": {
"cross-fetch": "^3.0.6",
"electron-builder": "^22.10.5",
"file-loader": "^6.2.0",
"luxon": "^1.26.0",
"node-fetch": "^2.6.1"
},
"license": "ISC",
"devDependencies": {
"bozon": "1.1.3",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"jest": "26.6.3",
"spectron": "13.0.0"
},
"build": {
"appId": "",
"publish": [
{
"provider": "github"
}
],
"win": {}
},
"main": ".eslintrc.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}

Travis not publishing to Bintray properly

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

How to provide a valid crumb in ansible jenkins_script module

I am using Ansible to check the status of several jenkins servers. The playbook that I have created checks the disk space, uptime, and jenkins version perfectly fine. However, I tried to add a task that prints out a list of the installed jenkins plugins for each server by using the jenkins_Script module and keep receiving a '403' error message.
Playbook:
- name: Obtaining a list of Jenkins Plugins
jenkins_script:
script: 'println(Jenkins.instance.pluginManager.plugins)'
url: 'http://server.com:8080/'
user: '*****'
password: '*****'
Output:
fatal: [server]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"args": null,
"force_basic_auth": true,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"script": "println(Jenkins.instance.pluginManager.plugins)",
"url": "http://server.com:8080/",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"validate_certs": true
}
},
"msg": "HTTP error 403 HTTP Error 403: No valid crumb was included in the request"
}
-- I believe I have narrowed down the issue - It looks like I wasn't providing a crumb. I have since generated the crumb, but there is no 'crumb' arguement for the jenkins_script module. Does anyone know how to successfully provide a crumb?
Will gladly clarify anything stated above if needed, and any assistance is greatly appreciated.
https://github.com/ansible/ansible/pull/20207
-- if you're on ansible 2.3 the changes have already been committed all you have to do is make sure 'cross site request forgery' is enabled on the jenkins servers. (Manage jenkins > Configure Global security)

Resources