Skip to content

Cannot debug a dotfiles error #12100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mrsimonemms opened this issue Aug 12, 2022 · 2 comments
Closed

Cannot debug a dotfiles error #12100

mrsimonemms opened this issue Aug 12, 2022 · 2 comments
Labels
feature: dotfiles meta: never-stale This issue can never become stale team: webapp Issue belongs to the WebApp team type: bug Something isn't working

Comments

@mrsimonemms
Copy link
Contributor

Bug description

I'm trying to install Starship in my Dotfiles. My script is fairly simple:

function starship() {
  echo "Installing Starship"

  curl -sS https://starship.rs/install.sh | BIN_DIR="${HOME}/bin" FORCE=1 sh

  echo "Starship installed - configuring it for the logged in user"

  PRESET="pure-preset"

  mkdir -p "${HOME}/.config"
  wget "https://starship.rs/presets/toml/${PRESET}.toml" -O "${HOME}/.config/starship.toml"
  echo "eval "$(starship init bash)"" > "${HOME}/.bashrc.d/101-starship"
}

starship

When I run this in an already running repo, this works fine. However, when I open a repo with it enabled, it immediately stops the workspace.

I'd like to be able to see why it's erroring. AFAIK, there's no way of seeing why Dotfiles are erroring if you cannot access ~/.dotfiles.log

Steps to reproduce

Configure your dotfiles to be github.com/mrsimonemms/dotfiles and start a workspace

Workspace affected

Any workspace when this repo is in a failed state, eg gitpodio-demodotfiles-04q359bw7nk

Expected behavior

See logs outside of a workspace

Example repository

Full broken Dotfiles:

#!/bin/bash

set -euo pipefail

function bash_alias() {
  echo "Setting up bash_alias"

  cp "${HOME}/.dotfiles/.bash_aliases" "${HOME}/.bash_aliases"
}

function bin_dir() {
  echo "Creating bin directory"

  export PATH="${PATH}:${HOME}/bin"
  mkdir -p "${HOME}/bin"
}

function kubeconfig() {
  echo "Looking for a KUBECONFIG_BASE64 envvar"

  if [ -n "${KUBECONFIG_BASE64-}" ]; then
    echo "KUBECONFIG_BASE64 envvar found"

    KUBECONFIG="${HOME}/.kube/config"

    mkdir -p "${HOME}/.kube"
    mv -f "${KUBECONFIG}" "${HOME}/.kube/config.orig" || true # Save the old kubeconfig
    echo "${KUBECONFIG_BASE64}" | base64 -d > "${KUBECONFIG}"
    chmod 600 "${KUBECONFIG}"
  fi
}

function ohmyzsh() {
  echo "Installing Oh My ZSH!"

  sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

  cp "${HOME}/.dotfiles/oh-my-zsh/zshrc" "${HOME}/.zshrc"
}

function ssh_key() {
  echo "Looking for a SSH_PRIVATE_KEY_BASE64 envvar"

  mkdir -p "${HOME}/.ssh"

  if [ -n "${SSH_PRIVATE_KEY_BASE64-}" ]; then
    echo "SSH_PRIVATE_KEY_BASE64 envvar found"

    echo "${SSH_PRIVATE_KEY_BASE64}" | base64 -d > "${HOME}/.ssh/id_rsa"
    chmod 600 "${HOME}/.ssh/id_rsa"
  fi

  if [ -n "${SSH_PUBLIC_KEY_BASE64-}" ]; then
    echo "SSH_PUBLIC_KEY_BASE64 envvar found"

    echo "${SSH_PUBLIC_KEY_BASE64}" | base64 -d > "${HOME}/.ssh/id_rsa.pub"
    chmod 600 "${HOME}/.ssh/id_rsa.pub"
  fi
}

function starship() {
  echo "Installing Starship"

  curl -sS https://starship.rs/install.sh | BIN_DIR="${HOME}/bin" FORCE=1 sh

  echo "Starship installed - configuring it for the logged in user"

  PRESET="pure-preset"

  mkdir -p "${HOME}/.config"
  wget "https://starship.rs/presets/toml/${PRESET}.toml" -O "${HOME}/.config/starship.toml"
  echo "eval "$(starship init bash)"" > "${HOME}/.bashrc.d/101-starship"
}

bin_dir
kubeconfig
bash_alias
ssh_key
starship

Anything else?

No response

@stale
Copy link

stale bot commented Nov 26, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Nov 26, 2022
@benvp
Copy link

benvp commented Nov 27, 2022

Not stale

@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Nov 27, 2022
@axonasif axonasif added the meta: never-stale This issue can never become stale label Nov 28, 2022
@mrsimonemms mrsimonemms closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dotfiles meta: never-stale This issue can never become stale team: webapp Issue belongs to the WebApp team type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants