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

Build cache fix #678

Merged
merged 3 commits into from
Aug 9, 2017
Merged

Build cache fix #678

merged 3 commits into from
Aug 9, 2017

Conversation

chouseknecht
Copy link
Contributor

@chouseknecht chouseknecht commented Aug 4, 2017

ISSUE TYPE
  • Bugfix Pull Request
SUMMARY

Fixes #671

Add to the hash any variables passed to the role on the container.yml line used to invoke it.

With this fix, ansible-container --debug build yields the following playbook output:

ok: [mongo]
META: ran handlers

TASK [setup_role : Show which_container] ***************************************
task path: /src/roles/setup_role/tasks/main.yml:1
ok: [mongo] => {
    "which_container": "mongo"
}

TASK [setup_role : Show current host] ******************************************
task path: /src/roles/setup_role/tasks/main.yml:4
ok: [mongo] => {
    "inventory_hostname": "mongo"
}
META: ran handlers
META: ran handlers

PLAY RECAP *********************************************************************
mongo                      : ok=3    changed=0    unreachable=0    failed=0
ok: [tomee]
META: ran handlers

TASK [setup_role : Show which_container] ***************************************
task path: /src/roles/setup_role/tasks/main.yml:1
ok: [tomee] => {
    "which_container": "tomee"
}

TASK [setup_role : Show current host] ******************************************
task path: /src/roles/setup_role/tasks/main.yml:4
ok: [tomee] => {
    "inventory_hostname": "tomee"
}
META: ran handlers
META: ran handlers

PLAY RECAP *********************************************************************
tomee                      : ok=3    changed=0    unreachable=0    failed=0

Both images were built, and here are the tagged images:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tstfoo-tomee        20170804191541      2eb9b66cc877        11 minutes ago      193MB
tstfoo-tomee        latest              2eb9b66cc877        11 minutes ago      193MB
tstfoo-mongo        20170804191537      f051343c4c44        11 minutes ago      193MB
tstfoo-mongo        latest              f051343c4c44        11 minutes ago      193MB
tstfoo-conductor    latest              ae4ba36c5345        About an hour ago   546MB

@j00bar
Copy link
Contributor

j00bar commented Aug 4, 2017

You're doing this in the right place and it looks good. You might also want to grab the resolved-at-the-service-level-variables and include them in the hash here:

https://github.com/ansible/ansible-container/blob/3cb3cdb/container/core.py#L665

@chouseknecht chouseknecht force-pushed the develop branch 6 times, most recently from 81b9c7c to fd5d8de Compare August 9, 2017 07:14
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.

Using container enabled roles with ansible-container
2 participants