Heroku:如何在gitlab CI / CD中释放现有映像? [英] Heroku: How to release an existing image in gitlab CI/CD?

查看:112
本文介绍了Heroku:如何在gitlab CI / CD中释放现有映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的应用程序部署为来自Gitlab CI / CD管道的容器。

I would like to deploy my application as a container from Gitlab CI/CD pipeline.

几天前,我可以按照heroku devCenter中的代码部署docker镜像。

A few days ago I could deploy my docker image as written in the heroku devCenter.


docker login --username = _ --password = $(heroku auth:token)Registry.heroku.com

docker login --username=_ --password=$(heroku auth:token) registry.heroku.com

并将其推送到heroku注册表中。

and pushed it to the heroku registry.


docker tag imageregistry.heroku.com/app/process-type

docker tag imageregistry.heroku.com/app/process-type

docker push Registry.heroku.com/app/process-type

docker push registry.heroku.com/app/process-type

然后他们分两步更改了部署

But then they changed the deploy in 2 steps


heroku cointainer:push

heroku cointainer:push

heroku container:release

heroku container:release

在更新之前,将容器推送到容器注册表中时会对其进行部署。现在,我需要以任何方式释放它。

Before the update it was deployed when the container was pushed into the container registry. Now I need to release it in any way.

我试图重命名要释放的映像并尝试安装heroku CLI,但是后来我无法登录到heroku注册表。

I tried to rename the image to release and tried to install heroku CLI but then I cannot log into heroku registry.

您是如何解决的?

推荐答案

这是我昨天找到的可触发发布的有效解决方案。您可以使用docker进行部署,只需将此小脚本添加到管道中即可。

Here's a working solution I found yesterday which trigger a release. You can keep your deployment with docker and just add this little script to your pipeline.

#!/bin/bash
imageId=$(docker inspect registry.heroku.com/$YOUR_HEROKU_APP/web --format={{.Id}})
payload='{"updates":[{"type":"web","docker_image":"'"$imageId"'"}]}'
curl -n -X PATCH https://api.heroku.com/apps/${YOUR_HEROKU_APP}/formation \
-d "$payload" \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3.docker-releases" \
-H "Authorization: Bearer $YOUR_HEROKU_API_KEY"

此解决方案来自Kaitödter您可以在 https://toedter.com/2018上找到它/ 06/02 / heroku-docker-deployment-update /

This solution comes from Kai tödter and you can find it at https://toedter.com/2018/06/02/heroku-docker-deployment-update/

这篇关于Heroku:如何在gitlab CI / CD中释放现有映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆