drone cannot cancel my non-running process, even though it is running - drone.io

I'm running drone CI. I have a build that just wont stop. It's status is running but I cant stop it because Cannot cancel a non-running build. Here are the exact commands.
sheena#ci:~$ drone build info waxd/waxed_backend 302
Number: 302
Status: running
Event: push
Commit: 511afb747007b9712a0bd00c663369de4ae81188
Branch: dev
Ref: refs/heads/dev
Message: xxxxxxxxxxxxxx
Author: Sheena
sheena#ci:~$ drone build stop waxd/waxed_backend 302
client error 400: Cannot cancel a non-running build
The only solution I can see right now is to delete drone's database and then re-create all secrets etc. But that is something I would very much like to avoid.
On the up side, this "running" build isn't blocking other builds. Even on the same repo.

delete the build container manually,, every time the drone build start, it would automatically create a container based on your .drone.yml .. so if you take a look at your server using docker ps you will see the running container,, stop it using docker stop $containerID or docker kill $containerID

Fixed it usin the drone CLI. Something like:
> drone build info org/repo
Number: 292
Status: running
Event: push
Commit: 226d553fd3bfa74199e6eb77dd18c65a62b72
...
> drone build kill org/repo 292
Force killing build org/repo#292

Related

gitflow maven plugin build error in gitlab-CI

Good afternoon, I use the gitflow maven plugin to set up automatic version number change when building a project in gitlab-CI, I set it up according to the article https://viesure.io/automating-semantic-versioning-with-maven/. I make local changes in the development branch, do push, manually launch the release job, the job works correctly. I make changes locally in the development branch again, push, run the same release job manually, and the job crashes with an error
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.13.0:release (default-cli) on project gs-maven: release: Remote branch 'origin/development' is ahead of the local branch 'development'. Execute git pull
I can’t understand where my data is getting out of sync, I tried to do git pull after the first run of the job (I did it locally), but the error still occurs. What am I doing wrong?

Black Duck with Gitlab-CI runner

Im trying to integrate BlackDuck in to a gitlab ci script.
Running OpenJDK on Alpine 3.9.2
I get the following error in the logs
2019-10-14 15:19:00 ERROR [main] --- Scanning target /code/sre-web-
portal failed: There was a problem scanning target '/code/sre-web-
portal': Could not find the 'jre' directory in
/root/blackduck/tools.
2019-10-14 15:19:00 INFO [main] --- Signature scanner actions
finished.
and the scan exits with
--- Exiting with code 6 - FAILURE_SCAN
any have this error, or has successfully configured blackduck scan to run in gitlab-ci
command that's being run
bash <(curl -s -L https://detect.synopsys.com/detect.sh) --
detect.project.version.name=1 --blackduck.trust.cert=true --proxy-
insecure --detect.blackduck.signature.scanner.dry.run=true --
blackduck.offline.mode=true --detect.tools.excluded=BINARY_SCAN
I have tried setting the BDS_JAVA_HOME environment variable and it still fails with
--- Exiting with code 6 - FAILURE_SCAN
The cause of your problem is that the required 'Siganture Scanner' tool is yet missing.
Your command tells me, your were running the scan in offline mode.
This means, you have two options to solve this problem:
Either download and install the Signature Scanner tool manually (see https://testing.blackduck.synopsys.com/doc/componentdiscovery/downloadandinstall.htm) and set --detect.blackduck.signature.scanner.local.path= option to scan.
Or run the scan in online mode once as the tool is automatically downloaded and installed only after first establishing a connection to the BlackDuck server. (You can switch back to offline mode after that.)
Credits go to this synopsys community article.

How to disable simultaneous build on drone io?

I use drone as CI and want to know how I can disable simultaneous build. What's happening is that when I submit two commits to git repo, drone will trigger two build on each of the submit. How can I let the second build wait until the first one finish?
Regarding the open source version of Drone: set the DOCKER_MAX_PROCS environment variable of your drone agent to 1, i.e. docker run -e DOCKER_MAX_PROCS=1 [...] drone/drone:0.5 agent. The agent will run one build concurrently, other builds will queue up.
See the Installation Reference section in the readme for more info.

Jenkins: Publish over SSH after failed build

I am trying to use the Publish Over SSH plugin to publish many kinds of build artifact to an external server. Examples of build artifacts are compiled builds, XML output from testing, and JSON output from linting.
If testing or linting results in errors, the build will fail or be marked unstable. In the case of a failed build, the Publish Over SSH plugin will not copy the build artifacts, writing to the console:
SSH: Current build result is [FAILURE], not going to run.
I see no reason why I wouldn't want to publish this information if it exists, and I would like to continue to report errors as build failures. So, is there any way to force Jenkins to publish build artifacts even if the job is marked as a failure?
I thought I could use the Flexible Publish to force this, by wrapping the Publish Over SSH in an "always" condition, but this gave the same output as before on a build failure.
I can think of a couple of work-arounds:
a) store the build status in an environment variable; force the status to SUCCESS; perform the publish step; recover the build status from the environment variable using java jenkins-cli.jar set-build-status $STORED_STATUS
OR
b) Write a bash script to perform the publishing step manually using SSH, cutting out the Publish Over SSH plugin altogether
Before I push forward with either of these solutions (neither of which I like), is there any piece of configuration that I'm missing?
The solution I ended up using was to use rsync/ssh to copy the files manually using a post build script. I configured this in my Jenkins Job Builder YAML like so:
- publisher:
name: publish-to-archive
publishers:
- post-tasks:
- matches:
- log-text: ".*"
script: |
ssh -i ${{HOME}}/.ssh/id_rsa jenkins#archiver "mkdir -p {archive_path}"
rsync -Pravdtze "ssh -i ${{HOME}}/.ssh/id_rsa" {source_path} jenkins#archiver:{archive_path}
Quoting old hooky on jenkinsci-users:
How can I force Publish Over SSH to work even if the build has been marked
a failure?
Use "Send files or execute commands over SSH after the build runs" in
configuration section "Build environment"
Job configuration / Build Environment / Send files or execute commands over SSH after the build runs
instead of using a post-build or build-step.

How to stop (kill) a build in drone

Is there a way to kill a build in drone before it finishes or times out?
The default timeout in drone is 6 hours (https://github.com/drone/drone/blob/master/cmd/drone/drone.go#L32)
And if you have a mistake in your makefile that just get's stuck then you need to wait for 6 hours.
This is specially annoying if you have limited number of simultaneous builds.
My question is about the self hosted, open source version, not the hosted version if it makes any difference.
You can stop drone build using CLI:
drone build stop <repo/name> <build>
If build cannot be stopped/canceled, you can kill it:
drone build kill <repo/name> <build>
See more commands in drone CLI docs.
I just pushed a new commit and it automatically stopped the stuck build and started a new one. No need to wait for 6 hours. ;)
This is possible from the UI in Drone 0.4.
To stop the build using the drone cli, use the following command:
drone build stop <root/name> <DRONE_BUILD_NUMBER>
Make sure the following are exported:
export DRONE_SERVER=https://drone.server.com
export DRONE_TOKEN=<secret_drone_token>
It is also possible to stop the build using API:
DELETE /api/repos/{owner}/{repo}/builds/{build}