I have a project that every time a master merge is made to want a deployment is made to OpenShift automatically if the build was successful. Whenever it happens a commit to master never could make a deployment to OpenShift, always happens the following error:
$ dpl --provider=openshift --user=$OPENSHIFT_USER --password=$OPENSHIFT_PASS --domain=mycompany --app=example
Installing deploy dependencies
Successfully installed httpclient-2.4.0
1 gem installed
Successfully installed net-ssh-2.9.2
Successfully installed net-scp-1.2.1
Successfully installed net-ssh-gateway-1.2.0
Successfully installed net-ssh-multi-1.2.1
Successfully installed archive-tar-minitar-0.5.2
Successfully installed highline-1.6.21
Successfully installed commander-4.2.1
Successfully installed open4-1.3.4
===========================================================================
If this is your first time installing the RHC tools, please run 'rhc setup'
===========================================================================
Successfully installed rhc-1.38.4
9 gems installed
authenticated as [email protected]
found app example
Preparing deploy
Generating public/private rsa key pair.
Your identification has been saved in .dpl/id_rsa.
Your public key has been saved in .dpl/id_rsa.pub.
The key fingerprint is:
60:6e:25:ef:ee:ce:c4:eb:cd:f0:70:c5:f8:70:70:1d runner-a6a3492e-project-5-concurrent-0
The key's randomart image is:
+---[RSA 2048]----+
| E |
| . . |
| + . . . . |
| o = = |
| o S o + |
| . o = |
| * . . |
| + O |
| +B + |
+-----------------+
No local changes to save
Deploying application
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push ssh://[email protected]/~/git/cineguru.git/ HEAD:<name-of-remote-branch>
No stash found.
Build succeeded.
My .gitlab-ci.yml is:
stages:
- build
- deploy
job_build:
stage: build
script:
- npm install -g grunt-cli
- npm rebuild node-sass
- npm install
- grunt build
job_deploy:
stage: deploy
script:
- apt-get update -yq
- apt-get install -y ruby-dev rubygems
- gem install dpl
- dpl --provider=openshift --user=$OPENSHIFT_USER --password=$OPENSHIFT_PASS --domain=mycompany --app=example
only:
- master
I've done several tests and even that is not what I'm doing wrong
The error appears to be:
fatal: You are not currently on a branch.
This seems like an issue with your build process before dpl gets to run. Please consult your CI documentation.
@rodmoreno I had the same problem, I solved it specifying the branch:
dpl --provider=openshift --user=$OPENSHIFT_USER --password=$OPENSHIFT_PASS --domain=mycompany --app=example --deployment_branch=master
Here is my CI config and working on my deploy
production:
type: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- git config --global push.default matching
- dpl --provider=openshift --user=$OPENSHIFT_USER --password=$OPENSHIFT_PASS --domain=pringstudio --app=web
only:
- tags
environment: production
Most helpful comment
@rodmoreno I had the same problem, I solved it specifying the branch:
dpl --provider=openshift --user=$OPENSHIFT_USER --password=$OPENSHIFT_PASS --domain=mycompany --app=example --deployment_branch=master