buildah/tests/roles/cli/tasks/bud.yaml

104 lines
2.7 KiB
YAML
Raw Normal View History

---
- name: buildah bud with image's format oci
command: buildah bud --format=oci --tag testing/fmtoci /tmp/buildah/bud
- name: buildah bud with image's format docker
command: buildah bud -t testing/fmtdocker --format=docker /tmp/buildah/bud
- name: buildah bud localfile
command: buildah bud -t testing/hello --pull /tmp/buildah/bud
- name: buildah bud -f localfile
command: buildah bud -t testing/hello2 -f /tmp/buildah/bud/Dockerfile /tmp/buildah/bud
- name: buildah bud URL
command: buildah bud -t testing/hello3 http://localhost/bud/Dockerfile.tar.gz
- name: buildah build-using-dockerfile localfile
command: buildah build-using-dockerfile -t testing/hello4 /tmp/buildah/bud
- lineinfile:
path: /tmp/buildah/bud/Dockerfile
regexp: '^COPY'
line: 'COPY $foo /'
- name: buildah bud with build-arg
command: buildah bud -t testing/hello5 --build-arg foo=hello /tmp/buildah/bud
- name: create container from bud images
command: buildah from docker.io/testing/{{ item }}
with_items:
- hello
- hello2
- hello3
- hello4
- hello5
- name: list containers
command: buildah containers
register: ctrs
- name: run containers from bud images
command: buildah run {{ item }}-working-container
register: hello
with_items:
- hello
- hello2
- hello3
- hello4
- hello5
- name: verify string hello in container hellos
fail:
msg: '"Hello from Docker" not found after container run'
when: '"Hello from Docker" not in item.stdout'
with_items: "{{ hello.results }}"
- name: buildah rm containers of hello
command: buildah rm {{ item }}-working-container
with_items:
- hello
- hello2
- hello3
- hello4
- hello5
- name: buildah bud --quiet
command: buildah bud --quiet -t testing/hello6 /tmp/buildah/bud
register: budquiet
failed_when: '"STEP" in budquiet.stdout'
- name: buildah bud -q
command: buildah bud -q -t testing/hello7 /tmp/buildah/bud
register: budq
failed_when: '"STEP" in budq.stdout'
- lineinfile:
path: /tmp/buildah/bud/Dockerfile
regexp: "^FROM"
line: "FROM localhost:5000/buildah/busybox"
- name: verify bud image from local docker registry without tls-verify is failed
command: buildah bud -t testing/hellofail /tmp/buildah/bud
register: st
failed_when: st.rc != 1
- name: buildah bud image from local docker registry is successful
command: buildah bud --tls-verify=false -t testing/hello8 /tmp/buildah/bud
- name: buildah rmi hello images
command: buildah rmi {{ item }}
with_items:
- testing/hello
- testing/hello2
- testing/hello3
- testing/hello4
- testing/hello5
- testing/hello6
- testing/hello7
- testing/hello8
- testing/fmtoci
- testing/fmtdocker
- localhost:5000/buildah/busybox