balena-cloud-apps 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.circleci/build.sh +20 -0
  2. package/.circleci/config.yml +40 -0
  3. package/.gitattributes +2 -0
  4. package/LICENSE +201 -0
  5. package/README.md +79 -0
  6. package/README.md~ +27 -0
  7. package/aarch64.env +4 -0
  8. package/armhf.env +4 -0
  9. package/common.env +2 -0
  10. package/docker-compose.aarch64 +0 -0
  11. package/docker-compose.yml +0 -0
  12. package/index.js +13 -0
  13. package/package-lock.json.moved +372 -0
  14. package/package.json +40 -0
  15. package/test/build/aarch64.env +4 -0
  16. package/test/build/armhf.env +4 -0
  17. package/test/build/common.env +2 -0
  18. package/test/build/deployment/images/dind-php7/Dockerfile.aarch64 +62 -0
  19. package/test/build/deployment/images/dind-php7/Dockerfile.armhf +62 -0
  20. package/test/build/deployment/images/dind-php7/Dockerfile.template +62 -0
  21. package/test/build/deployment/images/dind-php7/Dockerfile.x86_64 +62 -0
  22. package/test/build/deployment/images/dind-php7/README.md +2 -0
  23. package/test/build/docker-compose.aarch64 +7 -0
  24. package/test/build/docker-compose.armhf +7 -0
  25. package/test/build/docker-compose.x86_64 +7 -0
  26. package/test/build/docker-compose.yml +7 -0
  27. package/test/build/submodule/Dockerfile.aarch64 +11 -0
  28. package/test/build/submodule/Dockerfile.armhf +11 -0
  29. package/test/build/submodule/Dockerfile.template +11 -0
  30. package/test/build/submodule/Dockerfile.x86_64 +11 -0
  31. package/test/build/x86_64.env +4 -0
  32. package/test/build-test.sh +64 -0
  33. package/vendor/autoload.php +7 -0
  34. package/vendor/cni/auto_reboot.sh +98 -0
  35. package/vendor/cni/balena_deploy.sh +303 -0
  36. package/vendor/cni/docker_build.sh +63 -0
  37. package/vendor/cni/init_functions.sh +67 -0
  38. package/vendor/cni/post_install.sh +12 -0
  39. package/x86_64.env +4 -0
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ [ "$#" -eq 0 ] && echo "usage $0 \${BASH_SOURCE[0]} <args>" && exit 0
3
+ banner=("" "[$0] BASH ${BASH_SOURCE[0]}" ""); printf "%s\n" "${banner[@]}"
4
+ function log_daemon_msg() {
5
+ printf "* %s\n" "$@"
6
+ }
7
+ function log_progress_msg() {
8
+ printf "+ %s\n" "$@"
9
+ }
10
+ function log_warning_msg() {
11
+ printf "! %s\n" "$@"
12
+ }
13
+ function log_failure_msg() {
14
+ printf "[!] %s\n" "$@"
15
+ }
16
+ function log_success_msg() {
17
+ printf "[*] %s\n" "$@"
18
+ }
19
+ function log_end_msg() {
20
+ case "$1" in
21
+ 0)
22
+ printf "[>] %s\n" "[OK]"
23
+ ;;
24
+ [1-9]+)
25
+ printf "[x] %s\n" "[fail]"
26
+ ;;
27
+ *) printf "%s\n" "$@"
28
+ ;;
29
+ esac
30
+ }
31
+ if [ -f /lib/lsb/init-functions ]; then
32
+ # lsb-base package (not available in alpine linux)
33
+ # shellcheck disable=SC1091
34
+ . /lib/lsb/init-functions
35
+ fi
36
+ # Dsiplay message with time and thread if logger debug Kit available
37
+ function slogger() {
38
+ [ -f /dev/log ] && logger "$@" && return
39
+ [ "$#" -gt 1 ] && shift
40
+ log_daemon_msg "$@"
41
+ }
42
+ function log_size() {
43
+ [ "$#" = 0 ] && log_failure_msg "File not found" && return
44
+ printf "num_entries=%s\n" "$(wc -l "$1" | awk '{ print $1 }')"
45
+ }
46
+ # Journal rotation
47
+ LOG_MAX_ROLLOUT=${LOG_MAX_ROLLOUT:-500}
48
+
49
+ # @param 1 folder
50
+ # @param 2 filename
51
+ function new_log() {
52
+ temp="/tmp/log/$(basename "$0" .sh)"
53
+ LOG="$(cd "${1:-$temp}" && pwd)/${2:-"$(date +%Y-%m-%d_%H:%M).log"}" \
54
+ && mkdir -p "$(dirname "$LOG")"
55
+ touch "$LOG" && chmod 1777 "$LOG" # sticky bit
56
+ if [ -n "${DEBUG:-}" ] && [ "$(log_size "$LOG" | cut -d= -f2)" -gt "$LOG_MAX_ROLLOUT" ]; then
57
+ mv "$LOG" "$LOG.$(date +%Y-%m-%d_%H:%M)" && new_log "$@"
58
+ return
59
+ fi
60
+ # return value
61
+ printf "%s\n" "$LOG"
62
+ }
63
+ function check_log() {
64
+ if [ -n "${DEBUG:-}" ] && [[ $(wc -l "$LOG" | awk '{ print $1 }') -gt 0 ]]; then
65
+ log_daemon_msg "Find the log file at $LOG and read more detailed information."
66
+ fi
67
+ }
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+ chmod -R +w .
3
+ npm init --yes
4
+ npm link balena-cloud
5
+ cp node_modules/balena-cloud/test/build/*.env .
6
+ read -r -a BALENA_PROJECTS < <(find . -name "Dockerfile*" | awk -F"/Dockerfile" '{ print $1 }' | uniq | xargs)
7
+ printf "Found %s BALENA_PROJECTS(" "${#BALENA_PROJECTS}"
8
+ printf "%s " "${BALENA_PROJECTS[@]}"
9
+ printf " )\n"
10
+ sed -i.old -E -e "s#(BALENA_PROJECTS)=(.*))#\\1=\(${BALENA_PROJECTS[*]}\) \#\\2#" common.env
11
+ cat common.env
12
+ printf "Ready to <( balena_deploy . \n"
package/x86_64.env ADDED
@@ -0,0 +1,4 @@
1
+ DKR_ARCH=x86_64
2
+ BALENA_MACHINE_NAME=intel-nuc
3
+ IMG_TAG=latest
4
+ PRIMARY_HUB=betothreeprod\\/intel-nuc