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

Keep image when testing a tag #74

Merged
merged 3 commits into from
Jan 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
- name: get KubeNow version (git describe --tags --always)
command: git describe --tags --always
register: git_describe
- set_fact:
- name: "set version name"
set_fact:
current_version: "v{{git_describe.stdout | replace('\n','') | replace('.', '')}}"
- name: "set keep_image flag"
set_fact:
keep_image: true
when: current_version | match("^v[0-9]{3}([ab][0-9]{1,}|rc[0-9]{1,})?$")
roles:
- test-packer
- test-terraform
Expand Down
4 changes: 4 additions & 0 deletions test/roles/test-core/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
# Timeout to avoid travis to kill the whole job
async: 550
poll: 10

- name: "set tests_passed flag"
set_fact:
tests_passed: true
20 changes: 15 additions & 5 deletions test/roles/test-packer/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,40 @@
awk '{print $2;}' |
tr -d "\n"
register: get_image_id
when: host_cloud == "openstack"
when:
- host_cloud == "openstack"
- (keep_image is not defined) or (tests_passed is not defined)

- name: "delete packer image (openstack)"
listen: "delete image"
command: glance image-delete {{get_image_id.stdout}}
when: host_cloud == "openstack"
when:
- host_cloud == "openstack"
- (keep_image is not defined) or (tests_passed is not defined)

- name: "delete packer image (gce)"
listen: "delete image"
command: >
gcloud compute images delete
'kubenow-{{current_version}}' -q
when: host_cloud == "gce"
when:
- host_cloud == "gce"
- (keep_image is not defined) or (tests_passed is not defined)

- name: "deregister packer image (aws)"
listen: "delete image"
command: >
aws ec2 deregister-image
--image-id {{aws_ami_id}}
when: host_cloud == "aws"
when:
- host_cloud == "aws"
- (keep_image is not defined) or (tests_passed is not defined)

- name: "delete packer snapshot (aws)"
listen: "delete image"
command: >
aws ec2 delete-snapshot
--snapshot-id {{aws_snap_id}}
when: host_cloud == "aws"
when:
- host_cloud == "aws"
- (keep_image is not defined) or (tests_passed is not defined)