Skip to content
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

dev reloading not working as documented #873

Open
tannevaled opened this issue Nov 24, 2023 · 2 comments
Open

dev reloading not working as documented #873

tannevaled opened this issue Nov 24, 2023 · 2 comments

Comments

@tannevaled
Copy link

tannevaled commented Nov 24, 2023

in the documentation (https://docs.pkgx.sh/using-dev/dev#adding-new-dependencies-to-an-activated-developer-environment) it is said to "cd ." to reload the dev environment with pkgx.yaml modifications.

It does not work as expected.

To reproduce:

$ cat test-pkgx-integration.sh
docker run -i --rm ubuntu bash - <<'EOF'
(
  apt-get update && apt-get -y install curl
) 2>&1 >/dev/null
eval "$(curl https://pkgx.sh)"
pkgx install yq

cd tmp
yq --null-input '.dependencies["jetporch.com"]="^0"' > pkgx.yaml
dev
#jetp

yq -i e '.dependencies["terraform.io"]="^1.6"' pkgx.yaml

cd .
terraform
EOF

-->

$ sh test-pkgx-integration.sh 
debconf: delaying package configuration, since apt-utils is not installed
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3764  100  3764    0     0   6842      0 --:--:-- --:--:-- --:--:--  6843
installing: /usr/local/bin/pkgx
######################################################################## 100.0%
pkgx 1.1.0
ensure you have the  pre-requisites installed:

now type: pkgx --help
pkgx: installed: /usr/local/bin/yq
env +jetporch.com^0
cmd not found: terraform

The better i found to make it work is "cd .. && cd ~-".
pushd/popd does not work either.

docker run -i --rm ubuntu bash - <<'EOF'
(
  apt-get update && apt-get -y install curl
) 2>&1 >/dev/null
eval "$(curl https://pkgx.sh)"
pkgx install yq

cd tmp
yq --null-input '.dependencies["jetporch.com"]="^0"' > pkgx.yaml
dev
#jetp

yq -i e '.dependencies["terraform.io"]="^1.6"' pkgx.yaml

#cd .
#
# Reload Project Environment
#
function rpe {
    cd ..\
 && cd ~-
}
rpe
terraform

EOF

-->

sh test-pkgx-integration.sh 
debconf: delaying package configuration, since apt-utils is not installed
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3764  100  3764    0     0   7330      0 --:--:-- --:--:-- --:--:--  7337
installing: /usr/local/bin/pkgx
######################################################################## 100.0%
pkgx 1.1.0
ensure you have the  pre-requisites installed:

now type: pkgx --help
pkgx: installed: /usr/local/bin/yq
env +jetporch.com^0
env -jetporch.com^0
env +jetporch.com^0 +terraform.io^1.6
Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
  init          Prepare your working directory for other commands
  validate      Check whether the configuration is valid
  plan          Show changes required by the current configuration
  apply         Create or update infrastructure
  destroy       Destroy previously-created infrastructure

All other commands:
  console       Try Terraform expressions at an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  metadata      Metadata related commands
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  test          Execute integration tests for Terraform modules
  untaint       Remove the 'tainted' state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

Global options (use these before the subcommand, if any):
  -chdir=DIR    Switch to a different working directory before executing the
                given subcommand.
  -help         Show this help output, or the help for a specified subcommand.
  -version      An alias for the "version" subcommand.

Could it be possible to integrate a function (rpe for example) like you did with dev to reload the environment?
or better, just retype dev?

@mxcl mxcl transferred this issue from pkgxdev/pantry Nov 25, 2023
@tannevaled
Copy link
Author

other option maybe dev off && dev on?

@michaelessiet
Copy link
Contributor

Yes, that's another option. Thanks for catching this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants