heroku-cli-deploy: how to specify the version? - heroku

I deploy a JAR file to Heroku using the heroku-cli-deploy plugin:
heroku deploy:jar webapp.jar
If I run this command inside a Git repository, the version of the displayed in the Heroku dashboard is the version of the currently checked out commit.
If I run this out of a Git tree, there are no version info displayed in the dashboard.
Is there any chance to specify the SHA1 of the release programmatically without running the deploy command from inside the git repository ?

The version can be injected using the cli parameter --build-version. For example:
heroku deploy:jar webapp.jar --app webapp --build-version `git rev-parse --short HEAD`
NOTE! It seems that Heroku is filtering the value and it has to be a git hash. So it's not possible to push --build-version v1.0.0 for example.

Related

Is there any way to prove a heroku deployment corresponds to a github repo?

I want to set an opensource project where users can be sure that the deployed version .heroku.com corresponds with the actual source code in github master branch github.com/
Is there any way to prove a heroku deployment corresponds to a github repo?
Your app can spit out the latest deployed Git SHA if it has the "Dyno Metadata" feature turned on: https://devcenter.heroku.com/articles/dyno-metadata
Using that, you can show the latest SHA and compare it against the public repo.
Also, to add to what Jon said, you can do this via the heroku releases command. Every release, be it a code deployment, config var is 'tagged' - the command will show you everything that has changed on your app and a deploy will show the short git SHA, you can copy the SHA and then use the git command to search the repo for it.
eg.
assuming heroku releases returns
v10 Deploy 33f21247 foo#bah.com 2018/09/03 10:01:38 +0100
then you could do:
git cat-file commit 33f21247
which will then output the corresponding match, or a message saying it's not found. Obviously, this assumes your local repo is in sync with GitHub. To check it against GitHub you'd need to open your repo on GitHub like:
https://github.com/heroku/{projectname}/commit/{sha}
which will show the same commit on GitHub.

how to migrate git to gitlab migration with history (existing branches and tags)

I setup the new fresh GitLab server and i want to migrate my git repositories to gitlab server. I am following below steps but i am getting the error.
git clone --mirror Git repo URL
git remote add NEW-REMOTE Git Lab repo URL
git push NEW-REMOTE --mirror
finally it through an error
remote: fatal: Error in object
error: pack-objects died of signal 13
any help would be appreciated.
I believe gitlab has it's own git import tool built into the interface. When creating a new project you can import an existing git repo with it. Any history and branches will be included.
screenshot:

How do I deploy my site from github to heroku?

How do I deploy my site from github to heroku?
nbp-229-179:portfolio folder admin$ git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
nbp-229-179:portfolio folder admin$
You might want to look into the GitHub integration, which will allow you to link your heroku app with github, not do any git pushes to heroku anymore but have your application automatically deployed.
With pipelines, you can automatically deploy a staging app with every push to the master branch, and manually promote the staging deployment to production.

setting buildpack for heroku deployment using git strategy

travis has a config to set the buildpack source for heroku deployment using the Anvil deploy strategy, but it doesn't specify how to set that config value using the git deploy strategy.
how do you set buildpack config value as a heroku config variable before deployment if you're using the git deployment strategy in travis?
thanks.
For git deploys, Heroku relies on the BUILDPACK_URL environment variable to be configured for your repository.
Anvil doesn't utilize these settings, hence it needs to be manually specified in the deployment settings.

How to redeploy a Tomcat 7 application on Openshift

I know that a git push origin master will let Openshift redeploy the application to its new version.
But my situation is that my Tomcat application depends on another sub-module maven project, and they are both snapshot.
Once its sub-module project changes (the Tomcat application remains the same), the git push origin master doesn't work at all (Everything up-to-date) and of course Openshift will not redeploy my application, which means that it doesn't renew the newest sub-module snapshot artifact for me.
So, how to solve this problem? I have tried rhc restart and rhc reload, but they doesn't work. Is there some command like rhc redeploy?
You can run
rhc app deploy HEAD -a <appname>
if you're using the command line tools
You can start the deploy steps by ssh'ing to your openshift application. Check your ssh line from https://openshift.redhat.com/app/console/applications/ -> Click your application and then "Want to log in to your application?". Check https://www.openshift.com/developers/remote-access for detailed help (thanks RustyTheBoyRobot).
Once in, run:
gear deploy
Are you sure that you've pulled and committed the most recent changes to the submodule? What's probably happening is the reference to the desired submodule commit isn't updated, so even though the submodule has changed, you project doesn't really know about it. I believe git submodule status should show you the commit your main project currently knows about.
To update this reference, follow these directions.
[main]$ cd ./subm
[subm]$ git pull origin/master # or fetch then merge
[subm]$ cd ..
[main]$ git commit ./subm -m "Updated submodule reference"
If you actually committed changes in the last step, then OpenShift should update it appropriately (since this time, there were changes to the git repo).

Resources