summaryrefslogtreecommitdiffstats
path: root/tests/roles/cli/tasks/bud.yaml
blob: 6dc42fa1198ffbce985320597c3637a5824bed19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
- 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