josmo / drone-rancher Goto Github PK
View Code? Open in Web Editor NEWDrone plugin for triggering Rancher deployments
Drone plugin for triggering Rancher deployments
I have many environment in rancher, How to assign a specific one to drone-rancher to update stack/service?
Hi,
I have a problem for the confirmation step, it ends up with status code "1" but there is no line printed out whereas I read in the main.go that there should be either :
Here is the log output :
[info] Pulling image artifactory.myoffice.me.fr:5001/drone-rancher:latest
Drone Rancher Plugin built at 2016-02-02 08:56:57 UTC
Upgraded glpi/glpi to docker:artifactory.myoffice.me:5003/glpi:latest
[info] build failed (exit code 1)
On Rancher, the service is upgraded but not confirmed.
Here is the deploy part of my .drone.yml :
deploy:
rancher:
image: artifactory.myoffice.me:5001/drone-rancher:latest
url: 'https://rancher.myoffice.me'
access_key: xxx
secret_key: xxx
service: glpi/glpi
docker_image: 'artifactory.myoffice.me:5003/glpi:latest'
start_first: true
confirm: true
Any idea ?
Thx
It would be awesome to wrap support for Rancher's LB into this plugin.
The idea would be to focus rancher LBs and remove targets from the LB. Then preform an image upgrade and add the target back to the LB after the upgrade has been confirmed. This could solve true zero downtime/rolling deployments in rancher, from the CI server, for production setups.
Confirm upgrade when it is done (like rancher-compose --confirm-upgrade). That will be useful for staging environment. Now with the second push error "Unable to upgrade service" appears.
Rancher 2.0 is moving away from cattle and using k8s for everything. We should research how this will impact the drone-plugin.
If someone is testing 2.0 feel free to comment here. Otherwise I'll get around to it in the next month or so.
Feature
Please add an ability to create a service if one does not exist.
SecondaryLaunchConfig is used in the Rancher Api for this, but i don't know more details.
Based on Drone-secret's documentation I was expecting that I can name my secrets anything I want if I refer to them in my .drone.yml. However, the below snippet presents me with an error: "Eek: Must have url, key, secret, and service definied"
So my question is: is there a way to use access and secret key names different from RANCHER_ACCESS_KEY and RANCHER_SECRET_KEY?
Use case being that different when
events would deploy to different rancher environments having different keys along the lines of:
rancher_staging:
image: peloton/drone-rancher
service: my_service
url: https://rancher.mycompany.com
...
access_key: ${RANCHER_STAGING_ACCESS_KEY}
secret_key: ${RANCHER_STAGING_SECRET_KEY}
start_first: false
when:
event:
- pull_request
secrets:
- RANCHER_STAGING_ACCESS_KEY
- RANCHER_STAGING_SECRET_KEY
It would be great to be able to alter the batch size at least. If you have a global container across 10 separate hosts with the image being 250 MB in size, it can take a while to upgrade them 1 at a time. Allowing for adjustable batch sizes would allow for more to upgrade simultaneously, thus speeding up deployment.
Multiple Rancher environments with the same stack name, possibly containing different services but that is not necessary, results in drone-rancher selecting the first matching stack name, from any environment, to act upon. This can cause unexpected service upgrades or failures to find the service depending on what the upgrade targets.
Example Rancher site layout:
Rancher Environment -> Stack -> Services
Cloud - Dev1 -> MyCoolStack -> Service4, Service5
Cloud - Dev2 -> MyCoolStack -> Service6
Cloud - Prod1 -> MyCoolStack -> Service1, Service3
Cloud - Prod2 -> MyCoolStack -> Service1, Service2
Example drone.yml snippet:
- name: rancher-deploy
image: peloton/drone-rancher
settings:
url: https://rancher
access_key:
from_secret: rancher_access_key_id
secret_key:
from_secret: rancher_secret_access_key
service: MyCoolStack/Service6
docker_image: foo/bar:v1.1.3-alpha
confirm: true
timeout: 180
Using the above snippet upgrading the service MyCoolStack/Service6
in the environment Cloud - Dev2
will fail with a service not found error because drone-rancher matched the first stack name MyCoolStack
in the site Cloud - Dev1
. As Service6
doesn't exist in this stack the upgrade fails.
Likewise attempting to upgrade the service MyCoolStack/Service1
in the environment Cloud - Prod2
will actually upgrade the service MyCoolStack/Service1
in the environment Cloud - Prod1
as there is no way to specify the target environment.
Workarounds-
It would be great to have an option like confirm_previous
which confirms any previous upgrade before running the current one. Currently, if a previous upgrade has not been confirmed yet, the job fails with the following error message:
Unable to upgrade service stack/service: Action [upgrade] not available on ...
Especially when using this to update a test environment after pull requests (where you don't really care about the ability to roll back) this feature would be really useful.
I started a thread on the drone discourse, posting here as well. I think I'm following the docs on this repo but it's not working.
https://discourse.drone.io/t/problem-with-rancher-plugin-secrets/1739
====================================================
I can't figure out how to configure the rancher plugin properly. Here's my .drone.yml:
https://github.com/tahosalodge/elections-frontend/blob/master/.drone.yml
And for that repo, here's a screenshot of the defined secrets:
On my latest build I get this:
time="2018-02-09T19:49:16Z" level=info msg="Drone Rancher Plugin built"
time="2018-02-09T19:49:16Z" level=fatal msg="Eek: Must have url, key, secret, and service definied"
Sometimes you have multiple services running from 1 docker image, and woudl be nice to be able to update multiple services
Getting an error:
time="2017-11-05T14:09:18Z" level=info msg="Drone Rancher Plugin built" 0s 2 2017/11/05 14:09:20 Unable to upgrade service FE-APP-PROD/react-client: Action [upgrade] not available on [&{1s42 service map[environment:http://beta.dev.co:9999/v1/environment/1e23 self:http://beta.dev.co:9999/v1/services/1s42 consumedbyservices:http://beta.dev.co:9999/v1/services/1s42/consumedbyservices networkDrivers:http://beta.dev.co:9999/v1/services/1s42/networkdrivers serviceLogs:http://beta.dev.co:9999/v1/services/1s42/servicelogs storageDrivers:http://beta.dev.co:9999/v1/services/1s42/storagedrivers containerStats:http://beta.dev.co:9999/v1/services/1s42/containerstats account:http://beta.dev.co:9999/v1/services/1s42/account configItemStatuses:http://beta.dev.co:9999/v1/services/1s42/configitemstatuses consumedservices:http://beta.dev.co:9999/v1/services/1s42/consumedservices instances:http://beta.dev.co:9999/v1/services/1s42/instances serviceExposeMaps:http://beta.dev.co:9999/v1/services/1s42/serviceexposemaps] map[rollback:http://beta.dev.co:9999/v1/services/1s42/?action=rollback remove:http://beta.dev.co:9999/v1/services/1s42/?action=remove finishupgrade:http://beta.dev.co:9999/v1/services/1s42/?action=finishupgrade removeservicelink:http://beta.dev.co:9999/v1/services/1s42/?action=removeservicelink addservicelink:http://beta.dev.co:9999/v1/services/1s42/?action=addservicelink setservicelinks:http://beta.dev.co:9999/v1/services/1s42/?action=setservicelinks]}]
Could it be, that Rancher API was changed?
Add the ability to make the upgrade force pull images. Helpful when using :latest tags.
the output from my drone:
$ docker images -q -f dangling=true
[info] Pulling image plugins/drone-rancher:latest
Drone Rancher Plugin built from b4cd686
Failed to list rancher services: json: cannot unmarshal number into Go value of type string
[info] build failed (exit code 1)
rancher version: v1.1.2
drone version: 0.4
i have tried every combination of rancher plugin parameters, still could not figure out why.
plus my .drone.yml part ๏ผ
deploy:
rancher:
url: http://192.168.1.220:8084
access_key: 25317F6D60E3110BC2E2
secret_key: ryAmtmSd4WpajBc9q9JRk9KfubJEmHDjxAHFTQyw
service: p1/agent
docker_image: 192.168.1.220:5000/agent:latest
timeout: 30
PS.
tried quoting access_key.
Hello, I've like 10 environments and each of them contains ~10 stacks (with 2 to 3 containers per stack) and everything was working well until I added a new Env.
In this rancher env I've added 8 stacks, when I deploy with drone, 7 of those stacks works well, but anything after this 7th return in drone:
Unable to find stack
I've added a 8th and 9th one.. none of them will be found by the plugin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.