Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Custom tagging for push and shipit #372

Merged
merged 4 commits into from
Feb 9, 2017

Conversation

fabianvf
Copy link
Contributor

@fabianvf fabianvf commented Feb 2, 2017

ISSUE TYPE
  • Feature Pull Request
SUMMARY

Kind of touches on #125

This PR adds the --tag option to the push subcommand, allowing you to specify a custom tag for your image. This custom tag will be applied to your image, and then that tag will be pushed to your repository (instead of the default, image_buildstamp).

Before:

$ ansible-container push --push-to ansibleapp
Pushing to "docker.io/ansibleapp
Attaching to ansible_ansible-container_1
Cleaning up Ansible Container builder...
Tagging docker.io/ansibleapp/elk-ansibleapp-elasticsearch
Pushing docker.io/ansibleapp/elk-ansibleapp-elasticsearch:20170201164646...
The push refers to a repository [docker.io/ansibleapp/elk-ansibleapp-elasticsearch]
Preparing
Layer already exists
20170201164646: digest: sha256:85bf0ba4adf4264ed263ec50e48542cffff6cae5a2ed01c9dac8fed813535bcd size: 1350
Done!

After:

 $ ansible-container push --push-to ansibleapp --tag latest
Pushing to "docker.io/ansibleapp
Attaching to ansible_ansible-container_1
Cleaning up Ansible Container builder...
Tagging docker.io/ansibleapp/elk-ansibleapp-elasticsearch
Pushing docker.io/ansibleapp/elk-ansibleapp-elasticsearch:latest...
The push refers to a repository [docker.io/ansibleapp/elk-ansibleapp-elasticsearch]
Preparing
Layer already exists
latest: digest: sha256:85bf0ba4adf4264ed263ec50e48542cffff6cae5a2ed01c9dac8fed813535bcd size: 1350
Done!

Stdout for ansible-container shipit is unchanged, but the generated role/tasks/main.yml looks like this:

Before (ansible-container shipit openshift --pull-from ansibleapp):


- oso_deployment:
    project_name: elk-ansibleapp
    labels:
      app: elk-ansibleapp
      service: elasticsearch
    deployment_name: elasticsearch
    containers:
    - securityContext: {}
      name: elasticsearch
      image: docker.io/ansibleapp/elk-ansibleapp-elasticsearch:None
      env:
        ES_JAVA_OPTS: -Xms2g -Xmx2g
      workingDir: /usr/share/elasticsearch/bin
      args:
      - ./elasticsearch
      ports:
      - 9200
      - 9300
    replace: true
    replicas: '{{ replicas if replicas is defined else 3 }}'
  register: output

After (ansible-container shipit openshift --pull-from ansibleapp --tag latest):


- oso_deployment:
    project_name: elk-ansibleapp
    labels:
      app: elk-ansibleapp
      service: elasticsearch
    deployment_name: elasticsearch
    containers:
    - securityContext: {}
      name: elasticsearch
      image: docker.io/ansibleapp/elk-ansibleapp-elasticsearch:latest
      env:
        ES_JAVA_OPTS: -Xms2g -Xmx2g
      workingDir: /usr/share/elasticsearch/bin
      args:
      - ./elasticsearch
      ports:
      - 9200
      - 9300
    replace: true
    replicas: '{{ replicas if replicas is defined else 3 }}'
  register: output

@fabianvf fabianvf changed the title Custom tag when pushing images Custom tagging for push and shipit Feb 2, 2017
@chouseknecht
Copy link
Contributor

@fabianvf, looks good! I'll merge and add some doc updates.

@chouseknecht chouseknecht merged commit 4a7750d into ansible:develop Feb 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants