Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] build do not fail when cleaning up but there is no lock files #587

Merged
merged 4 commits into from
Jan 11, 2019
Merged

[BUG] build do not fail when cleaning up but there is no lock files #587

merged 4 commits into from
Jan 11, 2019

Conversation

Aigrefin
Copy link
Contributor

@Aigrefin Aigrefin commented Oct 9, 2017

Hello there,

The build fails when there is no plugins, because install-plugins.sh tries to rm lock files without -f.
This commit adds the -f option to the rm of "Cleaning up locks", allowing the script to finish gracefully.

Happy Hacktoberfest !

@oleg-nenashev
Copy link
Member

I would rather explicitly check the file existence. Otherwise it may suppress some valid cases (e.g. locked file on NFS, etc.)

@Aigrefin
Copy link
Contributor Author

Hello,
This will check for lock files existence and remove them without force.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@oleg-nenashev
Copy link
Member

@carlossg wdyt?

@carlossg
Copy link
Contributor

Not sure if it makes a difference but I would use

find "$REF_DIR" -iname "*.lock" -exec rm -r "{}" \;

@Aigrefin
Copy link
Contributor Author

@carlossg When I run find "$REF_DIR" -iname "*.lock" -exec rm -r "{}" \;, for some reasons I don't really get, it fails on bats tests :

     Installed plugins:
     ant:1.3
     credentials:2.1.16
     display-url-api:2.1.0
     filesystem_scm:1.21-alpha-1
     git-client:2.5.0
     git:3.6.3
     javadoc:1.4
     junit:1.21
     mailer:1.20
     matrix-project:1.12
     maven-plugin:2.7.1
     mesos:0.13.0
     scm-api:2.2.3
     script-security:1.34
     ssh-credentials:1.13
     structs:1.10
     workflow-scm-step:2.6
     workflow-step-api:2.13
     Cleaning up locks
     find: ‘/usr/share/jenkins/ref/plugins/mailer.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/script-security.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/javadoc.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/git-client.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/matrix-project.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/credentials.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/ant.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/junit.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/ssh-credentials.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/workflow-scm-step.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/maven-plugin.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/workflow-step-api.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/scm-api.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/git.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/display-url-api.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/mesos.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/structs.lock’: No such file or directory
     find: ‘/usr/share/jenkins/ref/plugins/filesystem_scm.lock’: No such file or directory
     The command '/bin/sh -c /usr/local/bin/install-plugins.sh maven-plugin:2.7.1 ant:1.3 mesos:0.13.0 git:latest filesystem_scm:experimental' returned a non-zero code: 1
   --
   
 ✓ clean work directory
 ✓ build image
 ✓ clean test containers
 ✓ test multiple JENKINS_OPTS
 ✓ test jenkins arguments
 ✓ create test container
 ✓ test container is running
 ✓ Jenkins is initialized
 ✓ JAVA_OPTS are set
 ✓ clean test containers

20 tests, 4 failures

Any idea ?

@carlossg
Copy link
Contributor

Needs the -prune option

find "$REF_DIR" -iname "*.lock" -prune -exec rm -r "{}/" \;

@batmat batmat closed this Oct 28, 2018
@batmat
Copy link
Member

batmat commented Oct 28, 2018

@Aigrefin did you try Carlos proposal?

@batmat batmat reopened this Oct 28, 2018
Copy link
Member

@batmat batmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will merge when I see a green PR build.

@batmat
Copy link
Member

batmat commented Jan 11, 2019

https://ci.jenkins.io/job/Packaging/job/docker/job/PR-587/2055/console succeeded, but for some reason there's a credentials issue apparently going on to report the status back:

image

Merging.

@batmat batmat merged commit a23c3a4 into jenkinsci:master Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants