diff --git a/1.2.40 b/1.2.40 deleted file mode 120000 index c10def9..0000000 --- a/1.2.40 +++ /dev/null @@ -1 +0,0 @@ -centos7-1.2.40 \ No newline at end of file diff --git a/1.4.44 b/1.4.44 deleted file mode 120000 index 278a281..0000000 --- a/1.4.44 +++ /dev/null @@ -1 +0,0 @@ -centos7-1.4.44 \ No newline at end of file diff --git a/1.6.2.24 b/1.6.2.24 deleted file mode 120000 index 8fa72d2..0000000 --- a/1.6.2.24 +++ /dev/null @@ -1 +0,0 @@ -centos7-1.6.2.24 \ No newline at end of file diff --git a/11-slim b/11-slim deleted file mode 120000 index 4ff09c4..0000000 --- a/11-slim +++ /dev/null @@ -1 +0,0 @@ -alpine-2.7-11.x \ No newline at end of file diff --git a/13-current b/13-current deleted file mode 120000 index a596653..0000000 --- a/13-current +++ /dev/null @@ -1 +0,0 @@ -debian-stretch-slim-13-current \ No newline at end of file diff --git a/14-current b/14-current deleted file mode 120000 index f5972ca..0000000 --- a/14-current +++ /dev/null @@ -1 +0,0 @@ -debian-stretch-slim-14-current \ No newline at end of file diff --git a/14-slim b/14-slim deleted file mode 120000 index 133bf64..0000000 --- a/14-slim +++ /dev/null @@ -1 +0,0 @@ -alpine-3.6-14.x \ No newline at end of file diff --git a/15-current b/15-current deleted file mode 120000 index 5b66ecc..0000000 --- a/15-current +++ /dev/null @@ -1 +0,0 @@ -debian-stretch-slim-15-current \ No newline at end of file diff --git a/15-slim b/15-slim deleted file mode 120000 index d9d1171..0000000 --- a/15-slim +++ /dev/null @@ -1 +0,0 @@ -alpine-3.9-15.x \ No newline at end of file diff --git a/16-current b/16-current deleted file mode 120000 index c19dc1a..0000000 --- a/16-current +++ /dev/null @@ -1 +0,0 @@ -debian-buster-slim-16-current \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..adcb1db --- /dev/null +++ b/Makefile @@ -0,0 +1,288 @@ +IMAGE_NAME := andrius/asterisk + +# : +# OR +# :,,,... +X86_IMAGES := \ + alpine/edge:edge \ + alpine/latest:latest \ + alpine/glibc:glibc_latest,alpine_glibc-16.x,glibc-16.x,alpine_glibc-16.3.0,glibc-16.3.0 \ + alpine/3.11:3.11-16.6.2,16.x \ + alpine/3.10:3.10-16.3.0 \ + alpine/3.9:3.9-15.7.4,15.x \ + alpine/3.8:3.8-15.6.2 \ + alpine/3.7:3.7-15.6.2 \ + alpine/3.6:3.6-14.7.8,14.x \ + alpine/3.5:3.5-14.7.8 \ + alpine/3.4:3.4-13.18.5,13.x \ + alpine/3.3:3.3-13.17.2 \ + alpine/3.2:3.2-13.3.2 \ + alpine/3.1:3.1-13.3.2 \ + alpine/2.7:2.7-11.25.1,11.x \ + alpine/2.6:2.6-11.6.1 \ + debian/17-current:17-current \ + debian/16-current:16-current \ + debian/16-certified:16-certified,16.3-cert \ + debian/13-current:13-current \ + debian/13-certified:13-certified,13.21-cert \ + debian/15.7.4:15.7.4 \ + debian/14.7.8:14.7.8 \ + debian/12.8.2:12.8.2 \ + debian/11.25.3:11.25.3 \ + debian/10.12.4:10.12.4 \ + debian/1.8.32.3:1.8.32.3 \ + debian/1.6.2.24:1.6.2.24 \ + debian/1.4.44:1.4.44 \ + centos/1.6.2.24:1.6.2.24 \ + centos/1.4.44:1.4.44 \ + centos/1.2.40:1.2.40 + +ALL_IMAGES := $(X86_IMAGES) + + + +# Default is first image from ALL_IMAGES list. +DOCKERFILE ?= $(word 1,$(subst :, ,$(word 1,$(ALL_IMAGES)))) +VERSION ?= $(word 1,$(subst $(comma), ,\ + $(word 2,$(subst :, ,$(word 1,$(ALL_IMAGES)))))) +TAGS ?= $(word 2,$(subst :, ,$(word 1,$(ALL_IMAGES)))) + +no-cache ?= no + +comma := , +empty := +space := $(empty) $(empty) +eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\ + $(findstring $(2),$(1))),1) + + + +# Default Makefile rule: +# Make manual release of all supported Docker images to Docker Hub. +# Usage: +# make all [no-cache=(yes|no)] + +all: | release-all + + + +# Make manual release of all supported Docker images to Docker Hub. +# +# Usage: +# make release-all [no-cache=(yes|no)] + +release-all: + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make release no-cache=$(no-cache) \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) \ + VERSION=$(word 1,$(subst $(comma), ,\ + $(word 2,$(subst :, ,$(img))))) \ + TAGS=$(word 2,$(subst :, ,$(img))) ; \ + )) + + + +# Make manual release of Docker images to Docker Hub. +# +# Usage: +# make release [no-cache=(yes|no)] [DOCKERFILE=] [VERSION=] [TAGS=t1,t2,...] + +release: | post-push-hook post-checkout-hook image tags test push + + + +# Build all supported Docker images. +# +# Usage: +# make image-all + +image-all: + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make image no-cache=$(no-cache) \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) \ + VERSION=$(word 1,$(subst $(comma), ,\ + $(word 2,$(subst :, ,$(img))))) ; \ + )) + + + +# Build Docker image. +# +# Usage: +# make image [no-cache=(yes|no)] [DOCKERFILE=] [VERSION=] + +no-cache-arg = $(if $(call eq, $(no-cache), yes), --no-cache, $(empty)) + +image: + docker build $(no-cache-arg) -t $(IMAGE_NAME):$(VERSION) $(DOCKERFILE) --build-arg VERSION=$(VERSION) + + + +# Tag Docker image with given tags. +# +# Usage: +# make tags [VERSION=] [TAGS=t1,t2,...] + +parsed-tags = $(subst $(comma), $(space), $(TAGS)) + +tags: + (set -e ; $(foreach tag, $(parsed-tags), \ + docker tag $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):$(tag) ; \ + )) + + + +# Manually push all supported Docker images to Docker Hub. + +push-all: + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make push \ + TAGS=$(word 2,$(subst :, ,$(img))) ; \ + )) + + + +# Manually push Docker images to Docker Hub. +# +# Usage: +# make push [TAGS=t1,t2,...] + +push: + (set -e ; $(foreach tag, $(parsed-tags), \ + docker push $(IMAGE_NAME):$(tag) ; \ + docker rmi ${IMAGE_NAME}:${tag} ; \ + )) + + + +# Create `post_push` Docker Hub hook. +# +# When Docker Hub triggers automated build all the tags defined in `post_push` +# hook will be assigned to built image. It allows to link the same image with +# different tags, and not to build identical image for each tag separately. +# See details: +# http://windsock.io/automated-docker-image-builds-with-multiple-tags +# +# Usage: +# make post-push-hook [DOCKERFILE=] [TAGS=t1,t2,...] + +post-push-hook: + mkdir -p $(DOCKERFILE)/hooks + docker run --rm -i -v $(PWD)/post_push.erb:/post_push.erb:ro \ + ruby:alpine erb -U \ + image_tags='$(TAGS)' \ + /post_push.erb > $(DOCKERFILE)/hooks/post_push + + + +# Create `post_push` Docker Hub hook for all supported Docker images. +# +# Usage: +# make post-push-hook-all + +post-push-hook-all: + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make post-push-hook \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) \ + TAGS=$(word 2,$(subst :, ,$(img))) ; \ + )) + + + +# Create `post_checkout` Docker Hub hook. +# +# When Docker Hub triggers automated build, the `post_checkout` hook is called +# after the Git repo is checked out. This can be used to set up prerequisites +# for, for example, cross-platform builds. +# See details: +# https://docs.docker.com/docker-cloud/builds/advanced/#build-hook-examples +# +# Usage: +# make post-checkout-hook [DOCKERFILE=] + +post-checkout-hook: + if [ -n "$(findstring /armhf/,$(DOCKERFILE))" ]; then \ + mkdir -p $(DOCKERFILE)/hooks; \ + docker run --rm -i -v $(PWD)/post_checkout.erb:/post_checkout.erb:ro \ + ruby:alpine erb -U \ + dockerfile='$(DOCKERFILE)' \ + /post_checkout.erb > $(DOCKERFILE)/hooks/post_checkout ; \ + fi + + +# Create `post_push` Docker Hub hook for all supported Docker images. +# +# Usage: +# make post-checkout-hook-all + +post-checkout-hook-all: + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make post-checkout-hook \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) ; \ + )) + + + +# Run tests for all supported Docker images. +# +# Usage: +# make test-all [prepare-images=(no|yes)] + +prepare-images ?= no + +test-all: +ifeq ($(prepare-images),yes) + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make image no-cache=$(no-cache) \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) \ + VERSION=$(word 1,$(subst $(comma), ,\ + $(word 2,$(subst :, ,$(img))))) ; \ + )) +endif + (set -e ; $(foreach img,$(ALL_IMAGES), \ + make test \ + DOCKERFILE=$(word 1,$(subst :, ,$(img))) \ + VERSION=$(word 1,$(subst $(comma), ,\ + $(word 2,$(subst :, ,$(img))))) ; \ + )) + + + +# Run tests for Docker image. +# +# Usage: +# make test [DOCKERFILE=] [VERSION=] + +test: deps.bats + DOCKERFILE=$(DOCKERFILE) IMAGE=$(IMAGE_NAME):$(VERSION) \ + ./test/bats/bats test/asterisk.bats + + + +# Resolve project dependencies for running Bats tests. +# +# Usage: +# make deps.bats [BATS_VER=] + +BATS_VER ?= 0.4.0 + +deps.bats: +ifeq ($(wildcard $(PWD)/test/bats),) + mkdir -p $(PWD)/test/bats/vendor + wget https://github.com/sstephenson/bats/archive/v$(BATS_VER).tar.gz \ + -O $(PWD)/test/bats/vendor/bats.tar.gz + tar -xzf $(PWD)/test/bats/vendor/bats.tar.gz \ + -C $(PWD)/test/bats/vendor + rm -f $(PWD)/test/bats/vendor/bats.tar.gz + ln -s $(PWD)/test/bats/vendor/bats-$(BATS_VER)/libexec/* \ + $(PWD)/test/bats/ +endif + + + +.PHONY: image tags push \ + image-all tags-all push-all \ + release release-all \ + post-push-hook post-push-hook-all \ + post-checkout-hook post-checkout-hook-all \ + test test-all deps.bats diff --git a/alpine/2.6/Dockerfile b/alpine/2.6/Dockerfile new file mode 100644 index 0000000..1b2f940 --- /dev/null +++ b/alpine/2.6/Dockerfile @@ -0,0 +1,25 @@ +# vim:set ft=dockerfile: +FROM alpine:2.6 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 ast \ +&& sleep 1 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine-2.6-11.6.1/docker-entrypoint.sh b/alpine/2.6/docker-entrypoint.sh similarity index 100% rename from alpine-2.6-11.6.1/docker-entrypoint.sh rename to alpine/2.6/docker-entrypoint.sh diff --git a/alpine/2.6/hooks/post_push b/alpine/2.6/hooks/post_push new file mode 100644 index 0000000..d21527e --- /dev/null +++ b/alpine/2.6/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {2.6-11.6.1}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/2.7/Dockerfile b/alpine/2.7/Dockerfile new file mode 100644 index 0000000..a0dfd4c --- /dev/null +++ b/alpine/2.7/Dockerfile @@ -0,0 +1,25 @@ +# vim:set ft=dockerfile: +FROM alpine:2.7 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 ast \ +&& sleep 1 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine-2.7-11.x/docker-entrypoint.sh b/alpine/2.7/docker-entrypoint.sh similarity index 100% rename from alpine-2.7-11.x/docker-entrypoint.sh rename to alpine/2.7/docker-entrypoint.sh diff --git a/alpine/2.7/hooks/post_push b/alpine/2.7/hooks/post_push new file mode 100644 index 0000000..87afb3e --- /dev/null +++ b/alpine/2.7/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {2.7-11.25.1,11.x}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/3.1/Dockerfile b/alpine/3.1/Dockerfile new file mode 100644 index 0000000..a862287 --- /dev/null +++ b/alpine/3.1/Dockerfile @@ -0,0 +1,26 @@ +# vim:set ft=dockerfile: +FROM alpine:3.1 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 ast \ +&& sleep 1 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine-3.10-16.x/docker-entrypoint.sh b/alpine/3.1/docker-entrypoint.sh similarity index 100% rename from alpine-3.10-16.x/docker-entrypoint.sh rename to alpine/3.1/docker-entrypoint.sh diff --git a/alpine/3.1/hooks/post_push b/alpine/3.1/hooks/post_push new file mode 100644 index 0000000..e53596a --- /dev/null +++ b/alpine/3.1/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.1-13.3.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-3.10-16.x/Dockerfile b/alpine/3.10/Dockerfile similarity index 100% rename from alpine-3.10-16.x/Dockerfile rename to alpine/3.10/Dockerfile diff --git a/alpine-3.6-14.x/docker-entrypoint.sh b/alpine/3.10/docker-entrypoint.sh similarity index 100% rename from alpine-3.6-14.x/docker-entrypoint.sh rename to alpine/3.10/docker-entrypoint.sh diff --git a/alpine/3.10/hooks/post_push b/alpine/3.10/hooks/post_push new file mode 100644 index 0000000..066632b --- /dev/null +++ b/alpine/3.10/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.10-16.3.0}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/3.11/Dockerfile b/alpine/3.11/Dockerfile new file mode 100644 index 0000000..3ddd0a8 --- /dev/null +++ b/alpine/3.11/Dockerfile @@ -0,0 +1,29 @@ +# vim:set ft=dockerfile: +FROM alpine:3.11 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 asterisk \ +&& pkill -9 astcanary \ +&& sleep 2 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk/fax \ +&& truncate -s 0 /var/log/asterisk/messages \ + /var/log/asterisk/queue_log \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine-3.7-15.x/docker-entrypoint.sh b/alpine/3.11/docker-entrypoint.sh similarity index 100% rename from alpine-3.7-15.x/docker-entrypoint.sh rename to alpine/3.11/docker-entrypoint.sh diff --git a/alpine/3.11/hooks/post_push b/alpine/3.11/hooks/post_push new file mode 100644 index 0000000..fa6ac9e --- /dev/null +++ b/alpine/3.11/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.11-16.6.2,16.x}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/3.2/Dockerfile b/alpine/3.2/Dockerfile new file mode 100644 index 0000000..3d7e33e --- /dev/null +++ b/alpine/3.2/Dockerfile @@ -0,0 +1,26 @@ +# vim:set ft=dockerfile: +FROM alpine:3.2 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 ast \ +&& sleep 1 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine-3.8-15.x/docker-entrypoint.sh b/alpine/3.2/docker-entrypoint.sh similarity index 100% rename from alpine-3.8-15.x/docker-entrypoint.sh rename to alpine/3.2/docker-entrypoint.sh diff --git a/alpine/3.2/hooks/post_push b/alpine/3.2/hooks/post_push new file mode 100644 index 0000000..b606fcc --- /dev/null +++ b/alpine/3.2/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.2-13.3.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-2.6-11.6.1/Dockerfile b/alpine/3.3/Dockerfile similarity index 78% rename from alpine-2.6-11.6.1/Dockerfile rename to alpine/3.3/Dockerfile index a50ded6..b9ded8c 100644 --- a/alpine-2.6-11.6.1/Dockerfile +++ b/alpine/3.3/Dockerfile @@ -1,18 +1,22 @@ # vim:set ft=dockerfile: -FROM alpine:2.6 +FROM alpine:3.3 MAINTAINER Andrius Kairiukstis RUN apk add --update \ asterisk \ asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ && asterisk -U asterisk \ && sleep 5 \ && pkill -9 asterisk \ +&& pkill -9 astcanary \ && sleep 2 \ && rm -rf /var/run/asterisk/* \ && mkdir -p /var/spool/asterisk/fax \ && chown -R asterisk: /var/spool/asterisk/fax \ +&& truncate -s 0 /var/log/asterisk/messages \ + /var/log/asterisk/queue_log \ && rm -rf /var/cache/apk/* \ /tmp/* \ /var/tmp/* diff --git a/alpine-3.9-15.x/docker-entrypoint.sh b/alpine/3.3/docker-entrypoint.sh similarity index 100% rename from alpine-3.9-15.x/docker-entrypoint.sh rename to alpine/3.3/docker-entrypoint.sh diff --git a/alpine/3.3/hooks/post_push b/alpine/3.3/hooks/post_push new file mode 100644 index 0000000..b3f07c9 --- /dev/null +++ b/alpine/3.3/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.3-13.17.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-2.7-11.x/Dockerfile b/alpine/3.4/Dockerfile similarity index 78% rename from alpine-2.7-11.x/Dockerfile rename to alpine/3.4/Dockerfile index c12a14b..d92ef89 100644 --- a/alpine-2.7-11.x/Dockerfile +++ b/alpine/3.4/Dockerfile @@ -1,18 +1,22 @@ # vim:set ft=dockerfile: -FROM alpine:2.7 +FROM alpine:3.4 MAINTAINER Andrius Kairiukstis RUN apk add --update \ asterisk \ asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ && asterisk -U asterisk \ && sleep 5 \ && pkill -9 asterisk \ +&& pkill -9 astcanary \ && sleep 2 \ && rm -rf /var/run/asterisk/* \ && mkdir -p /var/spool/asterisk/fax \ && chown -R asterisk: /var/spool/asterisk/fax \ +&& truncate -s 0 /var/log/asterisk/messages \ + /var/log/asterisk/queue_log \ && rm -rf /var/cache/apk/* \ /tmp/* \ /var/tmp/* diff --git a/alpine-latest/docker-entrypoint.sh b/alpine/3.4/docker-entrypoint.sh similarity index 100% rename from alpine-latest/docker-entrypoint.sh rename to alpine/3.4/docker-entrypoint.sh diff --git a/alpine/3.4/hooks/post_push b/alpine/3.4/hooks/post_push new file mode 100644 index 0000000..89398f4 --- /dev/null +++ b/alpine/3.4/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.4-13.18.5,13.x}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/3.5/Dockerfile b/alpine/3.5/Dockerfile new file mode 100644 index 0000000..14d70f1 --- /dev/null +++ b/alpine/3.5/Dockerfile @@ -0,0 +1,29 @@ +# vim:set ft=dockerfile: +FROM alpine:3.5 + +MAINTAINER Andrius Kairiukstis + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& rm -rf /usr/lib/asterisk/modules/*pjsip* \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 asterisk \ +&& pkill -9 astcanary \ +&& sleep 2 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk/fax \ +&& truncate -s 0 /var/log/asterisk/messages \ + /var/log/asterisk/queue_log \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/debian-stretch-slim-17-current/docker-entrypoint.sh b/alpine/3.5/docker-entrypoint.sh similarity index 54% rename from debian-stretch-slim-17-current/docker-entrypoint.sh rename to alpine/3.5/docker-entrypoint.sh index a82f419..f08b45e 100755 --- a/debian-stretch-slim-17-current/docker-entrypoint.sh +++ b/alpine/3.5/docker-entrypoint.sh @@ -2,6 +2,7 @@ # run as user asterisk by default ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} if [ "$1" = "" ]; then COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" @@ -14,11 +15,13 @@ if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders deluser asterisk && \ - adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} || exit - - chown -R ${ASTERISK_UID}:${ASTERISK_UID} /etc/asterisk \ - /var/*/asterisk \ - /usr/*/asterisk + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit fi +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ exec ${COMMAND} diff --git a/alpine/3.5/hooks/post_push b/alpine/3.5/hooks/post_push new file mode 100644 index 0000000..beb6a15 --- /dev/null +++ b/alpine/3.5/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.5-14.7.8}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-3.6-14.x/Dockerfile b/alpine/3.6/Dockerfile similarity index 100% rename from alpine-3.6-14.x/Dockerfile rename to alpine/3.6/Dockerfile diff --git a/alpine/3.6/docker-entrypoint.sh b/alpine/3.6/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/3.6/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/3.6/hooks/post_push b/alpine/3.6/hooks/post_push new file mode 100644 index 0000000..d8452f5 --- /dev/null +++ b/alpine/3.6/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.6-14.7.8,14.x}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-3.7-15.x/Dockerfile b/alpine/3.7/Dockerfile similarity index 100% rename from alpine-3.7-15.x/Dockerfile rename to alpine/3.7/Dockerfile diff --git a/alpine/3.7/docker-entrypoint.sh b/alpine/3.7/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/3.7/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/3.7/hooks/post_push b/alpine/3.7/hooks/post_push new file mode 100644 index 0000000..280c25a --- /dev/null +++ b/alpine/3.7/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.7-15.6.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-3.8-15.x/Dockerfile b/alpine/3.8/Dockerfile similarity index 100% rename from alpine-3.8-15.x/Dockerfile rename to alpine/3.8/Dockerfile diff --git a/alpine/3.8/docker-entrypoint.sh b/alpine/3.8/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/3.8/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/3.8/hooks/post_push b/alpine/3.8/hooks/post_push new file mode 100644 index 0000000..8397e76 --- /dev/null +++ b/alpine/3.8/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.8-15.6.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-3.9-15.x/Dockerfile b/alpine/3.9/Dockerfile similarity index 100% rename from alpine-3.9-15.x/Dockerfile rename to alpine/3.9/Dockerfile diff --git a/alpine/3.9/docker-entrypoint.sh b/alpine/3.9/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/3.9/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/3.9/hooks/post_push b/alpine/3.9/hooks/post_push new file mode 100644 index 0000000..0fc0c27 --- /dev/null +++ b/alpine/3.9/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {3.9-15.7.4,15.x}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-edge/Dockerfile b/alpine/edge/Dockerfile similarity index 100% rename from alpine-edge/Dockerfile rename to alpine/edge/Dockerfile diff --git a/alpine-edge/docker-entrypoint.sh b/alpine/edge/docker-entrypoint.sh similarity index 100% rename from alpine-edge/docker-entrypoint.sh rename to alpine/edge/docker-entrypoint.sh diff --git a/alpine/edge/hooks/post_push b/alpine/edge/hooks/post_push new file mode 100644 index 0000000..0ba0aeb --- /dev/null +++ b/alpine/edge/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {edge}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine/glibc/Dockerfile b/alpine/glibc/Dockerfile new file mode 100644 index 0000000..6bcd86c --- /dev/null +++ b/alpine/glibc/Dockerfile @@ -0,0 +1,28 @@ +# vim:set ft=dockerfile: +FROM frolvlad/alpine-glibc + +LABEL maintainer="Andrius Kairiukstis " + +RUN apk add --update \ + asterisk \ + asterisk-sample-config \ +&& asterisk -U asterisk \ +&& sleep 5 \ +&& pkill -9 asterisk \ +&& pkill -9 astcanary \ +&& sleep 2 \ +&& rm -rf /var/run/asterisk/* \ +&& mkdir -p /var/spool/asterisk/fax \ +&& chown -R asterisk: /var/spool/asterisk/fax \ +&& truncate -s 0 /var/log/asterisk/messages \ + /var/log/asterisk/queue_log \ +&& rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +ADD docker-entrypoint.sh /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/alpine/glibc/docker-entrypoint.sh b/alpine/glibc/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/glibc/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/glibc/hooks/post_push b/alpine/glibc/hooks/post_push new file mode 100644 index 0000000..0b3358a --- /dev/null +++ b/alpine/glibc/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {glibc_latest,alpine_glibc-16.x,glibc-16.x,alpine_glibc-16.3.0,glibc-16.3.0}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/alpine-latest/Dockerfile b/alpine/latest/Dockerfile similarity index 100% rename from alpine-latest/Dockerfile rename to alpine/latest/Dockerfile diff --git a/alpine/latest/docker-entrypoint.sh b/alpine/latest/docker-entrypoint.sh new file mode 100755 index 0000000..f08b45e --- /dev/null +++ b/alpine/latest/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} +ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \ + adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/alpine/latest/hooks/post_push b/alpine/latest/hooks/post_push new file mode 100644 index 0000000..922f7c1 --- /dev/null +++ b/alpine/latest/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {latest}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/centos7-1.2.40/Dockerfile b/centos/1.2.40/Dockerfile similarity index 100% rename from centos7-1.2.40/Dockerfile rename to centos/1.2.40/Dockerfile diff --git a/centos7-1.2.40/build-asterisk.sh b/centos/1.2.40/build-asterisk.sh similarity index 100% rename from centos7-1.2.40/build-asterisk.sh rename to centos/1.2.40/build-asterisk.sh diff --git a/debian-stretch-slim-13-current/docker-entrypoint.sh b/centos/1.2.40/docker-entrypoint.sh similarity index 96% rename from debian-stretch-slim-13-current/docker-entrypoint.sh rename to centos/1.2.40/docker-entrypoint.sh index f1f82f4..bda766e 100755 --- a/debian-stretch-slim-13-current/docker-entrypoint.sh +++ b/centos/1.2.40/docker-entrypoint.sh @@ -18,6 +18,8 @@ if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then || exit fi +mkdir -p /var/run/asterisk + chown -R ${ASTERISK_USER}: /var/log/asterisk \ /var/lib/asterisk \ /var/run/asterisk \ diff --git a/centos/1.2.40/hooks/post_push b/centos/1.2.40/hooks/post_push new file mode 100644 index 0000000..b3d218f --- /dev/null +++ b/centos/1.2.40/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.2.40}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/centos7-1.4.44/Dockerfile b/centos/1.4.44/Dockerfile similarity index 100% rename from centos7-1.4.44/Dockerfile rename to centos/1.4.44/Dockerfile diff --git a/centos7-1.4.44/build-asterisk.sh b/centos/1.4.44/build-asterisk.sh similarity index 100% rename from centos7-1.4.44/build-asterisk.sh rename to centos/1.4.44/build-asterisk.sh diff --git a/debian-stretch-slim-14-current/docker-entrypoint.sh b/centos/1.4.44/docker-entrypoint.sh similarity index 96% rename from debian-stretch-slim-14-current/docker-entrypoint.sh rename to centos/1.4.44/docker-entrypoint.sh index f1f82f4..bda766e 100755 --- a/debian-stretch-slim-14-current/docker-entrypoint.sh +++ b/centos/1.4.44/docker-entrypoint.sh @@ -18,6 +18,8 @@ if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then || exit fi +mkdir -p /var/run/asterisk + chown -R ${ASTERISK_USER}: /var/log/asterisk \ /var/lib/asterisk \ /var/run/asterisk \ diff --git a/centos/1.4.44/hooks/post_push b/centos/1.4.44/hooks/post_push new file mode 100644 index 0000000..c0442d1 --- /dev/null +++ b/centos/1.4.44/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.4.44}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/centos7-1.6.2.24/Dockerfile b/centos/1.6.2.24/Dockerfile similarity index 100% rename from centos7-1.6.2.24/Dockerfile rename to centos/1.6.2.24/Dockerfile diff --git a/centos7-1.6.2.24/build-asterisk.sh b/centos/1.6.2.24/build-asterisk.sh similarity index 100% rename from centos7-1.6.2.24/build-asterisk.sh rename to centos/1.6.2.24/build-asterisk.sh diff --git a/debian-stretch-slim-15-current/docker-entrypoint.sh b/centos/1.6.2.24/docker-entrypoint.sh similarity index 96% rename from debian-stretch-slim-15-current/docker-entrypoint.sh rename to centos/1.6.2.24/docker-entrypoint.sh index f1f82f4..bda766e 100755 --- a/debian-stretch-slim-15-current/docker-entrypoint.sh +++ b/centos/1.6.2.24/docker-entrypoint.sh @@ -18,6 +18,8 @@ if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then || exit fi +mkdir -p /var/run/asterisk + chown -R ${ASTERISK_USER}: /var/log/asterisk \ /var/lib/asterisk \ /var/run/asterisk \ diff --git a/centos/1.6.2.24/hooks/post_push b/centos/1.6.2.24/hooks/post_push new file mode 100644 index 0000000..815f698 --- /dev/null +++ b/centos/1.6.2.24/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.6.2.24}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-slim-16-current/Dockerfile b/debian-stretch-slim-16-current/Dockerfile deleted file mode 100644 index 1cf08da..0000000 --- a/debian-stretch-slim-16-current/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# vim:set ft=dockerfile: -FROM debian:stretch-slim - -LABEL maintainer="Andrius Kairiukstis " - -ENV ASTERISK_VERSION 16-current -ENV OPUS_CODEC asterisk-16.0/x86-64/codec_opus-16.0_current-x86_64 - -COPY build-asterisk.sh / -RUN /build-asterisk.sh - -EXPOSE 5060/udp 5060/tcp -VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk - -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"] diff --git a/debian-stretch-slim-17-current/Dockerfile-centos b/debian-stretch-slim-17-current/Dockerfile-centos deleted file mode 100644 index 0257721..0000000 --- a/debian-stretch-slim-17-current/Dockerfile-centos +++ /dev/null @@ -1,145 +0,0 @@ -FROM centos:6 - -MAINTAINER Andrius Kairiukstis - -RUN yum -y install gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel openssl-devel \ - newt-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel sqlite-devel curl bison supervisor \ - && mkdir /tmp/asterisk \ - && curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \ - && tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \ - && cd /tmp/asterisk \ - && ./configure --libdir=/usr/lib64 \ - && make menuselect \ - && menuselect/menuselect \ - --disable-all \ - --disable-category MENUSELECT_ADDONS \ - --disable-category MENUSELECT_APPS \ - --disable-category MENUSELECT_BRIDGES \ - --disable-category MENUSELECT_CDR \ - --disable-category MENUSELECT_CEL \ - --disable-category MENUSELECT_CHANNELS \ - --enable-category MENUSELECT_CODECS \ - --enable-category MENUSELECT_FORMATS \ - --disable-category MENUSELECT_FUNCS \ - --disable-category MENUSELECT_PBX \ - --disable-category MENUSELECT_RES \ - --disable-category MENUSELECT_TESTS \ - --disable-category MENUSELECT_UTILS \ - --disable-category MENUSELECT_AGIS \ - --disable-category MENUSELECT_EMBED \ - --enable-category MENUSELECT_CORE_SOUNDS \ - --enable-category MENUSELECT_MOH \ - --enable-category MENUSELECT_EXTRA_SOUNDS \ - --disable-category MENUSELECT_TESTS \ - --enable-category MENUSELECT_OPTS_app_voicemail \ - --enable func_module \ - --enable LOADABLE_MODULES \ - --enable FILE_STORAGE \ - --disable codec_dahdi \ - --enable app_dial \ - --enable app_exec \ - --enable app_originate \ - --enable app_verbose \ - --enable chan_sip \ - --enable pbx_config \ - --enable res_agi \ - --enable res_convert \ - --enable res_musiconhold \ - --enable res_timing_timerfd \ - --disable BUILD_NATIVE \ - menuselect.makeopts \ - && make config \ - && make \ - && make install \ - && mkdir -p /var/lib/asterisk/phoneprov \ - && make samples \ - && make dist-clean \ - && sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \ - && cd .. \ - && rm /tmp/asterisk.tar.gz \ - && rm -rf /tmp/asterisk \ - && yum -y clean all \ - && rm -rf /var/cache/yum/* - - -# RUN yum -y update \ -# && yum -y install epel-release \ -# && yum -y install kernel-headers gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel sqlite sqlite-devel \ -# mysql-devel openssl-devel newt-devel kernel-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel \ -# curl pcre-devel bison mysql-devel ngrep tmux \ -# && mkdir /tmp/asterisk \ -# && curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \ -# && tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \ -# && cd /tmp/asterisk \ -# && ./configure --libdir=/usr/lib64 \ -# && make menuselect \ -# && menuselect/menuselect \ -# --disable-category MENUSELECT_ADDONS \ -# --disable-category MENUSELECT_APPS \ -# --disable-category MENUSELECT_BRIDGES \ -# --disable-category MENUSELECT_CDR \ -# --disable-category MENUSELECT_CEL \ -# --disable-category MENUSELECT_CHANNELS \ -# --enable-category MENUSELECT_CODECS \ -# --enable-category MENUSELECT_FORMATS \ -# --disable-category MENUSELECT_FUNCS \ -# --disable-category MENUSELECT_PBX \ -# --disable-category MENUSELECT_RES \ -# --disable-category MENUSELECT_TESTS \ -# --disable-category MENUSELECT_OPTS_app_voicemail \ -# --disable-category MENUSELECT_UTILS \ -# --disable-category MENUSELECT_AGIS \ -# --disable-category MENUSELECT_EMBED \ -# --disable-category MENUSELECT_CORE_SOUNDS \ -# --disable-category MENUSELECT_MOH \ -# --disable-category MENUSELECT_EXTRA_SOUNDS \ -# --enable app_controlplayback \ -# --enable app_dial \ -# --enable app_exec \ -# --enable app_originate \ -# --enable app_queue \ -# --enable app_record \ -# --enable app_senddtmf \ -# --enable app_stasis \ -# --enable app_verbose \ -# --enable app_waituntil \ -# --enable chan_sip \ -# --enable pbx_config \ -# --enable pbx_realtime \ -# --enable res_agi \ -# --enable res_ari \ -# --enable res_ari_channels \ -# --enable res_ari_events \ -# --enable res_ari_playbacks \ -# --enable res_ari_recordings \ -# --enable res_ari_sounds \ -# --enable res_ari_device_states \ -# --enable res_realtime \ -# --enable res_rtp_asterisk \ -# --enable res_rtp_multicast \ -# --enable res_stasis \ -# --enable res_stasis_answer \ -# --enable res_stasis_device_state \ -# --enable res_stasis_playback \ -# --enable res_stasis_recording \ -# --enable res_stun_monitor \ -# --enable res_timing_timerfd \ -# --enable func_callcompletion \ -# --enable func_callerid \ -# --disable BUILD_NATIVE \ -# menuselect.makeopts \ -# && make config \ -# && make \ -# && make install \ -# && mkdir -p /var/lib/asterisk/phoneprov \ -# && make samples \ -# && make dist-clean \ -# && sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \ -# && cd .. \ -# && rm /tmp/asterisk.tar.gz \ -# && rm -rf /tmp/asterisk \ -# && yum -y clean all \ -# && rm -rf /var/cache/yum/* -# -# CMD asterisk -fvvvvv - diff --git a/debian-stretch-slim-17-current/build-asterisk.sh b/debian-stretch-slim-17-current/build-asterisk.sh deleted file mode 100755 index cd88e25..0000000 --- a/debian-stretch-slim-17-current/build-asterisk.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -PROGNAME=$(basename $0) - -if test -z ${ASTERISK_VERSION}; then - echo "${PROGNAME}: ASTERISK_VERSION required" >&2 - exit 1 -fi - -set -ex - -useradd --system asterisk - -apt-get update -qq -DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ - autoconf \ - binutils-dev \ - build-essential \ - ca-certificates \ - curl \ - file \ - libcurl4-openssl-dev \ - libedit-dev \ - libgsm1-dev \ - libogg-dev \ - libpopt-dev \ - libresample1-dev \ - libspandsp-dev \ - libspeex-dev \ - libspeexdsp-dev \ - libsqlite3-dev \ - libsrtp0-dev \ - libssl-dev \ - libvorbis-dev \ - libxml2-dev \ - libxslt1-dev \ - procps \ - portaudio19-dev \ - unixodbc \ - unixodbc-bin \ - unixodbc-dev \ - odbcinst \ - uuid \ - uuid-dev \ - xmlstarlet - -apt-get purge -y --auto-remove -rm -rf /var/lib/apt/lists/* - -mkdir -p /usr/src/asterisk -cd /usr/src/asterisk - -curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ -curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ -curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz - -# 1.5 jobs per core works out okay -: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} - -./configure --with-resample \ - --with-pjproject-bundled \ - --with-jansson-bundled -make menuselect/menuselect menuselect-tree menuselect.makeopts - -# disable BUILD_NATIVE to avoid platform issues -menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts - -# enable good things -menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts - -# codecs -# menuselect/menuselect --enable codec_opus menuselect.makeopts -# menuselect/menuselect --enable codec_silk menuselect.makeopts - -# # download more sounds -# for i in CORE-SOUNDS-EN MOH-OPSOUND EXTRA-SOUNDS-EN; do -# for j in ULAW ALAW G722 GSM SLN16; do -# menuselect/menuselect --enable $i-$j menuselect.makeopts -# done -# done - -# we don't need any sounds in docker, they will be mounted as volume -menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS -menuselect/menuselect --disable-category MENUSELECT_MOH -menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS - -make -j ${JOBS} all -make install - -# copy default configs -# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/ -make samples - -# set runuser and rungroup -sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf - -# Install opus, for some reason menuselect option above does not working -mkdir -p /usr/src/codecs/opus \ - && cd /usr/src/codecs/opus \ - && curl -vsL http://downloads.digium.com/pub/telephony/codec_opus/${OPUS_CODEC}.tar.gz | tar --strip-components 1 -xz \ - && cp *.so /usr/lib/asterisk/modules/ \ - && cp codec_opus_config-en_US.xml /var/lib/asterisk/documentation/ - -mkdir -p /etc/asterisk/ \ - /var/spool/asterisk/fax - -chown -R asterisk:asterisk /etc/asterisk \ - /var/*/asterisk \ - /usr/*/asterisk -chmod -R 750 /var/spool/asterisk - -cd / -rm -rf /usr/src/asterisk \ - /usr/src/codecs - -# remove *-dev packages -devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs` -DEBIAN_FRONTEND=noninteractive apt-get --yes purge \ - autoconf \ - build-essential \ - bzip2 \ - cpp \ - m4 \ - make \ - patch \ - perl \ - perl-modules \ - pkg-config \ - xz-utils \ - ${devpackages} -rm -rf /var/lib/apt/lists/* - -exec rm -f /build-asterisk.sh diff --git a/debian-jessie-slim-1.4.44/Dockerfile b/debian/1.4.44/Dockerfile similarity index 100% rename from debian-jessie-slim-1.4.44/Dockerfile rename to debian/1.4.44/Dockerfile diff --git a/debian-jessie-slim-1.4.44/build-asterisk.sh b/debian/1.4.44/build-asterisk.sh similarity index 100% rename from debian-jessie-slim-1.4.44/build-asterisk.sh rename to debian/1.4.44/build-asterisk.sh diff --git a/centos7-1.2.40/docker-entrypoint.sh b/debian/1.4.44/docker-entrypoint.sh similarity index 100% rename from centos7-1.2.40/docker-entrypoint.sh rename to debian/1.4.44/docker-entrypoint.sh diff --git a/debian/1.4.44/hooks/post_push b/debian/1.4.44/hooks/post_push new file mode 100644 index 0000000..c0442d1 --- /dev/null +++ b/debian/1.4.44/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.4.44}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-jessie-slim-1.6.2.24/Dockerfile b/debian/1.6.2.24/Dockerfile similarity index 100% rename from debian-jessie-slim-1.6.2.24/Dockerfile rename to debian/1.6.2.24/Dockerfile diff --git a/debian-jessie-slim-1.6.2.24/build-asterisk.sh b/debian/1.6.2.24/build-asterisk.sh similarity index 96% rename from debian-jessie-slim-1.6.2.24/build-asterisk.sh rename to debian/1.6.2.24/build-asterisk.sh index cfa6e58..02dd2f7 100755 --- a/debian-jessie-slim-1.6.2.24/build-asterisk.sh +++ b/debian/1.6.2.24/build-asterisk.sh @@ -54,9 +54,6 @@ curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/aste cd /usr/src/asterisk curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz -# 1.5 jobs per core works out okay -: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} - mkdir -p /etc/asterisk/ \ /var/spool/asterisk/fax @@ -68,7 +65,7 @@ menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect.makeo menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts -make -j ${JOBS} all +make all make install # copy default configs diff --git a/centos7-1.4.44/docker-entrypoint.sh b/debian/1.6.2.24/docker-entrypoint.sh similarity index 100% rename from centos7-1.4.44/docker-entrypoint.sh rename to debian/1.6.2.24/docker-entrypoint.sh diff --git a/debian/1.6.2.24/hooks/post_push b/debian/1.6.2.24/hooks/post_push new file mode 100644 index 0000000..815f698 --- /dev/null +++ b/debian/1.6.2.24/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.6.2.24}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-jessie-slim-1.8.32.3/Dockerfile b/debian/1.8.32.3/Dockerfile similarity index 100% rename from debian-jessie-slim-1.8.32.3/Dockerfile rename to debian/1.8.32.3/Dockerfile diff --git a/debian-jessie-slim-11.25.3/build-asterisk.sh b/debian/1.8.32.3/build-asterisk.sh similarity index 96% rename from debian-jessie-slim-11.25.3/build-asterisk.sh rename to debian/1.8.32.3/build-asterisk.sh index 289c3da..0eb0cb2 100755 --- a/debian-jessie-slim-11.25.3/build-asterisk.sh +++ b/debian/1.8.32.3/build-asterisk.sh @@ -53,9 +53,6 @@ curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz -# 1.5 jobs per core works out okay -: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} - ./configure --with-resample --with-pjproject-bundled make menuselect/menuselect menuselect-tree menuselect.makeopts @@ -77,7 +74,7 @@ menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect/menuselect --disable-category MENUSELECT_MOH menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS -make -j ${JOBS} all +make all make install # copy default configs diff --git a/centos7-1.6.2.24/docker-entrypoint.sh b/debian/1.8.32.3/docker-entrypoint.sh similarity index 100% rename from centos7-1.6.2.24/docker-entrypoint.sh rename to debian/1.8.32.3/docker-entrypoint.sh diff --git a/debian/1.8.32.3/hooks/post_push b/debian/1.8.32.3/hooks/post_push new file mode 100644 index 0000000..d4f8050 --- /dev/null +++ b/debian/1.8.32.3/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {1.8.32.3}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-jessie-slim-10.12.4/Dockerfile b/debian/10.12.4/Dockerfile similarity index 100% rename from debian-jessie-slim-10.12.4/Dockerfile rename to debian/10.12.4/Dockerfile diff --git a/debian-jessie-slim-12.8.2/build-asterisk.sh b/debian/10.12.4/build-asterisk.sh similarity index 96% rename from debian-jessie-slim-12.8.2/build-asterisk.sh rename to debian/10.12.4/build-asterisk.sh index 289c3da..0eb0cb2 100755 --- a/debian-jessie-slim-12.8.2/build-asterisk.sh +++ b/debian/10.12.4/build-asterisk.sh @@ -53,9 +53,6 @@ curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz -# 1.5 jobs per core works out okay -: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} - ./configure --with-resample --with-pjproject-bundled make menuselect/menuselect menuselect-tree menuselect.makeopts @@ -77,7 +74,7 @@ menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect/menuselect --disable-category MENUSELECT_MOH menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS -make -j ${JOBS} all +make all make install # copy default configs diff --git a/debian-buster-certified-13.21-cert4/docker-entrypoint.sh b/debian/10.12.4/docker-entrypoint.sh similarity index 100% rename from debian-buster-certified-13.21-cert4/docker-entrypoint.sh rename to debian/10.12.4/docker-entrypoint.sh diff --git a/debian/10.12.4/hooks/post_push b/debian/10.12.4/hooks/post_push new file mode 100644 index 0000000..c59c0ea --- /dev/null +++ b/debian/10.12.4/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {10.12.4}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-jessie-slim-11.25.3/Dockerfile b/debian/11.25.3/Dockerfile similarity index 100% rename from debian-jessie-slim-11.25.3/Dockerfile rename to debian/11.25.3/Dockerfile diff --git a/debian-jessie-slim-1.8.32.3/build-asterisk.sh b/debian/11.25.3/build-asterisk.sh similarity index 100% rename from debian-jessie-slim-1.8.32.3/build-asterisk.sh rename to debian/11.25.3/build-asterisk.sh diff --git a/debian-jessie-slim-1.4.44/docker-entrypoint.sh b/debian/11.25.3/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-1.4.44/docker-entrypoint.sh rename to debian/11.25.3/docker-entrypoint.sh diff --git a/debian/11.25.3/hooks/post_push b/debian/11.25.3/hooks/post_push new file mode 100644 index 0000000..a7be9c6 --- /dev/null +++ b/debian/11.25.3/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {11.25.3}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-jessie-slim-12.8.2/Dockerfile b/debian/12.8.2/Dockerfile similarity index 100% rename from debian-jessie-slim-12.8.2/Dockerfile rename to debian/12.8.2/Dockerfile diff --git a/debian-jessie-slim-10.12.4/build-asterisk.sh b/debian/12.8.2/build-asterisk.sh similarity index 100% rename from debian-jessie-slim-10.12.4/build-asterisk.sh rename to debian/12.8.2/build-asterisk.sh diff --git a/debian-jessie-slim-1.6.2.24/docker-entrypoint.sh b/debian/12.8.2/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-1.6.2.24/docker-entrypoint.sh rename to debian/12.8.2/docker-entrypoint.sh diff --git a/debian/12.8.2/hooks/post_push b/debian/12.8.2/hooks/post_push new file mode 100644 index 0000000..3b53c98 --- /dev/null +++ b/debian/12.8.2/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {12.8.2}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-buster-certified-13.21-cert4/Dockerfile b/debian/13-certified/Dockerfile similarity index 90% rename from debian-buster-certified-13.21-cert4/Dockerfile rename to debian/13-certified/Dockerfile index ee57471..e4676fa 100644 --- a/debian-buster-certified-13.21-cert4/Dockerfile +++ b/debian/13-certified/Dockerfile @@ -3,7 +3,7 @@ FROM debian:buster-slim LABEL maintainer="Andrius Kairiukstis " -ENV ASTERISK_VERSION asterisk-certified-13.21-cert4 +ENV ASTERISK_VERSION asterisk-certified-13.21-current ENV OPUS_CODEC asterisk-13.0/x86-64/codec_opus-13.0_current-x86_64 COPY build-asterisk.sh / diff --git a/debian-buster-certified-13.21-cert4/build-asterisk.sh b/debian/13-certified/build-asterisk.sh similarity index 96% rename from debian-buster-certified-13.21-cert4/build-asterisk.sh rename to debian/13-certified/build-asterisk.sh index e4a789f..28be370 100755 --- a/debian-buster-certified-13.21-cert4/build-asterisk.sh +++ b/debian/13-certified/build-asterisk.sh @@ -51,6 +51,7 @@ rm -rf /var/lib/apt/lists/* mkdir -p /usr/src/asterisk cd /usr/src/asterisk +curl -vsL http://downloads.asterisk.org/pub/telephony/certified-asterisk/${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ curl -vsL http://downloads.asterisk.org/pub/telephony/certified-asterisk/releases/${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz # 1.5 jobs per core works out okay diff --git a/debian-jessie-slim-1.8.32.3/docker-entrypoint.sh b/debian/13-certified/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-1.8.32.3/docker-entrypoint.sh rename to debian/13-certified/docker-entrypoint.sh diff --git a/debian/13-certified/hooks/post_push b/debian/13-certified/hooks/post_push new file mode 100644 index 0000000..1d25cbc --- /dev/null +++ b/debian/13-certified/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {13-certified,13.21-cert}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-slim-13-current/Dockerfile b/debian/13-current/Dockerfile similarity index 100% rename from debian-stretch-slim-13-current/Dockerfile rename to debian/13-current/Dockerfile diff --git a/debian-stretch-slim-13-current/build-asterisk.sh b/debian/13-current/build-asterisk.sh similarity index 100% rename from debian-stretch-slim-13-current/build-asterisk.sh rename to debian/13-current/build-asterisk.sh diff --git a/debian-jessie-slim-10.12.4/docker-entrypoint.sh b/debian/13-current/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-10.12.4/docker-entrypoint.sh rename to debian/13-current/docker-entrypoint.sh diff --git a/debian/13-current/hooks/post_push b/debian/13-current/hooks/post_push new file mode 100644 index 0000000..a8a1960 --- /dev/null +++ b/debian/13-current/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {13-current}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-slim-14-current/Dockerfile b/debian/14.7.8/Dockerfile similarity index 94% rename from debian-stretch-slim-14-current/Dockerfile rename to debian/14.7.8/Dockerfile index c9a3c00..7cff3df 100644 --- a/debian-stretch-slim-14-current/Dockerfile +++ b/debian/14.7.8/Dockerfile @@ -3,7 +3,7 @@ FROM debian:stretch-slim LABEL maintainer="Andrius Kairiukstis " -ENV ASTERISK_VERSION 14-current +ENV ASTERISK_VERSION 14.7.8 ENV OPUS_CODEC asterisk-14.0/x86-64/codec_opus-14.0_current-x86_64 COPY build-asterisk.sh / diff --git a/debian-buster-slim-16-current/Dockerfile-centos b/debian/14.7.8/Dockerfile-centos similarity index 100% rename from debian-buster-slim-16-current/Dockerfile-centos rename to debian/14.7.8/Dockerfile-centos diff --git a/debian-stretch-slim-14-current/build-asterisk.sh b/debian/14.7.8/build-asterisk.sh similarity index 100% rename from debian-stretch-slim-14-current/build-asterisk.sh rename to debian/14.7.8/build-asterisk.sh diff --git a/debian-jessie-slim-11.25.3/docker-entrypoint.sh b/debian/14.7.8/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-11.25.3/docker-entrypoint.sh rename to debian/14.7.8/docker-entrypoint.sh diff --git a/debian/14.7.8/hooks/post_push b/debian/14.7.8/hooks/post_push new file mode 100644 index 0000000..7c1b38a --- /dev/null +++ b/debian/14.7.8/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {14.7.8}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-slim-15-current/Dockerfile b/debian/15.7.4/Dockerfile similarity index 94% rename from debian-stretch-slim-15-current/Dockerfile rename to debian/15.7.4/Dockerfile index d529aec..4a04c9b 100644 --- a/debian-stretch-slim-15-current/Dockerfile +++ b/debian/15.7.4/Dockerfile @@ -3,7 +3,7 @@ FROM debian:stretch-slim LABEL maintainer="Andrius Kairiukstis " -ENV ASTERISK_VERSION 15-current +ENV ASTERISK_VERSION 15.7.4 ENV OPUS_CODEC asterisk-15.0/x86-64/codec_opus-15.0_current-x86_64 COPY build-asterisk.sh / diff --git a/debian-stretch-slim-14-current/Dockerfile-centos b/debian/15.7.4/Dockerfile-centos similarity index 100% rename from debian-stretch-slim-14-current/Dockerfile-centos rename to debian/15.7.4/Dockerfile-centos diff --git a/debian-stretch-slim-15-current/build-asterisk.sh b/debian/15.7.4/build-asterisk.sh similarity index 100% rename from debian-stretch-slim-15-current/build-asterisk.sh rename to debian/15.7.4/build-asterisk.sh diff --git a/debian-jessie-slim-12.8.2/docker-entrypoint.sh b/debian/15.7.4/docker-entrypoint.sh similarity index 100% rename from debian-jessie-slim-12.8.2/docker-entrypoint.sh rename to debian/15.7.4/docker-entrypoint.sh diff --git a/debian/15.7.4/hooks/post_push b/debian/15.7.4/hooks/post_push new file mode 100644 index 0000000..944ce75 --- /dev/null +++ b/debian/15.7.4/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {15.7.4}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-certified-13.21-cert4/Dockerfile b/debian/16-certified/Dockerfile similarity index 75% rename from debian-stretch-certified-13.21-cert4/Dockerfile rename to debian/16-certified/Dockerfile index 5189c33..badf80e 100644 --- a/debian-stretch-certified-13.21-cert4/Dockerfile +++ b/debian/16-certified/Dockerfile @@ -1,10 +1,10 @@ # vim:set ft=dockerfile: -FROM debian:stretch-slim +FROM debian:buster-slim LABEL maintainer="Andrius Kairiukstis " -ENV ASTERISK_VERSION asterisk-certified-13.21-cert4 -ENV OPUS_CODEC asterisk-13.0/x86-64/codec_opus-13.0_current-x86_64 +ENV ASTERISK_VERSION asterisk-certified-16.3-current +ENV OPUS_CODEC asterisk-16.0/x86-64/codec_opus-13.0_current-x86_64 COPY build-asterisk.sh / RUN /build-asterisk.sh diff --git a/debian-stretch-certified-13.21-cert4/build-asterisk.sh b/debian/16-certified/build-asterisk.sh similarity index 94% rename from debian-stretch-certified-13.21-cert4/build-asterisk.sh rename to debian/16-certified/build-asterisk.sh index cb389de..28be370 100755 --- a/debian-stretch-certified-13.21-cert4/build-asterisk.sh +++ b/debian/16-certified/build-asterisk.sh @@ -21,6 +21,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i libcurl4-openssl-dev \ libedit-dev \ libgsm1-dev \ + libjansson4 \ libjansson-dev \ libogg-dev \ libpopt-dev \ @@ -29,11 +30,12 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i libspeex-dev \ libspeexdsp-dev \ libsqlite3-dev \ - libsrtp0-dev \ + libsrtp2-dev \ libssl-dev \ libvorbis-dev \ libxml2-dev \ libxslt1-dev \ + procps \ portaudio19-dev \ unixodbc \ unixodbc-bin \ @@ -49,6 +51,7 @@ rm -rf /var/lib/apt/lists/* mkdir -p /usr/src/asterisk cd /usr/src/asterisk +curl -vsL http://downloads.asterisk.org/pub/telephony/certified-asterisk/${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ curl -vsL http://downloads.asterisk.org/pub/telephony/certified-asterisk/releases/${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz # 1.5 jobs per core works out okay diff --git a/debian-stretch-certified-13.21-cert4/docker-entrypoint.sh b/debian/16-certified/docker-entrypoint.sh similarity index 100% rename from debian-stretch-certified-13.21-cert4/docker-entrypoint.sh rename to debian/16-certified/docker-entrypoint.sh diff --git a/debian/16-certified/hooks/post_push b/debian/16-certified/hooks/post_push new file mode 100644 index 0000000..20eb598 --- /dev/null +++ b/debian/16-certified/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {16-certified,16.3-cert}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-buster-slim-16-current/Dockerfile b/debian/16-current/Dockerfile similarity index 100% rename from debian-buster-slim-16-current/Dockerfile rename to debian/16-current/Dockerfile diff --git a/debian-stretch-slim-15-current/Dockerfile-centos b/debian/16-current/Dockerfile-centos similarity index 100% rename from debian-stretch-slim-15-current/Dockerfile-centos rename to debian/16-current/Dockerfile-centos diff --git a/debian-buster-slim-16-current/build-asterisk.sh b/debian/16-current/build-asterisk.sh similarity index 100% rename from debian-buster-slim-16-current/build-asterisk.sh rename to debian/16-current/build-asterisk.sh diff --git a/debian-buster-slim-16-current/docker-entrypoint.sh b/debian/16-current/docker-entrypoint.sh similarity index 100% rename from debian-buster-slim-16-current/docker-entrypoint.sh rename to debian/16-current/docker-entrypoint.sh diff --git a/debian/16-current/hooks/post_push b/debian/16-current/hooks/post_push new file mode 100644 index 0000000..83de236 --- /dev/null +++ b/debian/16-current/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {16-current}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian-stretch-slim-17-current/Dockerfile b/debian/17-current/Dockerfile similarity index 89% rename from debian-stretch-slim-17-current/Dockerfile rename to debian/17-current/Dockerfile index 87fbc15..cdcab65 100644 --- a/debian-stretch-slim-17-current/Dockerfile +++ b/debian/17-current/Dockerfile @@ -1,9 +1,9 @@ # vim:set ft=dockerfile: -FROM debian:stretch-slim +FROM debian:buster-slim LABEL maintainer="Andrius Kairiukstis " -ENV ASTERISK_VERSION 17.0.0-rc1 +ENV ASTERISK_VERSION 17-current ENV OPUS_CODEC asterisk-17.0/x86-64/codec_opus-17.0_current-x86_64 COPY build-asterisk.sh / diff --git a/debian-stretch-slim-16-current/Dockerfile-centos b/debian/17-current/Dockerfile-centos similarity index 100% rename from debian-stretch-slim-16-current/Dockerfile-centos rename to debian/17-current/Dockerfile-centos diff --git a/debian-stretch-slim-16-current/build-asterisk.sh b/debian/17-current/build-asterisk.sh similarity index 91% rename from debian-stretch-slim-16-current/build-asterisk.sh rename to debian/17-current/build-asterisk.sh index cd88e25..6faea3c 100755 --- a/debian-stretch-slim-16-current/build-asterisk.sh +++ b/debian/17-current/build-asterisk.sh @@ -2,8 +2,8 @@ PROGNAME=$(basename $0) if test -z ${ASTERISK_VERSION}; then - echo "${PROGNAME}: ASTERISK_VERSION required" >&2 - exit 1 + echo "${PROGNAME}: ASTERISK_VERSION required" >&2 + exit 1 fi set -ex @@ -28,7 +28,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i libspeex-dev \ libspeexdsp-dev \ libsqlite3-dev \ - libsrtp0-dev \ + libsrtp2-dev \ libssl-dev \ libvorbis-dev \ libxml2-dev \ @@ -67,6 +67,9 @@ menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts # enable good things menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts +# enable ooh323 +menuselect/menuselect --enable chan_ooh323 menuselect.makeopts + # codecs # menuselect/menuselect --enable codec_opus menuselect.makeopts # menuselect/menuselect --enable codec_silk menuselect.makeopts @@ -79,9 +82,9 @@ menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts # done # we don't need any sounds in docker, they will be mounted as volume -menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS -menuselect/menuselect --disable-category MENUSELECT_MOH -menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS +menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect.makeopts +menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts +menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts make -j ${JOBS} all make install diff --git a/debian-stretch-slim-16-current/docker-entrypoint.sh b/debian/17-current/docker-entrypoint.sh similarity index 100% rename from debian-stretch-slim-16-current/docker-entrypoint.sh rename to debian/17-current/docker-entrypoint.sh diff --git a/debian/17-current/hooks/post_push b/debian/17-current/hooks/post_push new file mode 100644 index 0000000..11d18a4 --- /dev/null +++ b/debian/17-current/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {17-current}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/debian/stretch-17-current/hooks/post_push b/debian/stretch-17-current/hooks/post_push new file mode 100644 index 0000000..5cac625 --- /dev/null +++ b/debian/stretch-17-current/hooks/post_push @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {stretch-17-current}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/edge b/edge deleted file mode 120000 index 17dee1e..0000000 --- a/edge +++ /dev/null @@ -1 +0,0 @@ -alpine-edge \ No newline at end of file diff --git a/latest b/latest deleted file mode 120000 index deb9c14..0000000 --- a/latest +++ /dev/null @@ -1 +0,0 @@ -alpine-latest \ No newline at end of file diff --git a/post_checkout.erb b/post_checkout.erb new file mode 100644 index 0000000..1be8821 --- /dev/null +++ b/post_checkout.erb @@ -0,0 +1,17 @@ +#!/bin/bash +<% is_armhf = (dockerfile.split("/")[1] == "armhf") %> +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_checkout.erb +<% if is_armhf %> +set -e + +HOST_ARCH=$(uname -m) + +if [ x"${HOST_ARCH}" == x"arm*" ]; then + echo "Building armhf image natively" + exit +fi + +# Enable cross-platform builds https://github.com/multiarch/qemu-user-static +docker run --rm --privileged multiarch/qemu-user-static:register --reset +<% end %> diff --git a/post_push.erb b/post_push.erb new file mode 100644 index 0000000..a9722ee --- /dev/null +++ b/post_push.erb @@ -0,0 +1,15 @@ +#!/bin/bash +# AUTOMATICALLY GENERATED +# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in {<%= image_tags %>}; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done diff --git a/test/asterisk.bats b/test/asterisk.bats new file mode 100644 index 0000000..ff929d3 --- /dev/null +++ b/test/asterisk.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +@test "asterisk is installed" { + run docker run -ti --rm $IMAGE asterisk -V + [ "$status" -eq 0 ] +} + +@test "asterisk runs ok" { + run docker run -ti --rm $IMAGE sh -c 'asterisk; sleep 5; asterisk -rx "core show version"' + [ "$status" -eq 0 ] +} diff --git a/test/bats/bats b/test/bats/bats new file mode 120000 index 0000000..46d1727 --- /dev/null +++ b/test/bats/bats @@ -0,0 +1 @@ +/home/ak/Development/docker/pjsua/test/bats/vendor/bats-0.4.0/libexec/bats \ No newline at end of file diff --git a/test/bats/bats-exec-suite b/test/bats/bats-exec-suite new file mode 120000 index 0000000..ebc4802 --- /dev/null +++ b/test/bats/bats-exec-suite @@ -0,0 +1 @@ +/home/ak/Development/docker/pjsua/test/bats/vendor/bats-0.4.0/libexec/bats-exec-suite \ No newline at end of file diff --git a/test/bats/bats-exec-test b/test/bats/bats-exec-test new file mode 120000 index 0000000..39ddede --- /dev/null +++ b/test/bats/bats-exec-test @@ -0,0 +1 @@ +/home/ak/Development/docker/pjsua/test/bats/vendor/bats-0.4.0/libexec/bats-exec-test \ No newline at end of file diff --git a/test/bats/bats-format-tap-stream b/test/bats/bats-format-tap-stream new file mode 120000 index 0000000..b2c8149 --- /dev/null +++ b/test/bats/bats-format-tap-stream @@ -0,0 +1 @@ +/home/ak/Development/docker/pjsua/test/bats/vendor/bats-0.4.0/libexec/bats-format-tap-stream \ No newline at end of file diff --git a/test/bats/bats-preprocess b/test/bats/bats-preprocess new file mode 120000 index 0000000..fc72357 --- /dev/null +++ b/test/bats/bats-preprocess @@ -0,0 +1 @@ +/home/ak/Development/docker/pjsua/test/bats/vendor/bats-0.4.0/libexec/bats-preprocess \ No newline at end of file diff --git a/test/bats/vendor/bats-0.4.0/.gitattributes b/test/bats/vendor/bats-0.4.0/.gitattributes new file mode 100755 index 0000000..20cad1f --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.sh eol=lf +libexec/* eol=lf diff --git a/test/bats/vendor/bats-0.4.0/.travis.yml b/test/bats/vendor/bats-0.4.0/.travis.yml new file mode 100644 index 0000000..db06d9d --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/.travis.yml @@ -0,0 +1,5 @@ +language: c +script: bin/bats --tap test +notifications: + email: + on_success: never diff --git a/test/bats/vendor/bats-0.4.0/LICENSE b/test/bats/vendor/bats-0.4.0/LICENSE new file mode 100644 index 0000000..bac4eb2 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014 Sam Stephenson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/test/bats/vendor/bats-0.4.0/README.md b/test/bats/vendor/bats-0.4.0/README.md new file mode 100644 index 0000000..235bf1e --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/README.md @@ -0,0 +1,293 @@ +# Bats: Bash Automated Testing System + +Bats is a [TAP](http://testanything.org)-compliant testing framework +for Bash. It provides a simple way to verify that the UNIX programs +you write behave as expected. + +A Bats test file is a Bash script with special syntax for defining +test cases. Under the hood, each test case is just a function with a +description. + +```bash +#!/usr/bin/env bats + +@test "addition using bc" { + result="$(echo 2+2 | bc)" + [ "$result" -eq 4 ] +} + +@test "addition using dc" { + result="$(echo 2 2+p | dc)" + [ "$result" -eq 4 ] +} +``` + +Bats is most useful when testing software written in Bash, but you can +use it to test any UNIX program. + +Test cases consist of standard shell commands. Bats makes use of +Bash's `errexit` (`set -e`) option when running test cases. If every +command in the test case exits with a `0` status code (success), the +test passes. In this way, each line is an assertion of truth. + + +## Running tests + +To run your tests, invoke the `bats` interpreter with a path to a test +file. The file's test cases are run sequentially and in isolation. If +all the test cases pass, `bats` exits with a `0` status code. If there +are any failures, `bats` exits with a `1` status code. + +When you run Bats from a terminal, you'll see output as each test is +performed, with a check-mark next to the test's name if it passes or +an "X" if it fails. + + $ bats addition.bats + ✓ addition using bc + ✓ addition using dc + + 2 tests, 0 failures + +If Bats is not connected to a terminal—in other words, if you +run it from a continuous integration system, or redirect its output to +a file—the results are displayed in human-readable, machine-parsable +[TAP format](http://testanything.org). + +You can force TAP output from a terminal by invoking Bats with the +`--tap` option. + + $ bats --tap addition.bats + 1..2 + ok 1 addition using bc + ok 2 addition using dc + +### Test suites + +You can invoke the `bats` interpreter with multiple test file +arguments, or with a path to a directory containing multiple `.bats` +files. Bats will run each test file individually and aggregate the +results. If any test case fails, `bats` exits with a `1` status code. + + +## Writing tests + +Each Bats test file is evaluated _n+1_ times, where _n_ is the number of +test cases in the file. The first run counts the number of test cases, +then iterates over the test cases and executes each one in its own +process. + +For more details about how Bats evaluates test files, see +[Bats Evaluation Process](https://github.com/sstephenson/bats/wiki/Bats-Evaluation-Process) +on the wiki. + +### `run`: Test other commands + +Many Bats tests need to run a command and then make assertions about +its exit status and output. Bats includes a `run` helper that invokes +its arguments as a command, saves the exit status and output into +special global variables, and then returns with a `0` status code so +you can continue to make assertions in your test case. + +For example, let's say you're testing that the `foo` command, when +passed a nonexistent filename, exits with a `1` status code and prints +an error message. + +```bash +@test "invoking foo with a nonexistent file prints an error" { + run foo nonexistent_filename + [ "$status" -eq 1 ] + [ "$output" = "foo: no such file 'nonexistent_filename'" ] +} +``` + +The `$status` variable contains the status code of the command, and +the `$output` variable contains the combined contents of the command's +standard output and standard error streams. + +A third special variable, the `$lines` array, is available for easily +accessing individual lines of output. For example, if you want to test +that invoking `foo` without any arguments prints usage information on +the first line: + +```bash +@test "invoking foo without arguments prints usage" { + run foo + [ "$status" -eq 1 ] + [ "${lines[0]}" = "usage: foo " ] +} +``` + +### `load`: Share common code + +You may want to share common code across multiple test files. Bats +includes a convenient `load` command for sourcing a Bash source file +relative to the location of the current test file. For example, if you +have a Bats test in `test/foo.bats`, the command + +```bash +load test_helper +``` + +will source the script `test/test_helper.bash` in your test file. This +can be useful for sharing functions to set up your environment or load +fixtures. + +### `skip`: Easily skip tests + +Tests can be skipped by using the `skip` command at the point in a +test you wish to skip. + +```bash +@test "A test I don't want to execute for now" { + skip + run foo + [ "$status" -eq 0 ] +} +``` + +Optionally, you may include a reason for skipping: + +```bash +@test "A test I don't want to execute for now" { + skip "This command will return zero soon, but not now" + run foo + [ "$status" -eq 0 ] +} +``` + +Or you can skip conditionally: + +```bash +@test "A test which should run" { + if [ foo != bar ]; then + skip "foo isn't bar" + fi + + run foo + [ "$status" -eq 0 ] +} +``` + +### `setup` and `teardown`: Pre- and post-test hooks + +You can define special `setup` and `teardown` functions, which run +before and after each test case, respectively. Use these to load +fixtures, set up your environment, and clean up when you're done. + +### Code outside of test cases + +You can include code in your test file outside of `@test` functions. +For example, this may be useful if you want to check for dependencies +and fail immediately if they're not present. However, any output that +you print in code outside of `@test`, `setup` or `teardown` functions +must be redirected to `stderr` (`>&2`). Otherwise, the output may +cause Bats to fail by polluting the TAP stream on `stdout`. + +### Special variables + +There are several global variables you can use to introspect on Bats +tests: + +* `$BATS_TEST_FILENAME` is the fully expanded path to the Bats test +file. +* `$BATS_TEST_DIRNAME` is the directory in which the Bats test file is +located. +* `$BATS_TEST_NAMES` is an array of function names for each test case. +* `$BATS_TEST_NAME` is the name of the function containing the current +test case. +* `$BATS_TEST_DESCRIPTION` is the description of the current test +case. +* `$BATS_TEST_NUMBER` is the (1-based) index of the current test case +in the test file. +* `$BATS_TMPDIR` is the location to a directory that may be used to +store temporary files. + + +## Installing Bats from source + +Check out a copy of the Bats repository. Then, either add the Bats +`bin` directory to your `$PATH`, or run the provided `install.sh` +command with the location to the prefix in which you want to install +Bats. For example, to install Bats into `/usr/local`, + + $ git clone https://github.com/sstephenson/bats.git + $ cd bats + $ ./install.sh /usr/local + +Note that you may need to run `install.sh` with `sudo` if you do not +have permission to write to the installation prefix. + + +## Support + +The Bats source code repository is [hosted on +GitHub](https://github.com/sstephenson/bats). There you can file bugs +on the issue tracker or submit tested pull requests for review. + +For real-world examples from open-source projects using Bats, see +[Projects Using Bats](https://github.com/sstephenson/bats/wiki/Projects-Using-Bats) +on the wiki. + +To learn how to set up your editor for Bats syntax highlighting, see +[Syntax Highlighting](https://github.com/sstephenson/bats/wiki/Syntax-Highlighting) +on the wiki. + + +## Version history + +*0.4.0* (August 13, 2014) + +* Improved the display of failing test cases. Bats now shows the + source code of failing test lines, along with full stack traces + including function names, filenames, and line numbers. +* Improved the display of the pretty-printed test summary line to + include the number of skipped tests, if any. +* Improved the speed of the preprocessor, dramatically shortening test + and suite startup times. +* Added support for absolute pathnames to the `load` helper. +* Added support for single-line `@test` definitions. +* Added bats(1) and bats(7) manual pages. +* Modified the `bats` command to default to TAP output when the `$CI` + variable is set, to better support environments such as Travis CI. + +*0.3.1* (October 28, 2013) + +* Fixed an incompatibility with the pretty formatter in certain + environments such as tmux. +* Fixed a bug where the pretty formatter would crash if the first line + of a test file's output was invalid TAP. + +*0.3.0* (October 21, 2013) + +* Improved formatting for tests run from a terminal. Failing tests + are now colored in red, and the total number of failing tests is + displayed at the end of the test run. When Bats is not connected to + a terminal (e.g. in CI runs), or when invoked with the `--tap` flag, + output is displayed in standard TAP format. +* Added the ability to skip tests using the `skip` command. +* Added a message to failing test case output indicating the file and + line number of the statement that caused the test to fail. +* Added "ad-hoc" test suite support. You can now invoke `bats` with + multiple filename or directory arguments to run all the specified + tests in aggregate. +* Added support for test files with Windows line endings. +* Fixed regular expression warnings from certain versions of Bash. +* Fixed a bug running tests containing lines that begin with `-e`. + +*0.2.0* (November 16, 2012) + +* Added test suite support. The `bats` command accepts a directory + name containing multiple test files to be run in aggregate. +* Added the ability to count the number of test cases in a file or + suite by passing the `-c` flag to `bats`. +* Preprocessed sources are cached between test case runs in the same + file for better performance. + +*0.1.0* (December 30, 2011) + +* Initial public release. + +--- + +© 2014 Sam Stephenson. Bats is released under an MIT-style license; +see `LICENSE` for details. diff --git a/test/bats/vendor/bats-0.4.0/bin/bats b/test/bats/vendor/bats-0.4.0/bin/bats new file mode 120000 index 0000000..a50a884 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/bin/bats @@ -0,0 +1 @@ +../libexec/bats \ No newline at end of file diff --git a/test/bats/vendor/bats-0.4.0/install.sh b/test/bats/vendor/bats-0.4.0/install.sh new file mode 100755 index 0000000..8bbdd16 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -e + +resolve_link() { + $(type -p greadlink readlink | head -1) "$1" +} + +abs_dirname() { + local cwd="$(pwd)" + local path="$1" + + while [ -n "$path" ]; do + cd "${path%/*}" + local name="${path##*/}" + path="$(resolve_link "$name" || true)" + done + + pwd + cd "$cwd" +} + +PREFIX="$1" +if [ -z "$1" ]; then + { echo "usage: $0 " + echo " e.g. $0 /usr/local" + } >&2 + exit 1 +fi + +BATS_ROOT="$(abs_dirname "$0")" +mkdir -p "$PREFIX"/{bin,libexec,share/man/man{1,7}} +cp -R "$BATS_ROOT"/bin/* "$PREFIX"/bin +cp -R "$BATS_ROOT"/libexec/* "$PREFIX"/libexec +cp "$BATS_ROOT"/man/bats.1 "$PREFIX"/share/man/man1 +cp "$BATS_ROOT"/man/bats.7 "$PREFIX"/share/man/man7 + +echo "Installed Bats to $PREFIX/bin/bats" diff --git a/test/bats/vendor/bats-0.4.0/libexec/bats b/test/bats/vendor/bats-0.4.0/libexec/bats new file mode 100755 index 0000000..71f392f --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/libexec/bats @@ -0,0 +1,142 @@ +#!/usr/bin/env bash +set -e + +version() { + echo "Bats 0.4.0" +} + +usage() { + version + echo "Usage: bats [-c] [-p | -t] [ ...]" +} + +help() { + usage + echo + echo " is the path to a Bats test file, or the path to a directory" + echo " containing Bats test files." + echo + echo " -c, --count Count the number of test cases without running any tests" + echo " -h, --help Display this help message" + echo " -p, --pretty Show results in pretty format (default for terminals)" + echo " -t, --tap Show results in TAP format" + echo " -v, --version Display the version number" + echo + echo " For more information, see https://github.com/sstephenson/bats" + echo +} + +resolve_link() { + $(type -p greadlink readlink | head -1) "$1" +} + +abs_dirname() { + local cwd="$(pwd)" + local path="$1" + + while [ -n "$path" ]; do + cd "${path%/*}" + local name="${path##*/}" + path="$(resolve_link "$name" || true)" + done + + pwd + cd "$cwd" +} + +expand_path() { + { cd "$(dirname "$1")" 2>/dev/null + local dirname="$PWD" + cd "$OLDPWD" + echo "$dirname/$(basename "$1")" + } || echo "$1" +} + +BATS_LIBEXEC="$(abs_dirname "$0")" +export BATS_PREFIX="$(abs_dirname "$BATS_LIBEXEC")" +export BATS_CWD="$(abs_dirname .)" +export PATH="$BATS_LIBEXEC:$PATH" + +options=() +arguments=() +for arg in "$@"; do + if [ "${arg:0:1}" = "-" ]; then + if [ "${arg:1:1}" = "-" ]; then + options[${#options[*]}]="${arg:2}" + else + index=1 + while option="${arg:$index:1}"; do + [ -n "$option" ] || break + options[${#options[*]}]="$option" + let index+=1 + done + fi + else + arguments[${#arguments[*]}]="$arg" + fi +done + +unset count_flag pretty +[ -t 0 ] && [ -t 1 ] && pretty="1" +[ -n "$CI" ] && pretty="" + +for option in "${options[@]}"; do + case "$option" in + "h" | "help" ) + help + exit 0 + ;; + "v" | "version" ) + version + exit 0 + ;; + "c" | "count" ) + count_flag="-c" + ;; + "t" | "tap" ) + pretty="" + ;; + "p" | "pretty" ) + pretty="1" + ;; + * ) + usage >&2 + exit 1 + ;; + esac +done + +if [ "${#arguments[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +filenames=() +for filename in "${arguments[@]}"; do + if [ -d "$filename" ]; then + shopt -s nullglob + for suite_filename in "$(expand_path "$filename")"/*.bats; do + filenames["${#filenames[@]}"]="$suite_filename" + done + shopt -u nullglob + else + filenames["${#filenames[@]}"]="$(expand_path "$filename")" + fi +done + +if [ "${#filenames[@]}" -eq 1 ]; then + command="bats-exec-test" +else + command="bats-exec-suite" +fi + +if [ -n "$pretty" ]; then + extended_syntax_flag="-x" + formatter="bats-format-tap-stream" +else + extended_syntax_flag="" + formatter="cat" +fi + +set -o pipefail execfail +exec "$command" $count_flag $extended_syntax_flag "${filenames[@]}" | "$formatter" diff --git a/test/bats/vendor/bats-0.4.0/libexec/bats-exec-suite b/test/bats/vendor/bats-0.4.0/libexec/bats-exec-suite new file mode 100755 index 0000000..29ab255 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/libexec/bats-exec-suite @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -e + +count_only_flag="" +if [ "$1" = "-c" ]; then + count_only_flag=1 + shift +fi + +extended_syntax_flag="" +if [ "$1" = "-x" ]; then + extended_syntax_flag="-x" + shift +fi + +trap "kill 0; exit 1" int + +count=0 +for filename in "$@"; do + let count+="$(bats-exec-test -c "$filename")" +done + +if [ -n "$count_only_flag" ]; then + echo "$count" + exit +fi + +echo "1..$count" +status=0 +offset=0 +for filename in "$@"; do + index=0 + { + IFS= read -r # 1..n + while IFS= read -r line; do + case "$line" in + "begin "* ) + let index+=1 + echo "${line/ $index / $(($offset + $index)) }" + ;; + "ok "* | "not ok "* ) + [ -n "$extended_syntax_flag" ] || let index+=1 + echo "${line/ $index / $(($offset + $index)) }" + [ "${line:0:6}" != "not ok" ] || status=1 + ;; + * ) + echo "$line" + ;; + esac + done + } < <( bats-exec-test $extended_syntax_flag "$filename" ) + offset=$(($offset + $index)) +done + +exit "$status" diff --git a/test/bats/vendor/bats-0.4.0/libexec/bats-exec-test b/test/bats/vendor/bats-0.4.0/libexec/bats-exec-test new file mode 100755 index 0000000..5a07665 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/libexec/bats-exec-test @@ -0,0 +1,344 @@ +#!/usr/bin/env bash +set -e +set -E +set -T + +BATS_COUNT_ONLY="" +if [ "$1" = "-c" ]; then + BATS_COUNT_ONLY=1 + shift +fi + +BATS_EXTENDED_SYNTAX="" +if [ "$1" = "-x" ]; then + BATS_EXTENDED_SYNTAX="$1" + shift +fi + +BATS_TEST_FILENAME="$1" +if [ -z "$BATS_TEST_FILENAME" ]; then + echo "usage: bats-exec " >&2 + exit 1 +elif [ ! -f "$BATS_TEST_FILENAME" ]; then + echo "bats: $BATS_TEST_FILENAME does not exist" >&2 + exit 1 +else + shift +fi + +BATS_TEST_DIRNAME="$(dirname "$BATS_TEST_FILENAME")" +BATS_TEST_NAMES=() + +load() { + local name="$1" + local filename + + if [ "${name:0:1}" = "/" ]; then + filename="${name}" + else + filename="$BATS_TEST_DIRNAME/${name}.bash" + fi + + [ -f "$filename" ] || { + echo "bats: $filename does not exist" >&2 + exit 1 + } + + source "${filename}" +} + +run() { + local e E T + [[ ! "$-" =~ e ]] || e=1 + [[ ! "$-" =~ E ]] || E=1 + [[ ! "$-" =~ T ]] || T=1 + set +e + set +E + set +T + output="$("$@" 2>&1)" + status="$?" + IFS=$'\n' lines=($output) + [ -z "$e" ] || set -e + [ -z "$E" ] || set -E + [ -z "$T" ] || set -T +} + +setup() { + true +} + +teardown() { + true +} + +skip() { + BATS_TEST_SKIPPED=${1:-1} + BATS_TEST_COMPLETED=1 + exit 0 +} + +bats_test_begin() { + BATS_TEST_DESCRIPTION="$1" + if [ -n "$BATS_EXTENDED_SYNTAX" ]; then + echo "begin $BATS_TEST_NUMBER $BATS_TEST_DESCRIPTION" >&3 + fi + setup +} + +bats_test_function() { + local test_name="$1" + BATS_TEST_NAMES["${#BATS_TEST_NAMES[@]}"]="$test_name" +} + +bats_capture_stack_trace() { + BATS_PREVIOUS_STACK_TRACE=( "${BATS_CURRENT_STACK_TRACE[@]}" ) + BATS_CURRENT_STACK_TRACE=() + + local test_pattern=" $BATS_TEST_NAME $BATS_TEST_SOURCE" + local setup_pattern=" setup $BATS_TEST_SOURCE" + local teardown_pattern=" teardown $BATS_TEST_SOURCE" + + local frame + local index=1 + + while frame="$(caller "$index")"; do + BATS_CURRENT_STACK_TRACE["${#BATS_CURRENT_STACK_TRACE[@]}"]="$frame" + if [[ "$frame" = *"$test_pattern" || \ + "$frame" = *"$setup_pattern" || \ + "$frame" = *"$teardown_pattern" ]]; then + break + else + let index+=1 + fi + done + + BATS_SOURCE="$(bats_frame_filename "${BATS_CURRENT_STACK_TRACE[0]}")" + BATS_LINENO="$(bats_frame_lineno "${BATS_CURRENT_STACK_TRACE[0]}")" +} + +bats_print_stack_trace() { + local frame + local index=1 + local count="${#@}" + + for frame in "$@"; do + local filename="$(bats_trim_filename "$(bats_frame_filename "$frame")")" + local lineno="$(bats_frame_lineno "$frame")" + + if [ $index -eq 1 ]; then + echo -n "# (" + else + echo -n "# " + fi + + local fn="$(bats_frame_function "$frame")" + if [ "$fn" != "$BATS_TEST_NAME" ]; then + echo -n "from function \`$fn' " + fi + + if [ $index -eq $count ]; then + echo "in test file $filename, line $lineno)" + else + echo "in file $filename, line $lineno," + fi + + let index+=1 + done +} + +bats_print_failed_command() { + local frame="$1" + local status="$2" + local filename="$(bats_frame_filename "$frame")" + local lineno="$(bats_frame_lineno "$frame")" + + local failed_line="$(bats_extract_line "$filename" "$lineno")" + local failed_command="$(bats_strip_string "$failed_line")" + echo -n "# \`${failed_command}' " + + if [ $status -eq 1 ]; then + echo "failed" + else + echo "failed with status $status" + fi +} + +bats_frame_lineno() { + local frame="$1" + local lineno="${frame%% *}" + echo "$lineno" +} + +bats_frame_function() { + local frame="$1" + local rest="${frame#* }" + local fn="${rest%% *}" + echo "$fn" +} + +bats_frame_filename() { + local frame="$1" + local rest="${frame#* }" + local filename="${rest#* }" + + if [ "$filename" = "$BATS_TEST_SOURCE" ]; then + echo "$BATS_TEST_FILENAME" + else + echo "$filename" + fi +} + +bats_extract_line() { + local filename="$1" + local lineno="$2" + sed -n "${lineno}p" "$filename" +} + +bats_strip_string() { + local string="$1" + printf "%s" "$string" | sed -e "s/^[ "$'\t'"]*//" -e "s/[ "$'\t'"]*$//" +} + +bats_trim_filename() { + local filename="$1" + local length="${#BATS_CWD}" + + if [ "${filename:0:length+1}" = "${BATS_CWD}/" ]; then + echo "${filename:length+1}" + else + echo "$filename" + fi +} + +bats_debug_trap() { + if [ "$BASH_SOURCE" != "$1" ]; then + bats_capture_stack_trace + fi +} + +bats_error_trap() { + BATS_ERROR_STATUS="$?" + BATS_ERROR_STACK_TRACE=( "${BATS_PREVIOUS_STACK_TRACE[@]}" ) + trap - debug +} + +bats_teardown_trap() { + trap "bats_exit_trap" exit + local status=0 + teardown >>"$BATS_OUT" 2>&1 || status="$?" + + if [ $status -eq 0 ]; then + BATS_TEARDOWN_COMPLETED=1 + elif [ -n "$BATS_TEST_COMPLETED" ]; then + BATS_ERROR_STATUS="$status" + BATS_ERROR_STACK_TRACE=( "${BATS_CURRENT_STACK_TRACE[@]}" ) + fi + + bats_exit_trap +} + +bats_exit_trap() { + local status + local skipped + trap - err exit + + skipped="" + if [ -n "$BATS_TEST_SKIPPED" ]; then + skipped=" # skip" + if [ "1" != "$BATS_TEST_SKIPPED" ]; then + skipped+=" ($BATS_TEST_SKIPPED)" + fi + fi + + if [ -z "$BATS_TEST_COMPLETED" ] || [ -z "$BATS_TEARDOWN_COMPLETED" ]; then + echo "not ok $BATS_TEST_NUMBER $BATS_TEST_DESCRIPTION" >&3 + bats_print_stack_trace "${BATS_ERROR_STACK_TRACE[@]}" >&3 + bats_print_failed_command "${BATS_ERROR_STACK_TRACE[${#BATS_ERROR_STACK_TRACE[@]}-1]}" "$BATS_ERROR_STATUS" >&3 + sed -e "s/^/# /" < "$BATS_OUT" >&3 + status=1 + else + echo "ok ${BATS_TEST_NUMBER}${skipped} ${BATS_TEST_DESCRIPTION}" >&3 + status=0 + fi + + rm -f "$BATS_OUT" + exit "$status" +} + +bats_perform_tests() { + echo "1..$#" + test_number=1 + status=0 + for test_name in "$@"; do + "$0" $BATS_EXTENDED_SYNTAX "$BATS_TEST_FILENAME" "$test_name" "$test_number" || status=1 + let test_number+=1 + done + exit "$status" +} + +bats_perform_test() { + BATS_TEST_NAME="$1" + if [ "$(type -t "$BATS_TEST_NAME" || true)" = "function" ]; then + BATS_TEST_NUMBER="$2" + if [ -z "$BATS_TEST_NUMBER" ]; then + echo "1..1" + BATS_TEST_NUMBER="1" + fi + + BATS_TEST_COMPLETED="" + BATS_TEARDOWN_COMPLETED="" + trap "bats_debug_trap \"\$BASH_SOURCE\"" debug + trap "bats_error_trap" err + trap "bats_teardown_trap" exit + "$BATS_TEST_NAME" >>"$BATS_OUT" 2>&1 + BATS_TEST_COMPLETED=1 + + else + echo "bats: unknown test name \`$BATS_TEST_NAME'" >&2 + exit 1 + fi +} + +if [ -z "$TMPDIR" ]; then + BATS_TMPDIR="/tmp" +else + BATS_TMPDIR="${TMPDIR%/}" +fi + +BATS_TMPNAME="$BATS_TMPDIR/bats.$$" +BATS_PARENT_TMPNAME="$BATS_TMPDIR/bats.$PPID" +BATS_OUT="${BATS_TMPNAME}.out" + +bats_preprocess_source() { + BATS_TEST_SOURCE="${BATS_TMPNAME}.src" + { tr -d '\r' < "$BATS_TEST_FILENAME"; echo; } | bats-preprocess > "$BATS_TEST_SOURCE" + trap "bats_cleanup_preprocessed_source" err exit + trap "bats_cleanup_preprocessed_source; exit 1" int +} + +bats_cleanup_preprocessed_source() { + rm -f "$BATS_TEST_SOURCE" +} + +bats_evaluate_preprocessed_source() { + if [ -z "$BATS_TEST_SOURCE" ]; then + BATS_TEST_SOURCE="${BATS_PARENT_TMPNAME}.src" + fi + source "$BATS_TEST_SOURCE" +} + +exec 3<&1 + +if [ "$#" -eq 0 ]; then + bats_preprocess_source + bats_evaluate_preprocessed_source + + if [ -n "$BATS_COUNT_ONLY" ]; then + echo "${#BATS_TEST_NAMES[@]}" + else + bats_perform_tests "${BATS_TEST_NAMES[@]}" + fi +else + bats_evaluate_preprocessed_source + bats_perform_test "$@" +fi diff --git a/test/bats/vendor/bats-0.4.0/libexec/bats-format-tap-stream b/test/bats/vendor/bats-0.4.0/libexec/bats-format-tap-stream new file mode 100755 index 0000000..614768f --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/libexec/bats-format-tap-stream @@ -0,0 +1,165 @@ +#!/usr/bin/env bash +set -e + +# Just stream the TAP output (sans extended syntax) if tput is missing +command -v tput >/dev/null || exec grep -v "^begin " + +header_pattern='[0-9]+\.\.[0-9]+' +IFS= read -r header + +if [[ "$header" =~ $header_pattern ]]; then + count="${header:3}" + index=0 + failures=0 + skipped=0 + name="" + count_column_width=$(( ${#count} * 2 + 2 )) +else + # If the first line isn't a TAP plan, print it and pass the rest through + printf "%s\n" "$header" + exec cat +fi + +update_screen_width() { + screen_width="$(tput cols)" + count_column_left=$(( $screen_width - $count_column_width )) +} + +trap update_screen_width WINCH +update_screen_width + +begin() { + go_to_column 0 + printf_with_truncation $(( $count_column_left - 1 )) " %s" "$name" + clear_to_end_of_line + go_to_column $count_column_left + printf "%${#count}s/${count}" "$index" + go_to_column 1 +} + +pass() { + go_to_column 0 + printf " ✓ %s" "$name" + advance +} + +skip() { + local reason="$1" + [ -z "$reason" ] || reason=": $reason" + go_to_column 0 + printf " - %s (skipped%s)" "$name" "$reason" + advance +} + +fail() { + go_to_column 0 + set_color 1 bold + printf " ✗ %s" "$name" + advance +} + +log() { + set_color 1 + printf " %s\n" "$1" + clear_color +} + +summary() { + printf "\n%d test%s" "$count" "$(plural "$count")" + + printf ", %d failure%s" "$failures" "$(plural "$failures")" + + if [ "$skipped" -gt 0 ]; then + printf ", %d skipped" "$skipped" + fi + + printf "\n" +} + +printf_with_truncation() { + local width="$1" + shift + local string="$(printf "$@")" + + if [ "${#string}" -gt "$width" ]; then + printf "%s..." "${string:0:$(( $width - 4 ))}" + else + printf "%s" "$string" + fi +} + +go_to_column() { + local column="$1" + printf "\x1B[%dG" $(( $column + 1 )) +} + +clear_to_end_of_line() { + printf "\x1B[K" +} + +advance() { + clear_to_end_of_line + echo + clear_color +} + +set_color() { + local color="$1" + local weight="$2" + printf "\x1B[%d;%dm" $(( 30 + $color )) "$( [ "$weight" = "bold" ] && echo 1 || echo 22 )" +} + +clear_color() { + printf "\x1B[0m" +} + +plural() { + [ "$1" -eq 1 ] || echo "s" +} + +_buffer="" + +buffer() { + _buffer="${_buffer}$("$@")" +} + +flush() { + printf "%s" "$_buffer" + _buffer="" +} + +finish() { + flush + printf "\n" +} + +trap finish EXIT + +while IFS= read -r line; do + case "$line" in + "begin "* ) + let index+=1 + name="${line#* $index }" + buffer begin + flush + ;; + "ok "* ) + skip_expr="ok $index # skip (\(([^)]*)\))?" + if [[ "$line" =~ $skip_expr ]]; then + let skipped+=1 + buffer skip "${BASH_REMATCH[2]}" + else + buffer pass + fi + ;; + "not ok "* ) + let failures+=1 + buffer fail + ;; + "# "* ) + buffer log "${line:2}" + ;; + esac +done + +buffer summary diff --git a/test/bats/vendor/bats-0.4.0/libexec/bats-preprocess b/test/bats/vendor/bats-0.4.0/libexec/bats-preprocess new file mode 100755 index 0000000..04297ed --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/libexec/bats-preprocess @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +set -e + +encode_name() { + local name="$1" + local result="test_" + + if [[ ! "$name" =~ [^[:alnum:]\ _-] ]]; then + name="${name//_/-5f}" + name="${name//-/-2d}" + name="${name// /_}" + result+="$name" + else + local length="${#name}" + local char i + + for ((i=0; i [ ...] + + is the path to a Bats test file, or the path to a directory +containing Bats test files. + + +DESCRIPTION +----------- + +Bats is a TAP-compliant testing framework for Bash. It provides a simple +way to verify that the UNIX programs you write behave as expected. + +A Bats test file is a Bash script with special syntax for defining +test cases. Under the hood, each test case is just a function with a +description. + +Test cases consist of standard shell commands. Bats makes use of +Bash's `errexit` (`set -e`) option when running test cases. If every +command in the test case exits with a `0` status code (success), the +test passes. In this way, each line is an assertion of truth. + +See `bats`(7) for more information on writing Bats tests. + + +RUNNING TESTS +------------- + +To run your tests, invoke the `bats` interpreter with a path to a test +file. The file's test cases are run sequentially and in isolation. If +all the test cases pass, `bats` exits with a `0` status code. If there +are any failures, `bats` exits with a `1` status code. + +You can invoke the `bats` interpreter with multiple test file arguments, +or with a path to a directory containing multiple `.bats` files. Bats +will run each test file individually and aggregate the results. If any +test case fails, `bats` exits with a `1` status code. + + +OPTIONS +------- + + * `-c`, `--count`: + Count the number of test cases without running any tests + * `-h`, `--help`: + Display help message + * `-p`, `--pretty`: + Show results in pretty format (default for terminals) + * `-t`, `--tap`: + Show results in TAP format + * `-v`, `--version`: + Display the version number + + +OUTPUT +------ + +When you run Bats from a terminal, you'll see output as each test is +performed, with a check-mark next to the test's name if it passes or +an "X" if it fails. + + $ bats addition.bats + ✓ addition using bc + ✓ addition using dc + + 2 tests, 0 failures + +If Bats is not connected to a terminal--in other words, if you run it +from a continuous integration system or redirect its output to a +file--the results are displayed in human-readable, machine-parsable +TAP format. You can force TAP output from a terminal by invoking Bats +with the `--tap` option. + + $ bats --tap addition.bats + 1..2 + ok 1 addition using bc + ok 2 addition using dc + + +EXIT STATUS +----------- + +The `bats` interpreter exits with a value of `0` if all test cases pass, +or `1` if one or more test cases fail. + + +SEE ALSO +-------- + +Bats wiki: _https://github.com/sstephenson/bats/wiki/_ + +`bash`(1), `bats`(7) + + +COPYRIGHT +--------- + +(c) 2014 Sam Stephenson + +Bats is released under the terms of an MIT-style license. + + + diff --git a/test/bats/vendor/bats-0.4.0/man/bats.7 b/test/bats/vendor/bats-0.4.0/man/bats.7 new file mode 100644 index 0000000..d0836e5 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/man/bats.7 @@ -0,0 +1,178 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "BATS" "7" "November 2013" "" "" +. +.SH "NAME" +\fBbats\fR \- Bats test file format +. +.SH "DESCRIPTION" +A Bats test file is a Bash script with special syntax for defining test cases\. Under the hood, each test case is just a function with a description\. +. +.IP "" 4 +. +.nf + +#!/usr/bin/env bats + +@test "addition using bc" { + result="$(echo 2+2 | bc)" + [ "$result" \-eq 4 ] +} + +@test "addition using dc" { + result="$(echo 2 2+p | dc)" + [ "$result" \-eq 4 ] +} +. +.fi +. +.IP "" 0 +. +.P +Each Bats test file is evaluated n+1 times, where \fIn\fR is the number of test cases in the file\. The first run counts the number of test cases, then iterates over the test cases and executes each one in its own process\. +. +.SH "THE RUN HELPER" +Many Bats tests need to run a command and then make assertions about its exit status and output\. Bats includes a \fBrun\fR helper that invokes its arguments as a command, saves the exit status and output into special global variables, and then returns with a \fB0\fR status code so you can continue to make assertions in your test case\. +. +.P +For example, let\'s say you\'re testing that the \fBfoo\fR command, when passed a nonexistent filename, exits with a \fB1\fR status code and prints an error message\. +. +.IP "" 4 +. +.nf + +@test "invoking foo with a nonexistent file prints an error" { + run foo nonexistent_filename + [ "$status" \-eq 1 ] + [ "$output" = "foo: no such file \'nonexistent_filename\'" ] +} +. +.fi +. +.IP "" 0 +. +.P +The \fB$status\fR variable contains the status code of the command, and the \fB$output\fR variable contains the combined contents of the command\'s standard output and standard error streams\. +. +.P +A third special variable, the \fB$lines\fR array, is available for easily accessing individual lines of output\. For example, if you want to test that invoking \fBfoo\fR without any arguments prints usage information on the first line: +. +.IP "" 4 +. +.nf + +@test "invoking foo without arguments prints usage" { + run foo + [ "$status" \-eq 1 ] + [ "${lines[0]}" = "usage: foo " ] +} +. +.fi +. +.IP "" 0 +. +.SH "THE LOAD COMMAND" +You may want to share common code across multiple test files\. Bats includes a convenient \fBload\fR command for sourcing a Bash source file relative to the location of the current test file\. For example, if you have a Bats test in \fBtest/foo\.bats\fR, the command +. +.IP "" 4 +. +.nf + +load test_helper +. +.fi +. +.IP "" 0 +. +.P +will source the script \fBtest/test_helper\.bash\fR in your test file\. This can be useful for sharing functions to set up your environment or load fixtures\. +. +.SH "THE SKIP COMMAND" +Tests can be skipped by using the \fBskip\fR command at the point in a test you wish to skip\. +. +.IP "" 4 +. +.nf + +@test "A test I don\'t want to execute for now" { + skip + run foo + [ "$status" \-eq 0 ] +} +. +.fi +. +.IP "" 0 +. +.P +Optionally, you may include a reason for skipping: +. +.IP "" 4 +. +.nf + +@test "A test I don\'t want to execute for now" { + skip "This command will return zero soon, but not now" + run foo + [ "$status" \-eq 0 ] +} +. +.fi +. +.IP "" 0 +. +.P +Or you can skip conditionally: +. +.IP "" 4 +. +.nf + +@test "A test which should run" { + if [ foo != bar ]; then + skip "foo isn\'t bar" + fi + + run foo + [ "$status" \-eq 0 ] +} +. +.fi +. +.IP "" 0 +. +.SH "SETUP AND TEARDOWN FUNCTIONS" +You can define special \fBsetup\fR and \fBteardown\fR functions which run before and after each test case, respectively\. Use these to load fixtures, set up your environment, and clean up when you\'re done\. +. +.SH "CODE OUTSIDE OF TEST CASES" +You can include code in your test file outside of \fB@test\fR functions\. For example, this may be useful if you want to check for dependencies and fail immediately if they\'re not present\. However, any output that you print in code outside of \fB@test\fR, \fBsetup\fR or \fBteardown\fR functions must be redirected to \fBstderr\fR (\fB>&2\fR)\. Otherwise, the output may cause Bats to fail by polluting the TAP stream on \fBstdout\fR\. +. +.SH "SPECIAL VARIABLES" +There are several global variables you can use to introspect on Bats tests: +. +.IP "\(bu" 4 +\fB$BATS_TEST_FILENAME\fR is the fully expanded path to the Bats test file\. +. +.IP "\(bu" 4 +\fB$BATS_TEST_DIRNAME\fR is the directory in which the Bats test file is located\. +. +.IP "\(bu" 4 +\fB$BATS_TEST_NAMES\fR is an array of function names for each test case\. +. +.IP "\(bu" 4 +\fB$BATS_TEST_NAME\fR is the name of the function containing the current test case\. +. +.IP "\(bu" 4 +\fB$BATS_TEST_DESCRIPTION\fR is the description of the current test case\. +. +.IP "\(bu" 4 +\fB$BATS_TEST_NUMBER\fR is the (1\-based) index of the current test case in the test file\. +. +.IP "\(bu" 4 +\fB$BATS_TMPDIR\fR is the location to a directory that may be used to store temporary files\. +. +.IP "" 0 +. +.SH "SEE ALSO" +\fBbash\fR(1), \fBbats\fR(1) diff --git a/test/bats/vendor/bats-0.4.0/man/bats.7.ronn b/test/bats/vendor/bats-0.4.0/man/bats.7.ronn new file mode 100644 index 0000000..7f6dd18 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/man/bats.7.ronn @@ -0,0 +1,156 @@ +bats(7) -- Bats test file format +================================ + + +DESCRIPTION +----------- + +A Bats test file is a Bash script with special syntax for defining +test cases. Under the hood, each test case is just a function with a +description. + + #!/usr/bin/env bats + + @test "addition using bc" { + result="$(echo 2+2 | bc)" + [ "$result" -eq 4 ] + } + + @test "addition using dc" { + result="$(echo 2 2+p | dc)" + [ "$result" -eq 4 ] + } + + +Each Bats test file is evaluated n+1 times, where _n_ is the number of +test cases in the file. The first run counts the number of test cases, +then iterates over the test cases and executes each one in its own +process. + + +THE RUN HELPER +-------------- + +Many Bats tests need to run a command and then make assertions about +its exit status and output. Bats includes a `run` helper that invokes +its arguments as a command, saves the exit status and output into +special global variables, and then returns with a `0` status code so +you can continue to make assertions in your test case. + +For example, let's say you're testing that the `foo` command, when +passed a nonexistent filename, exits with a `1` status code and prints +an error message. + + @test "invoking foo with a nonexistent file prints an error" { + run foo nonexistent_filename + [ "$status" -eq 1 ] + [ "$output" = "foo: no such file 'nonexistent_filename'" ] + } + +The `$status` variable contains the status code of the command, and +the `$output` variable contains the combined contents of the command's +standard output and standard error streams. + +A third special variable, the `$lines` array, is available for easily +accessing individual lines of output. For example, if you want to test +that invoking `foo` without any arguments prints usage information on +the first line: + + @test "invoking foo without arguments prints usage" { + run foo + [ "$status" -eq 1 ] + [ "${lines[0]}" = "usage: foo " ] + } + + +THE LOAD COMMAND +---------------- + +You may want to share common code across multiple test files. Bats +includes a convenient `load` command for sourcing a Bash source file +relative to the location of the current test file. For example, if you +have a Bats test in `test/foo.bats`, the command + + load test_helper + +will source the script `test/test_helper.bash` in your test file. This +can be useful for sharing functions to set up your environment or load +fixtures. + + +THE SKIP COMMAND +---------------- + +Tests can be skipped by using the `skip` command at the point in a +test you wish to skip. + + @test "A test I don't want to execute for now" { + skip + run foo + [ "$status" -eq 0 ] + } + +Optionally, you may include a reason for skipping: + + @test "A test I don't want to execute for now" { + skip "This command will return zero soon, but not now" + run foo + [ "$status" -eq 0 ] + } + +Or you can skip conditionally: + + @test "A test which should run" { + if [ foo != bar ]; then + skip "foo isn't bar" + fi + + run foo + [ "$status" -eq 0 ] + } + + +SETUP AND TEARDOWN FUNCTIONS +---------------------------- + +You can define special `setup` and `teardown` functions which run +before and after each test case, respectively. Use these to load +fixtures, set up your environment, and clean up when you're done. + + +CODE OUTSIDE OF TEST CASES +-------------------------- + +You can include code in your test file outside of `@test` functions. +For example, this may be useful if you want to check for dependencies +and fail immediately if they're not present. However, any output that +you print in code outside of `@test`, `setup` or `teardown` functions +must be redirected to `stderr` (`>&2`). Otherwise, the output may +cause Bats to fail by polluting the TAP stream on `stdout`. + + +SPECIAL VARIABLES +----------------- + +There are several global variables you can use to introspect on Bats +tests: + +* `$BATS_TEST_FILENAME` is the fully expanded path to the Bats test +file. +* `$BATS_TEST_DIRNAME` is the directory in which the Bats test file is +located. +* `$BATS_TEST_NAMES` is an array of function names for each test case. +* `$BATS_TEST_NAME` is the name of the function containing the current +test case. +* `$BATS_TEST_DESCRIPTION` is the description of the current test +case. +* `$BATS_TEST_NUMBER` is the (1-based) index of the current test case +in the test file. +* `$BATS_TMPDIR` is the location to a directory that may be used to +store temporary files. + + +SEE ALSO +-------- + +`bash`(1), `bats`(1) diff --git a/test/bats/vendor/bats-0.4.0/package.json b/test/bats/vendor/bats-0.4.0/package.json new file mode 100644 index 0000000..2183feb --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/package.json @@ -0,0 +1,9 @@ +{ + "name": "bats", + "version": "0.3.1", + "description": "Bash Automated Testing System", + "global": "true", + "install": "./install.sh /usr/local", + "scripts": [ "libexec/bats", "libexec/bats-exec-suite", "libexec/bats-exec-test", "libexec/bats-format-tap-stream", "libexec/bats-preprocess", "bin/bats" ] +} + diff --git a/test/bats/vendor/bats-0.4.0/test/bats.bats b/test/bats/vendor/bats-0.4.0/test/bats.bats new file mode 100755 index 0000000..280515d --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/bats.bats @@ -0,0 +1,258 @@ +#!/usr/bin/env bats + +load test_helper +fixtures bats + +@test "no arguments prints usage instructions" { + run bats + [ $status -eq 1 ] + [ $(expr "${lines[1]}" : "Usage:") -ne 0 ] +} + +@test "-v and --version print version number" { + run bats -v + [ $status -eq 0 ] + [ $(expr "$output" : "Bats [0-9][0-9.]*") -ne 0 ] +} + +@test "-h and --help print help" { + run bats -h + [ $status -eq 0 ] + [ "${#lines[@]}" -gt 3 ] +} + +@test "invalid filename prints an error" { + run bats nonexistent + [ $status -eq 1 ] + [ $(expr "$output" : ".*does not exist") -ne 0 ] +} + +@test "empty test file runs zero tests" { + run bats "$FIXTURE_ROOT/empty.bats" + [ $status -eq 0 ] + [ $output = "1..0" ] +} + +@test "one passing test" { + run bats "$FIXTURE_ROOT/passing.bats" + [ $status -eq 0 ] + [ ${lines[0]} = "1..1" ] + [ ${lines[1]} = "ok 1 a passing test" ] +} + +@test "summary passing tests" { + run filter_control_sequences bats -p $FIXTURE_ROOT/passing.bats + [ $status -eq 0 ] + [ "${lines[1]}" = "1 test, 0 failures" ] +} + +@test "summary passing and skipping tests" { + run filter_control_sequences bats -p $FIXTURE_ROOT/passing_and_skipping.bats + [ $status -eq 0 ] + [ "${lines[2]}" = "2 tests, 0 failures, 1 skipped" ] +} + +@test "summary passing and failing tests" { + run filter_control_sequences bats -p $FIXTURE_ROOT/failing_and_passing.bats + [ $status -eq 0 ] + [ "${lines[4]}" = "2 tests, 1 failure" ] +} + +@test "summary passing, failing and skipping tests" { + run filter_control_sequences bats -p $FIXTURE_ROOT/passing_failing_and_skipping.bats + [ $status -eq 0 ] + [ "${lines[5]}" = "3 tests, 1 failure, 1 skipped" ] +} + +@test "one failing test" { + run bats "$FIXTURE_ROOT/failing.bats" + [ $status -eq 1 ] + [ "${lines[0]}" = '1..1' ] + [ "${lines[1]}" = 'not ok 1 a failing test' ] + [ "${lines[2]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/failing.bats, line 4)" ] + [ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed" ] +} + +@test "one failing and one passing test" { + run bats "$FIXTURE_ROOT/failing_and_passing.bats" + [ $status -eq 1 ] + [ "${lines[0]}" = '1..2' ] + [ "${lines[1]}" = 'not ok 1 a failing test' ] + [ "${lines[2]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/failing_and_passing.bats, line 2)" ] + [ "${lines[3]}" = "# \`false' failed" ] + [ "${lines[4]}" = 'ok 2 a passing test' ] +} + +@test "failing test with significant status" { + STATUS=2 run bats "$FIXTURE_ROOT/failing.bats" + [ $status -eq 1 ] + [ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed with status 2" ] +} + +@test "failing helper function logs the test case's line number" { + run bats "$FIXTURE_ROOT/failing_helper.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'not ok 1 failing helper function' ] + [ "${lines[2]}" = "# (from function \`failing_helper' in file $RELATIVE_FIXTURE_ROOT/test_helper.bash, line 6," ] + [ "${lines[3]}" = "# in test file $RELATIVE_FIXTURE_ROOT/failing_helper.bats, line 5)" ] + [ "${lines[4]}" = "# \`failing_helper' failed" ] +} + +@test "test environments are isolated" { + run bats "$FIXTURE_ROOT/environment.bats" + [ $status -eq 0 ] +} + +@test "setup is run once before each test" { + rm -f "$TMP/setup.log" + run bats "$FIXTURE_ROOT/setup.bats" + [ $status -eq 0 ] + run cat "$TMP/setup.log" + [ ${#lines[@]} -eq 3 ] +} + +@test "teardown is run once after each test, even if it fails" { + rm -f "$TMP/teardown.log" + run bats "$FIXTURE_ROOT/teardown.bats" + [ $status -eq 1 ] + run cat "$TMP/teardown.log" + [ ${#lines[@]} -eq 3 ] +} + +@test "setup failure" { + run bats "$FIXTURE_ROOT/failing_setup.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'not ok 1 truth' ] + [ "${lines[2]}" = "# (from function \`setup' in test file $RELATIVE_FIXTURE_ROOT/failing_setup.bats, line 2)" ] + [ "${lines[3]}" = "# \`false' failed" ] +} + +@test "passing test with teardown failure" { + PASS=1 run bats "$FIXTURE_ROOT/failing_teardown.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'not ok 1 truth' ] + [ "${lines[2]}" = "# (from function \`teardown' in test file $RELATIVE_FIXTURE_ROOT/failing_teardown.bats, line 2)" ] + [ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed" ] +} + +@test "failing test with teardown failure" { + PASS=0 run bats "$FIXTURE_ROOT/failing_teardown.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'not ok 1 truth' ] + [ "${lines[2]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/failing_teardown.bats, line 6)" ] + [ "${lines[3]}" = $'# `[ "$PASS" = "1" ]\' failed' ] +} + +@test "teardown failure with significant status" { + PASS=1 STATUS=2 run bats "$FIXTURE_ROOT/failing_teardown.bats" + [ $status -eq 1 ] + [ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed with status 2" ] +} + +@test "failing test file outside of BATS_CWD" { + cd "$TMP" + run bats "$FIXTURE_ROOT/failing.bats" + [ $status -eq 1 ] + [ "${lines[2]}" = "# (in test file $FIXTURE_ROOT/failing.bats, line 4)" ] +} + +@test "load sources scripts relative to the current test file" { + run bats "$FIXTURE_ROOT/load.bats" + [ $status -eq 0 ] +} + +@test "load aborts if the specified script does not exist" { + HELPER_NAME="nonexistent" run bats "$FIXTURE_ROOT/load.bats" + [ $status -eq 1 ] +} + +@test "load sources scripts by absolute path" { + HELPER_NAME="${FIXTURE_ROOT}/test_helper.bash" run bats "$FIXTURE_ROOT/load.bats" + [ $status -eq 0 ] +} + +@test "load aborts if the script, specified by an absolute path, does not exist" { + HELPER_NAME="${FIXTURE_ROOT}/nonexistent" run bats "$FIXTURE_ROOT/load.bats" + [ $status -eq 1 ] +} + +@test "output is discarded for passing tests and printed for failing tests" { + run bats "$FIXTURE_ROOT/output.bats" + [ $status -eq 1 ] + [ "${lines[6]}" = '# failure stdout 1' ] + [ "${lines[7]}" = '# failure stdout 2' ] + [ "${lines[11]}" = '# failure stderr' ] +} + +@test "-c prints the number of tests" { + run bats -c "$FIXTURE_ROOT/empty.bats" + [ $status -eq 0 ] + [ "$output" = "0" ] + + run bats -c "$FIXTURE_ROOT/output.bats" + [ $status -eq 0 ] + [ "$output" = "4" ] +} + +@test "dash-e is not mangled on beginning of line" { + run bats "$FIXTURE_ROOT/intact.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = "ok 1 dash-e on beginning of line" ] +} + +@test "dos line endings are stripped before testing" { + run bats "$FIXTURE_ROOT/dos_line.bats" + [ $status -eq 0 ] +} + +@test "test file without trailing newline" { + run bats "$FIXTURE_ROOT/without_trailing_newline.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = "ok 1 truth" ] +} + +@test "skipped tests" { + run bats "$FIXTURE_ROOT/skipped.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = "ok 1 # skip a skipped test" ] + [ "${lines[2]}" = "ok 2 # skip (a reason) a skipped test with a reason" ] +} + +@test "extended syntax" { + run bats-exec-test -x "$FIXTURE_ROOT/failing_and_passing.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'begin 1 a failing test' ] + [ "${lines[2]}" = 'not ok 1 a failing test' ] + [ "${lines[5]}" = 'begin 2 a passing test' ] + [ "${lines[6]}" = 'ok 2 a passing test' ] +} + +@test "pretty and tap formats" { + run bats --tap "$FIXTURE_ROOT/passing.bats" + tap_output="$output" + [ $status -eq 0 ] + + run bats --pretty "$FIXTURE_ROOT/passing.bats" + pretty_output="$output" + [ $status -eq 0 ] + + [ "$tap_output" != "$pretty_output" ] +} + +@test "pretty formatter bails on invalid tap" { + run bats --tap "$FIXTURE_ROOT/invalid_tap.bats" + [ $status -eq 1 ] + [ "${lines[0]}" = "This isn't TAP!" ] + [ "${lines[1]}" = "Good day to you" ] +} + +@test "single-line tests" { + run bats "$FIXTURE_ROOT/single_line.bats" + [ $status -eq 1 ] + [ "${lines[1]}" = 'ok 1 empty' ] + [ "${lines[2]}" = 'ok 2 passing' ] + [ "${lines[3]}" = 'ok 3 input redirection' ] + [ "${lines[4]}" = 'not ok 4 failing' ] + [ "${lines[5]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/single_line.bats, line 9)" ] + [ "${lines[6]}" = $'# `@test "failing" { false; }\' failed' ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/dos_line.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/dos_line.bats new file mode 100644 index 0000000..b5f65c6 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/dos_line.bats @@ -0,0 +1,3 @@ +@test "foo" { + echo "foo" +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/empty.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/empty.bats new file mode 100644 index 0000000..e69de29 diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/environment.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/environment.bats new file mode 100644 index 0000000..8d3b984 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/environment.bats @@ -0,0 +1,8 @@ +@test "setting a variable" { + variable=1 + [ $variable -eq 1 ] +} + +@test "variables do not persist across tests" { + [ -z "$variable" ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing.bats new file mode 100644 index 0000000..13be78c --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing.bats @@ -0,0 +1,5 @@ +@test "a failing test" { + true + true + eval "( exit ${STATUS:-1} )" +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_and_passing.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_and_passing.bats new file mode 100644 index 0000000..5513a9b --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_and_passing.bats @@ -0,0 +1,7 @@ +@test "a failing test" { + false +} + +@test "a passing test" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_helper.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_helper.bats new file mode 100644 index 0000000..fb5726f --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_helper.bats @@ -0,0 +1,6 @@ +load "test_helper" + +@test "failing helper function" { + true + failing_helper +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_setup.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_setup.bats new file mode 100644 index 0000000..9a35587 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_setup.bats @@ -0,0 +1,7 @@ +setup() { + false +} + +@test "truth" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_teardown.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_teardown.bats new file mode 100644 index 0000000..28eebf6 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/failing_teardown.bats @@ -0,0 +1,7 @@ +teardown() { + eval "( exit ${STATUS:-1} )" +} + +@test "truth" { + [ "$PASS" = "1" ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/intact.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/intact.bats new file mode 100644 index 0000000..c25c28c --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/intact.bats @@ -0,0 +1,6 @@ +@test "dash-e on beginning of line" { + run cat - <&2 +} + +@test "failure writing to stdout" { + echo "failure stdout 1" + echo "failure stdout 2" + false +} + +@test "failure writing to stderr" { + echo "failure stderr" >&2 + false +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing.bats new file mode 100644 index 0000000..e8182ce --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing.bats @@ -0,0 +1,3 @@ +@test "a passing test" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_failing.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_failing.bats new file mode 100644 index 0000000..7b7d8ee --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_failing.bats @@ -0,0 +1,7 @@ +@test "a passing test" { + true +} + +@test "a failing test" { + false +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_skipping.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_skipping.bats new file mode 100644 index 0000000..88d74be --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_and_skipping.bats @@ -0,0 +1,7 @@ +@test "a passing test" { + true +} + +@test "a skipping test" { + skip +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_failing_and_skipping.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_failing_and_skipping.bats new file mode 100644 index 0000000..3c9f17f --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/passing_failing_and_skipping.bats @@ -0,0 +1,11 @@ +@test "a passing test" { + true +} + +@test "a skipping test" { + skip +} + +@test "a failing test" { + false +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/setup.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/setup.bats new file mode 100644 index 0000000..3cc52cc --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/setup.bats @@ -0,0 +1,17 @@ +LOG="$TMP/setup.log" + +setup() { + echo "$BATS_TEST_NAME" >> "$LOG" +} + +@test "one" { + [ "$(tail -n 1 "$LOG")" = "test_one" ] +} + +@test "two" { + [ "$(tail -n 1 "$LOG")" = "test_two" ] +} + +@test "three" { + [ "$(tail -n 1 "$LOG")" = "test_three" ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/single_line.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/single_line.bats new file mode 100644 index 0000000..fc342d9 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/single_line.bats @@ -0,0 +1,9 @@ +@test "empty" { } + +@test "passing" { true; } + +@test "input redirection" { diff - <( echo hello ); } <> "$LOG" +} + +@test "one" { + true +} + +@test "two" { + false +} + +@test "three" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/test_helper.bash b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/test_helper.bash new file mode 100644 index 0000000..530d034 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/test_helper.bash @@ -0,0 +1,7 @@ +help_me() { + true +} + +failing_helper() { + false +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/bats/without_trailing_newline.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/without_trailing_newline.bats new file mode 100644 index 0000000..e3ace8b --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/bats/without_trailing_newline.bats @@ -0,0 +1,3 @@ +@test "truth" { + true +} \ No newline at end of file diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/suite/empty/.gitkeep b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/empty/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/a.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/a.bats new file mode 100644 index 0000000..fbc1f38 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/a.bats @@ -0,0 +1,3 @@ +@test "truth" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/b.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/b.bats new file mode 100644 index 0000000..bb965a4 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/multiple/b.bats @@ -0,0 +1,7 @@ +@test "more truth" { + true +} + +@test "quasi-truth" { + [ -z "$FLUNK" ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/fixtures/suite/single/test.bats b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/single/test.bats new file mode 100644 index 0000000..e8182ce --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/fixtures/suite/single/test.bats @@ -0,0 +1,3 @@ +@test "a passing test" { + true +} diff --git a/test/bats/vendor/bats-0.4.0/test/suite.bats b/test/bats/vendor/bats-0.4.0/test/suite.bats new file mode 100755 index 0000000..14f5008 --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/suite.bats @@ -0,0 +1,64 @@ +#!/usr/bin/env bats + +load test_helper +fixtures suite + +@test "running a suite with no test files" { + run bats "$FIXTURE_ROOT/empty" + [ $status -eq 0 ] + [ $output = "1..0" ] +} + +@test "running a suite with one test file" { + run bats "$FIXTURE_ROOT/single" + [ $status -eq 0 ] + [ ${lines[0]} = "1..1" ] + [ ${lines[1]} = "ok 1 a passing test" ] +} + +@test "counting tests in a suite" { + run bats -c "$FIXTURE_ROOT/single" + [ $status -eq 0 ] + [ $output -eq 1 ] + + run bats -c "$FIXTURE_ROOT/multiple" + [ $status -eq 0 ] + [ $output -eq 3 ] +} + +@test "aggregated output of multiple tests in a suite" { + run bats "$FIXTURE_ROOT/multiple" + [ $status -eq 0 ] + [ ${lines[0]} = "1..3" ] + echo "$output" | grep "^ok . truth" + echo "$output" | grep "^ok . more truth" + echo "$output" | grep "^ok . quasi-truth" +} + +@test "a failing test in a suite results in an error exit code" { + FLUNK=1 run bats "$FIXTURE_ROOT/multiple" + [ $status -eq 1 ] + [ ${lines[0]} = "1..3" ] + echo "$output" | grep "^not ok . quasi-truth" +} + +@test "running an ad-hoc suite by specifying multiple test files" { + run bats "$FIXTURE_ROOT/multiple/a.bats" "$FIXTURE_ROOT/multiple/b.bats" + [ $status -eq 0 ] + [ ${lines[0]} = "1..3" ] + echo "$output" | grep "^ok . truth" + echo "$output" | grep "^ok . more truth" + echo "$output" | grep "^ok . quasi-truth" +} + +@test "extended syntax in suite" { + FLUNK=1 run bats-exec-suite -x "$FIXTURE_ROOT/multiple/"*.bats + [ $status -eq 1 ] + [ "${lines[0]}" = "1..3" ] + [ "${lines[1]}" = "begin 1 truth" ] + [ "${lines[2]}" = "ok 1 truth" ] + [ "${lines[3]}" = "begin 2 more truth" ] + [ "${lines[4]}" = "ok 2 more truth" ] + [ "${lines[5]}" = "begin 3 quasi-truth" ] + [ "${lines[6]}" = "not ok 3 quasi-truth" ] +} diff --git a/test/bats/vendor/bats-0.4.0/test/test_helper.bash b/test/bats/vendor/bats-0.4.0/test/test_helper.bash new file mode 100644 index 0000000..84eee8c --- /dev/null +++ b/test/bats/vendor/bats-0.4.0/test/test_helper.bash @@ -0,0 +1,16 @@ +fixtures() { + FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/$1" + RELATIVE_FIXTURE_ROOT="$(bats_trim_filename "$FIXTURE_ROOT")" +} + +setup() { + export TMP="$BATS_TEST_DIRNAME/tmp" +} + +filter_control_sequences() { + "$@" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' +} + +teardown() { + [ -d "$TMP" ] && rm -f "$TMP"/* +}