Summary:
When connecting to a plain git repository over SSH, which has no Jenkinsfiles in it, attempts to save and create a Jenkinsfile to master will not write the Jenkinsfile. However, attempts to save to a new branch work fine.
Prerequisites:
- A remote git "server" you can successfully connect to via ssh.
- A repository on same git server, which has been git init'd and has a README.md file on the master branch, but nothing else. The git history looks more or less like this:
ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ git hist * 9d80d07 (HEAD -> master) yeah
Steps to reproduce:
1. Launch Blue Ocean and select New Pipeline.
2. Select Git as your SCM, and provide a valid URL, in the form of ssh://username@1.2.3.4/path/to/git-server/repos/repo-name.
3. When Blue Ocean presents you with an SSH key to register with the Git server, do so, by adding it to /home/username/.ssh/authorized_keys
4. Click "Create Pipeline" and you'll be taken to the flow for creating your first Pipeline:
5. Click "Create Pipeline," and create a very simple, one-stage Pipeline:
6. Click "Save," provide a commit message, and leave the default setting of "Commit to master" selected. Then click Save & run.
7. The progress bar near the top will move left-to-right as expected, but you'll be taken back to the "You don't have any branches that contain a Jenkinsfile" message:
8. Check on the git server, to see if anything was created. Nothing was:
ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ git status On branch master nothing to commit, working directory clean ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ ls README.md
9. Repeat the process of creating a Pipeline. But this time, save it to a new branch, like so:
10. This time, the Jenkinsfile has been created:
11. And we can see this on the git server, too:
ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ git branch editor-created-this-branch * master ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ git checkout editor-created-this-branch Switched to branch 'editor-created-this-branch' ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ ls Jenkinsfile README.md ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$ cat Jenkinsfile pipeline { agent any stages { stage('Second Attempt') { steps { echo 'Hello from editor-created-this-branch' } } } }ubuntu@ip-172-18-40-84:~/git-server/repos/per-stage-editing$
- links to
[JENKINS-46885] New Jenkinsfiles can't be pushed to master on a plain Git server, but new branches work fine
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Remote Link | New: This issue links to "Implemented in PR 1394 (Web Link)" [ 17701 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Resolved [ 5 ] |
Labels | New: testing-notes-reviewed |
Note: the crux of the problem is that this isn't using a bare repository. But it needs better error reporting and to be able to handle actual empty repositories. I'll fix those as part of this ticket.