From 855589c19eff9b6f31f64c61f050d820fa185ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Sun, 6 Jan 2019 13:08:03 +0100 Subject: [PATCH 1/3] Remove warning passing arguments to find --- assets/runtime/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/runtime/functions.sh b/assets/runtime/functions.sh index 50847d4..78ace20 100755 --- a/assets/runtime/functions.sh +++ b/assets/runtime/functions.sh @@ -105,7 +105,7 @@ function setup_salt_keys() salt-key --gen-signature --auto-create --pub ${SALT_KEYS_DIR}/master.pub --signature-path ${SALT_KEYS_DIR} fi - for pub_key in $(find ${SALT_KEYS_DIR} -type f -maxdepth 1); do + for pub_key in $(find ${SALT_KEYS_DIR} -maxdepth 1 -type f); do if [[ ${pub_key} =~ .*\.pem$ ]]; then chmod 400 ${pub_key} else @@ -113,7 +113,7 @@ function setup_salt_keys() fi done - find ${SALT_KEYS_DIR}/minions* -type f -maxdepth 1 -exec chmod 644 {} \; + find ${SALT_KEYS_DIR}/minions* -maxdepth 1 -type f -exec chmod 644 {} \; find ${SALT_HOME} -path ${SALT_KEYS_DIR}/\* -prune -o -print0 | xargs -0 chown -h ${SALT_USER}: } From b33e12a647c66cb1515e65983d1d0ee573ffe570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Sun, 6 Jan 2019 13:08:24 +0100 Subject: [PATCH 2/3] Bugfix selecting salt logs for logrotate --- assets/runtime/functions.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/assets/runtime/functions.sh b/assets/runtime/functions.sh index 78ace20..a452159 100755 --- a/assets/runtime/functions.sh +++ b/assets/runtime/functions.sh @@ -202,9 +202,7 @@ function configure_logrotate() { echo "Configuring logrotate ..." - if [[ -f /etc/logrotate.d/salt-common ]]; then - rm /etc/logrotate.d/salt-common - fi + rm -f /etc/logrotate.d/salt-common # configure supervisord log rotation cat > /etc/logrotate.d/supervisord < /etc/logrotate.d/salt < Date: Sun, 6 Jan 2019 13:19:52 +0100 Subject: [PATCH 3/3] Add CircleCI configuration --- .circleci/config.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..b993837 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,64 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/golang:1-stretch-browsers-legacy + environment: + IMAGE_NAME: "cdalvaro/saltstack-master" + + steps: + - checkout + + - setup_remote_docker: + version: 18.03.1-ce + + - run: + name: Docker info + command: | + docker version + docker info + - restore_cache: + keys: + - cache-v2-{{ .Branch }} + paths: + - /tmp/cache/layers.tar + + - run: + name: Loading docker cache + command: | + if [[ -f /tmp/cache/layers.tar ]]; then + echo "Loading cache ..." + docker load -i /tmp/cache/layers.tar + docker image ls + else + echo "Couldn't find any caches" + fi + - run: + name: Build docker image + command: | + docker build \ + --pull \ + --cache-from=${IMAGE_NAME} \ + --build-arg BUILD_DATE="$(date +"%Y-%m-%d %H:%M:%S%:z")" \ + --build-arg VCS_REF=$(git rev-parse --short HEAD) \ + -t ${IMAGE_NAME}:$(cat VERSION) . + - run: + name: Launching container for testing + command: | + docker run --rm --detach --name saltstack-master ${IMAGE_NAME}:$(cat VERSION) + sleep 120 + - run: + name: Generate docker build image cache + command: | + mkdir -p /tmp/cache/ + docker save -o /tmp/cache/layers.tar ${IMAGE_NAME} + - save_cache: + key: cache-v2-{{ .Branch }} + paths: + - /tmp/cache/layers.tar + +workflows: + version: 2 + build: + jobs: + - build \ No newline at end of file