Skip to content

Commit

Permalink
Fix/zsh compatability for tools (#26)
Browse files Browse the repository at this point in the history
* fix: account for zsh and enable addition of other shells
  • Loading branch information
fernandoataoldotcom authored Sep 26, 2023
1 parent 4f895d2 commit 2056242
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ ARG VERSION_ARGO_CD_CLI=2.8.3
# https://github.com/GlueOps/terraform-module-kubernetes-hashicorp-vault-configuration/wiki
ENV VAULT_SKIP_VERIFY true
ENV CLOUDSDK_INSTALL_DIR /usr/local/gcloud/
ADD ../tools/add-to-bashrc.sh /tmp/add-to-bashrc.sh
RUN chmod +x /tmp/add-to-bashrc.sh && ./tmp/add-to-bashrc.sh
COPY ../tools/tools.sh /etc/tools.sh
COPY ../tools/add-tools-to-shells.sh /tmp/add-tools-to-shells.sh
RUN chmod +x /tmp/add-tools-to-shells.sh && /tmp/add-tools-to-shells.sh
RUN curl -Lo /usr/local/bin/kubectl https://dl.k8s.io/release/v${VERSION_KUBECTL}/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl \
&& curl -Lo terraform_${VERSION_TERRAFORM}_linux_amd64.zip https://releases.hashicorp.com/terraform/${VERSION_TERRAFORM}/terraform_${VERSION_TERRAFORM}_linux_amd64.zip \
Expand Down
16 changes: 16 additions & 0 deletions .devcontainer/tools/add-tools-to-shells.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

tools_file="/etc/tools.sh"

add_tools_to_shell() {
local rc_file="$1"
if [ -f "$rc_file" ]; then
echo "source $tools_file" >> "$rc_file"
fi
}

# bash
add_tools_to_shell "$HOME/.bashrc"

# zsh
add_tools_to_shell "$HOME/.zshrc"
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash


echo '
run-gha() {
#https://stackoverflow.com/questions/6245570/how-do-i-get-the-current-branch-name-in-git
gh workflow run --ref=$(git rev-parse --abbrev-ref HEAD)
Expand Down Expand Up @@ -82,4 +79,3 @@ create-ghcr-regcred() {

echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$b64_enc_regcred\"}}}"
}
' >> /home/vscode/.bashrc

0 comments on commit 2056242

Please sign in to comment.