Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update By Tag #47

Open
Fenikkusu opened this issue Mar 14, 2018 · 4 comments
Open

Update By Tag #47

Fenikkusu opened this issue Mar 14, 2018 · 4 comments

Comments

@Fenikkusu
Copy link

Not sure if this is possible or not, but it would be nice if this was able to update by tag. Instead of saying

upgrade --stack my-stack
upgrade --stack my-other-stack
upgrade --stack yet-another-stack

I could instead just say

upgrade --tag stack-group
@cdrx
Copy link
Owner

cdrx commented Mar 16, 2018

Would this upgrade by Docker tag? ie, anything with ":latest" would be upgrade --tag latest?

@Fenikkusu
Copy link
Author

Fenikkusu commented Mar 16, 2018 via email

@Fenikkusu
Copy link
Author

Some additional clarification. Due to the nature of this, I think that using --tag would need to completely ignore --stack. If you were to specify tag and multiple stacks exist with the same tag, then the assumption is that you are trying to update each stack tagged as such, not just one. It is also reasonable to say that using --tag would require a need for a --exclude-stack option as well, so we could say update all stacks tagged wordpress but the stack named 'my-legacy-stack'.

Going back to the WordPress example, If I use a custom build image of WordPress and I have multiple clients running that same build but are otherwise isolated from each other, currently I'd have to put an upgrade line to the .gitlab-ci.yml for each stack in the environment. IE:

deploy:
  image: cdrx/rancher-gitlab-deploy
  environment: production
  dependencies: []
  script:
    - upgrade --stack Client 2 --service wordpress
    - upgrade --stack Client 3 --service wordpress
    - upgrade --stack Client 4 --service wordpress
    - upgrade --stack Client 5 --service wordpress
    - upgrade --stack Client 6 --service wordpress
    - upgrade --stack Client 7 --service wordpress
    ...
    - upgrade --stack Client N --service wordpress

I would also have to update the yaml any time I add a new stack. If this functionality could be accomplished, then the pipeline only needs to use the upgrade tag line once, with the tag, and updates every stack. IE:

deploy:
  image: cdrx/rancher-gitlab-deploy
  environment: production
  dependencies: []
  script:
    - upgrade --tag wordpress --exclude-stack old-client-stack --service wordpress

@sigrist
Copy link

sigrist commented Apr 4, 2018

I have another example for this feature. I have two environments, development and production. I can create a new image for my container with the tag preview and so upgrade the stacks with a specific tag, for instance $CI_PROJECT_ID_preview. When all development is done, when I create the container latest, I want to upgrade all stacks with tag $CI_PROJECT_ID_latest.

It would be easy to setup in Rancher and in GitLab.

deploy-preview:
  stage: deploy
  image: cdrx/rancher-gitlab-deploy
  script:
    - upgrade --tag $CI_PROJECT_ID_preview
  only:
    - develop
  environment: 
    name: preview

deploy-production:
  stage: deploy
  image: cdrx/rancher-gitlab-deploy
  script:
    - upgrade --tag $CI_PROJECT_ID_production
  only:
    - master
  environment: 
    name: production

Regards
Sigrist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants