summaryrefslogtreecommitdiffstats
path: root/tests/roles/cli/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/roles/cli/tasks')
-rw-r--r--tests/roles/cli/tasks/add.yaml41
-rw-r--r--tests/roles/cli/tasks/bud.yaml24
-rw-r--r--tests/roles/cli/tasks/cleanup.yaml4
-rw-r--r--tests/roles/cli/tasks/config.yaml16
-rw-r--r--tests/roles/cli/tasks/containers.yaml18
-rw-r--r--tests/roles/cli/tasks/copy.yaml41
-rw-r--r--tests/roles/cli/tasks/from.yaml12
-rw-r--r--tests/roles/cli/tasks/main.yaml44
-rw-r--r--tests/roles/cli/tasks/mount.yaml27
-rw-r--r--tests/roles/cli/tasks/prepare-containers.yaml6
-rw-r--r--tests/roles/cli/tasks/push.yaml60
-rw-r--r--tests/roles/cli/tasks/tag.yaml43
12 files changed, 336 insertions, 0 deletions
diff --git a/tests/roles/cli/tasks/add.yaml b/tests/roles/cli/tasks/add.yaml
new file mode 100644
index 0000000..0bd6498
--- /dev/null
+++ b/tests/roles/cli/tasks/add.yaml
@@ -0,0 +1,41 @@
+---
+- name: buildah add
+ command: buildah add nginxc /tmp/buildah/bud/Dockerfile
+
+- name: check buildah add
+ command: ls {{mount.stdout}}/Dockerfile
+
+- name: buildah add to destination
+ command: buildah add nginxc /tmp/buildah/bud/Dockerfile /home
+
+- name: check buildah add to
+ command: ls {{mount.stdout}}/home/Dockerfile
+
+- name: buildah add URL
+ command: buildah add nginxc https://github.com/projectatomic/buildah/raw/master/README.md
+
+- name: check buildah add URL
+ command: ls {{mount.stdout}}/README.md
+
+- name: buildah add URL to destination
+ command: buildah add nginxc https://github.com/projectatomic/buildah/raw/master/README.md /home
+
+- name: check buildah add URL to destination
+ command: ls {{mount.stdout}}/home/README.md
+
+- name: Download buildah README.md
+ get_url:
+ url: https://github.com/projectatomic/buildah/raw/master/README.md
+ dest: /tmp/buildah/
+
+- name: buildah add dir
+ command: buildah add nginxc /tmp
+
+- name: check buildah add dir
+ command: ls {{mount.stdout}}/buildah/README.md
+
+- name: buildah add dir to destination
+ command: buildah add nginxc /tmp /home
+
+- name: check buildah add dir to destination
+ command: ls {{mount.stdout}}/home/buildah/README.md
diff --git a/tests/roles/cli/tasks/bud.yaml b/tests/roles/cli/tasks/bud.yaml
new file mode 100644
index 0000000..1f1c678
--- /dev/null
+++ b/tests/roles/cli/tasks/bud.yaml
@@ -0,0 +1,24 @@
+---
+- name: buildah bud localfile
+ command: buildah bud -t testing/nginx --pull /tmp/buildah/bud
+
+- name: check bud images with buildah images command
+ shell: buildah images | grep testing/nginx
+
+- name: buildah bud -f localfile
+ command: buildah bud -t testing/nginx2 -f /tmp/buildah/bud/Dockerfile .
+
+- name: buildah bud URL
+ command: buildah bud -t testing/nginx3 http://localhost/bud/Dockerfile.tar.gz
+
+- name: buildah build-using-dockerfile localfile
+ command: buildah build-using-dockerfile -t testing/nginx4 /tmp/buildah/bud
+
+- name: buildah build-using-dockerfile -f localfile
+ command: buildah build-using-dockerfile -t testing/nginx5 --file /tmp/buildah/bud/Dockerfile .
+
+- name: buildah build-using-dockerfile URL
+ command: buildah build-using-dockerfile --tag testing/nginx6 http://localhost/bud/Dockerfile.tar.gz
+
+- name: buildah rmi
+ command: buildah rmi testing/nginx{2..6}
diff --git a/tests/roles/cli/tasks/cleanup.yaml b/tests/roles/cli/tasks/cleanup.yaml
new file mode 100644
index 0000000..45f31d5
--- /dev/null
+++ b/tests/roles/cli/tasks/cleanup.yaml
@@ -0,0 +1,4 @@
+---
+- name: remove buildah containers after testing
+ command: buildah rm busybox nginxc nginxc-2
+ ignore_errors: true
diff --git a/tests/roles/cli/tasks/config.yaml b/tests/roles/cli/tasks/config.yaml
new file mode 100644
index 0000000..91e8bc3
--- /dev/null
+++ b/tests/roles/cli/tasks/config.yaml
@@ -0,0 +1,16 @@
+---
+- name: buildah config workingdir
+ command: buildah config --workingdir /opt nginxc
+
+- name: get buildah config workingdir
+ command: buildah run nginxc "pwd"
+ register: checkworkingdir
+ failed_when: "'/opt' not in checkworkingdir.stdout"
+
+- name: buildah config env
+ command: buildah config --env foo=bar nginxc
+
+- name: get buildah config env
+ command: buildah run nginxc env
+ register: env
+ failed_when: "'foo=bar' not in env.stdout"
diff --git a/tests/roles/cli/tasks/containers.yaml b/tests/roles/cli/tasks/containers.yaml
new file mode 100644
index 0000000..fa9add6
--- /dev/null
+++ b/tests/roles/cli/tasks/containers.yaml
@@ -0,0 +1,18 @@
+---
+- name: buildah containers
+ shell: buildah containers | grep nginxc
+
+- name: buildah containers -q
+ shell: buildah containers -q | grep -v nginxc
+
+- name: buildah containers -n
+ shell: buildah containers -n | grep -v NAME
+
+- name: buildah containers --notruncate
+ command: buildah containers -- notruncate
+
+- name: buildah containers --all
+ command: buildah containers --all
+
+- name: buildah containers --json
+ command: buildah containers --json
diff --git a/tests/roles/cli/tasks/copy.yaml b/tests/roles/cli/tasks/copy.yaml
new file mode 100644
index 0000000..3f0d8c5
--- /dev/null
+++ b/tests/roles/cli/tasks/copy.yaml
@@ -0,0 +1,41 @@
+---
+- name: buildah copy
+ command: buildah copy nginxc-2 /tmp/buildah/bud/Dockerfile
+
+- name: check buildah copy
+ command: ls {{mount.stdout}}/Dockerfile
+
+- name: buildah copy to destination
+ command: buildah copy nginxc-2 /tmp/buildah/bud/Dockerfile /home
+
+- name: check buildah copy to
+ command: ls {{mount.stdout}}/home/Dockerfile
+
+- name: buildah copy URL
+ command: buildah copy nginxc-2 https://github.com/projectatomic/buildah/raw/master/README.md
+
+- name: check buildah copy URL
+ command: ls {{mount.stdout}}/README.md
+
+- name: buildah copy URL to destination
+ command: buildah copy nginxc-2 https://github.com/projectatomic/buildah/raw/master/README.md /home
+
+- name: check buildah copy URL to destination
+ command: ls {{mount.stdout}}/home/README.md
+
+- name: Download buildah README.md
+ get_url:
+ url: https://github.com/projectatomic/buildah/raw/master/README.md
+ dest: /tmp/buildah/
+
+- name: buildah copy dir
+ command: buildah copy nginxc-2 /tmp/buildah
+
+- name: check buildah copy dir
+ command: ls {{mount.stdout}}/README.md
+
+- name: buildah copy dir to destination
+ command: buildah copy nginxc-2 /tmp /home
+
+- name: check buildah copy dir to destination
+ command: ls {{mount.stdout}}/home/buildah/README.md
diff --git a/tests/roles/cli/tasks/from.yaml b/tests/roles/cli/tasks/from.yaml
new file mode 100644
index 0000000..e694b10
--- /dev/null
+++ b/tests/roles/cli/tasks/from.yaml
@@ -0,0 +1,12 @@
+---
+- name: buildah from pull
+ command: buildah from --pull nginx
+
+- name: buildah from pull always
+ command: buildah from --pull-always nginx
+
+- name: buildah from with name
+ command: buildah from --name nginx nginx
+
+- name: clean from testings
+ command: buildah delete nginx nginx-working-container nginx-working-container-2
diff --git a/tests/roles/cli/tasks/main.yaml b/tests/roles/cli/tasks/main.yaml
new file mode 100644
index 0000000..f709887
--- /dev/null
+++ b/tests/roles/cli/tasks/main.yaml
@@ -0,0 +1,44 @@
+---
+- block:
+ - name: prepare containers nginxc
+ import_tasks: prepare-containers.yaml
+ tags:
+ - nginxc
+
+ - name: buildah containers
+ import_tasks: containers.yaml
+ tags:
+ - ctr
+
+ - name: buildah from
+ import_tasks: from.yaml
+ tags:
+ - from
+
+ - name: buildah mount
+ import_tasks: mount.yaml
+ tags:
+ - mount
+
+ - name: buildah tag
+ import_tasks: tag.yaml
+ tags:
+ - tag
+
+ - name: buildah config
+ import_tasks: config.yaml
+ tags:
+ - config
+
+ - name: buildah push
+ import_tasks: push.yaml
+ tags:
+ - push
+
+ - name: buildah build-using-dockerfile
+ import_tasks: bud.yaml
+ tags:
+ - bud
+
+ always:
+ - import_tasks: cleanup.yaml
diff --git a/tests/roles/cli/tasks/mount.yaml b/tests/roles/cli/tasks/mount.yaml
new file mode 100644
index 0000000..09bd901
--- /dev/null
+++ b/tests/roles/cli/tasks/mount.yaml
@@ -0,0 +1,27 @@
+---
+- name: buildah mount container nginxc
+ command: buildah mount nginxc
+ register: mount
+
+- name: buildah mount without args will list all mounts
+ shell: buildah mount | grep storage
+
+- name: buildah add
+ import_tasks: add.yaml
+ tags:
+ - add
+
+- name: buildah umount
+ command: buildah umount nginxc
+
+- name: buildah mount --notruncate
+ command: buildah mount --notruncate nginxc-2
+ register: mount
+
+- name: buildah copy
+ import_tasks: copy.yaml
+ tags:
+ - copy
+
+- name: buildah unmount
+ command: buildah unmount nginxc-2
diff --git a/tests/roles/cli/tasks/prepare-containers.yaml b/tests/roles/cli/tasks/prepare-containers.yaml
new file mode 100644
index 0000000..1477e62
--- /dev/null
+++ b/tests/roles/cli/tasks/prepare-containers.yaml
@@ -0,0 +1,6 @@
+---
+- name: prepare container nginxc for later testing
+ command: buildah from --pull --name nginxc nginx
+
+- name: prepare container nginxc-2 for later testing
+ command: buildah from --name nginxc-2 nginx
diff --git a/tests/roles/cli/tasks/push.yaml b/tests/roles/cli/tasks/push.yaml
new file mode 100644
index 0000000..cc38b51
--- /dev/null
+++ b/tests/roles/cli/tasks/push.yaml
@@ -0,0 +1,60 @@
+---
+- name: pull busybox before push
+ command: buildah from --pull --name busybox busybox
+
+- name: buildah push image to containers-storage
+ command: buildah push docker.io/busybox:latest containers-storage:docker.io/busybox:latest
+
+- name: buildah push image to docker daemon
+ command: buildah push docker.io/busybox:latest docker-daemon:docker.io/buildah/busybox:latest
+
+- name: check buildah/busybox exist in docker daemon
+ command: docker images docker.io/buildah/busybox:latest
+
+- name: buildah push image to docker local registry
+ command: buildah push --tls-verify=false docker.io/busybox:latest docker://localhost:5000/buildah/busybox:latest
+
+- name: create /tmp/buildah/busybox
+ file: path=/tmp/buildah/docker state=directory
+
+- name: rm busybox.tar because docker archive does not support modify
+ file: path=/tmp/buildah/docker/busybox.tar state=absent
+
+- name: buildah push image to docker-archive
+ command: buildah push docker.io/busybox:latest docker-archive:/tmp/buildah/docker/busybox.tar:latest
+
+- name: check docker archive exist
+ file: path=/tmp/buildah/docker/busybox.tar state=file
+
+- name: create /tmp/buildah/dir
+ file: path=/tmp/buildah/dir state=directory
+
+- name: buildah push image to dir
+ command: buildah push docker.io/busybox:latest dir:/tmp/buildah/dir
+
+- name: create /tmp/buildah/oci
+ file: path=/tmp/buildah/oci state=directory
+
+- name: buildah push image to oci
+ command: buildah push docker.io/busybox:latest oci:/tmp/buildah/oci:latest
+
+- name: buildah push image to oci archive
+ command: buildah push docker.io/busybox:latest oci-archive:/tmp/buildah/oci/busybox.tar:latest
+
+- name: check oci archive exist
+ file: path=/tmp/buildah/oci/busybox.tar state=file
+
+- name: init default ostree repo
+ command: ostree --repo=/ostree/repo init
+
+- name: create /tmp/buildah/ostree/repo
+ file: path=/tmp/buildah/ostree/repo state=directory
+
+- name: init tmp ostree repo
+ command: ostree --repo=/tmp/buildah/ostree/repo init
+
+- name: buildah push image to ostree
+ command: buildah push docker.io/busybox:latest ostree:busybox:latest
+
+- name: buildah push image to non-default ostree repo
+ command: buildah push docker.io/busybox:latest ostree:busybox:latest@/tmp/buildah/ostree/repo
diff --git a/tests/roles/cli/tasks/tag.yaml b/tests/roles/cli/tasks/tag.yaml
new file mode 100644
index 0000000..32767ba
--- /dev/null
+++ b/tests/roles/cli/tasks/tag.yaml
@@ -0,0 +1,43 @@
+---
+- name: buildah from --pull busybox
+ command: buildah from busybox
+
+- name: buildah tag by name
+ command: buildah tag busybox busybox1
+
+- name: check busybox1 exists
+ shell: buildah images | grep busybox1
+
+- name: get image id
+ command: buildah images -q busybox1
+ register: busyboxID
+
+- name: buildah tag by ID
+ command: buildah tag {{busyboxID.stdout}} busybox2
+
+- name: check busybox2 exists
+ shell: buildah images | grep busybox2
+
+- name: buildah from tagged image
+ command: buildah from busybox1
+
+- name: mount the container which using tagged image
+ command: buildah mount busybox1-working-container
+
+- name: buildah umount the container
+ command: buildah umount busybox1-working-container
+
+- name: buildah rm container busybox
+ command: buildah rm busybox-working-container
+
+- name: buildah rm container busybox1
+ command: buildah rm busybox1-working-container
+
+- name: buildah rmi tagged image
+ command: buildah rmi busybox{1..2}
+
+- name: check image busybox is not deleted
+ shell: buildah images | grep busybox
+
+- name: buildah rmi image busybox
+ command: buildah rmi busybox