From ee6a1b0cbdd0a280aa4ea26968109b93ff25551f Mon Sep 17 00:00:00 2001 From: yage Date: Sat, 1 Oct 2022 12:58:39 -0600 Subject: [PATCH] docker + circleci autobuild; fixed a bug when missing Projects directory --- .circleci/config.yml | 24 ++++++++++++++++++ .docker/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++ config/code-activator.conf | 2 +- setup/git.zsh | 32 ++++++++++++++++++++++++ setup/requirements.zsh | 1 + setup/run | 3 ++- 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .docker/Dockerfile create mode 100644 setup/git.zsh diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9a0addd --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,24 @@ +--- +version: 2.1 + +jobs: + deploy: + docker: + - img: cimg/base:stable + steps: + - checkout + - run: docker build . -t blaziken734/debugger -f .docker/Dockerfile + - run: echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin + - run: docker push blaziken734/debugger + +workflows: + version: 2 + main: + jobs: + - deploy: + context: + - yage-docker + filters: + branches: + only: + - main diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 0000000..5aad85a --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,50 @@ +FROM python:alpine +WORKDIR /root + +RUN : \ + && apk add --update --no-cache \ + aws-cli \ + binutils \ + coreutils \ + curl \ + findutils \ + fzf \ + gawk \ + git \ + grep \ + iproute2 \ + ncurses \ + ncurses-terminfo \ + nodejs \ + npm \ + openssh \ + pciutils \ + postgresql \ + redis \ + ripgrep \ + sed \ + tmux \ + usbutils \ + util-linux \ + vim \ + wget \ + zsh \ + && apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ + helm \ + kubectl \ + && mkdir -p /root/.wryn \ + ; + +COPY . /root/.wryn + +RUN : \ + && /bin/zsh -c '/root/.wryn/setup/run --no-fluff --ci --force-root' \ + && echo 'hostnamectl() { echo docker; }' > $HOME/.config/wryn/env.zsh \ + && echo 'source /root/.wryn/config/dotwryn.env.zsh' >> $HOME/.config/wryn/env.zsh \ + && echo 'WELCOME() {}' >> $HOME/.config/wryn/env.zsh \ + && echo "PS1_INDICATOR_SYMBOL=''" >> $HOME/.config/wryn/env.zsh \ + && echo "PS1_USER='root@debugger'" >> $HOME/.config/wryn/env.zsh \ + && rm /root/dotwryn-install.log \ + ; + +CMD ["zsh"] diff --git a/config/code-activator.conf b/config/code-activator.conf index f46f43f..8f472a2 100644 --- a/config/code-activator.conf +++ b/config/code-activator.conf @@ -6,7 +6,7 @@ # # directories must be fully-qualified CA__DIRS=( - $(find "$HOME/Projects" -mindepth 1 -maxdepth 1 -type d | sed 's/\/$//') + $([ -d "$HOME/Projects" ] && find "$HOME/Projects" -mindepth 1 -maxdepth 1 -type d | sed 's/\/$//') ) # additional cloning targets; MUST END IN ':' or '/' diff --git a/setup/git.zsh b/setup/git.zsh new file mode 100644 index 0000000..1056e9a --- /dev/null +++ b/setup/git.zsh @@ -0,0 +1,32 @@ +##################################################################### + +SETUP__GIT() { + __STATUS 'updating remotes for .wryn' + cd $DOTWRYN_PATH + git remote rm origin 2>/dev/null + git remote add origin git@github.com:wrynegade/dotwryn.git + git remote set-url --add --push origin git@github.com:wrynegade/dotwryn.git + git remote set-url --add --push origin git@yage.io:wrynegade/dotwryn.git + git remote set-url --add --push origin git@bitbucket.org:wrynegade/dotwryn.git + + __STATUS 'updating upstream for zsh/plugins/code-activator' + cd $DOTWRYN_PATH/zsh/plugins/code-activator + git remote rm upstream 2>/dev/null + git remote add upstream git@yage.io:zsh/code-activator.git + git remote set-url --add --push upstream git@yage.io:zsh/code-activator.git + git remote set-url --add --push upstream git@github.com:wrynegade/code-activator-zsh.git + + __STATUS 'updating upstream for zsh/plugins/scwrypts' + cd $DOTWRYN_PATH/zsh/plugins/scwrypts + git remote rm upstream 2>/dev/null + git remote add upstream git@yage.io:zsh/code-activator + git remote set-url --add --push upstream git@yage.io:zsh/code-activator + git remote set-url --add --push upstream git@github.com:wrynegade/scwrypts.git + + __STATUS 'updating upstream for zsh/plugins/ssh' + cd $DOTWRYN_PATH/zsh/plugins/ssh + git remote rm upstream + git remote add upstream git@yage.io:zsh/ssh.git + + cd $DOTWRYN_PATH +} diff --git a/setup/requirements.zsh b/setup/requirements.zsh index 54b53cb..2cdbee8 100644 --- a/setup/requirements.zsh +++ b/setup/requirements.zsh @@ -31,6 +31,7 @@ SCWRYPTS() { ##################################################################### source "$DOTWRYN_PATH/setup/os.zsh" +source "$DOTWRYN_PATH/setup/git.zsh" source "$DOTWRYN_PATH/setup/config.zsh" ##################################################################### diff --git a/setup/run b/setup/run index 4a5a0b8..62f3f26 100755 --- a/setup/run +++ b/setup/run @@ -20,7 +20,8 @@ LOGFILE="$HOME/dotwryn-install.log" __INFO "installation start : $(date)" 2>> "$LOGFILE" { SETUP__OS || __FAIL 1 'failed to set up os-dependencies (see above)' - SETUP__CONFIG || __FAIL 2 'failed to set up program configuration (see above)' + SETUP__GIT || __FAIL 2 'failed to set up git (see above)' + SETUP__CONFIG || __FAIL 3 'failed to set up program configuration (see above)' } 2>&1 | tee --append "$LOGFILE" __INFO "installation complete: $(date)" 2>> "$LOGFILE"