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

Failed to run launchable record build with Jenkins GitHub Branch Source build on Launchable CLI 1.66.1 #581

Open
basil opened this issue Jul 13, 2023 · 8 comments

Comments

@basil
Copy link
Contributor

basil commented Jul 13, 2023

After upgrading the Launchable CLI all of our PR builds started failing like this:

10:18:03  + launchable record build --name jenkins-Core-jenkins-PR-8267-1 --source jenkinsci/jenkins=.
10:18:04  Launchable recorded 1 commit from repository /home/jenkins/agent/workspace/Core_jenkins_PR-8267
10:18:04  Can't get commit hash. Do you run command under git-controlled directory? If not, please set a directory use by --source option.
10:18:04  'GIT_LOCAL_BRANCH'

Last working version was 1.66.0.

@basil
Copy link
Contributor Author

basil commented Jul 13, 2023

#570 appears to be the cause of the issue. This PR assumes that the GIT_BRANCH and/or GIT_LOCAL_BRANCH are set, but they are not set on my Jenkins controller. The following environment variables are set:

BRANCH_NAME=PR-8266
CHANGE_AUTHOR=dependabot[bot]
CHANGE_BRANCH=dependabot/maven/org.jvnet.hudson-commons-jelly-tags-define-1.1-jenkins-20230713
CHANGE_ID=8266
CHANGE_TARGET=master
CHANGE_TITLE=Bump commons-jelly-tags-define from 1.1-jenkins-20230124 to 1.1-jenkins-20230713
CHANGE_URL=https://github.com/jenkinsci/jenkins/pull/8266

@basil
Copy link
Contributor Author

basil commented Jul 13, 2023

Rolled back in jenkins-infra/packer-images#745.

@basil
Copy link
Contributor Author

basil commented Jul 13, 2023

@basil basil changed the title Regression in recent Launchable CLI release Failed to run launchable record build with Jenkins GitHub Branch Source build on Launchable CLI 1.66.1 Jul 13, 2023
@basil
Copy link
Contributor Author

basil commented Jul 13, 2023

I just tested locally on my development Jenkins controller and found that these environment variables are set only when cloning a repository with the Git plugin directly:

GIT_PREVIOUS_SUCCESSFUL_COMMIT=6d66a8acdae76e62556c6cc2f3011b5eb031c94f
GIT_COMMIT=6d66a8acdae76e62556c6cc2f3011b5eb031c94f
GIT_BRANCH=origin/master
GIT_URL=https://github.com/basil/simple-maven-project-with-tests.git
GIT_PREVIOUS_COMMIT=6d66a8acdae76e62556c6cc2f3011b5eb031c94f

Most Jenkins users whose code is on GItHub, including our production use case on ci.jenkins.io, are instead using the Pipeline: Multibranch and GitHub Branch Source plugins rather than the Git plugin. In this style of usage, the environment variables are different (as documented in https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/resources/jenkins/branch/BranchNameContributor/buildEnv.properties). So I would recommend checking environment variables in the following order:

  • CHANGE_BRANCH (for PR Multibranch plugin builds)
  • CHANGE_TARGET (for PR Multibranch plugin builds)
  • BRANCH_NAME (for non-PR Multibranch plugin builds)
  • GIT_BRANCH (for GIt plugin builds)
  • GIT_LOCAL_BRANCH (for Git plugin builds)

@kohsuke
Copy link
Member

kohsuke commented Jul 13, 2023

My apologies for this mishap. We released v1.67.3 to roll back the problematic change.

@kohsuke kohsuke closed this as completed Jul 13, 2023
@basil
Copy link
Contributor Author

basil commented Jul 13, 2023

Thank you for the quick response!

@basil
Copy link
Contributor Author

basil commented Sep 19, 2023

Still broken as of 1.75.0: jenkins-infra/helpdesk#3756

@basil
Copy link
Contributor Author

basil commented Sep 20, 2023

Reverted to 1.66.0 (for the second time). Can this ticket be reopened?

@kohsuke kohsuke reopened this Sep 24, 2023
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

No branches or pull requests

2 participants