bitwalker / bitwalker/distillery

Windows: start_erl.data error because var directory does not exist before first run of new release

Open
#705 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
3k
Forks
398
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

1. Copy brand new release directory to new system
2. Run the release tasks script first time. Example batch file command that runs this script:
```
> %da_siteprocessing_umbrella_root%\bin\da_siteprocessing_umbrella get-tag-history location:%location% tagfile:%1 outputfile:%output% sortorder:%sortorder%
```

### Verbose Logs
```
copy-item : Could not find a part of the path
'C:\Users\labuser\Documents\ASDDataLake\da_siteprocessing_umbrella\var\start_erl.data'.
At C:\Users\labuser\Documents\ASDDataLake\da_siteprocessing_umbrella\releases\0.2.4\da_siteprocessing_umbrella.ps1:92
char:5
+ copy-item -Path (join-path $releases_dir "start_erl.data") -Desti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-Item], DirectoryNotFoundException
+ FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
```

### Description of issue
Before the first run of a brand new release, the top level var directory does not exist. the release tasks PowerShell script attempts to copy start_erl.data to this directory and fails, but keeps running. Somewhere after this the var directory is created and the next run will work without error.

A minor issue but distillery ver 2.0.14 did not exhibit this behavior and PowerShell error messages are annoying to users. Thanks for looking into it!

- What are the expected results?
No error (create the var directory before attempting to copy files to it)

- What version of Distillery?
$Env:DISTILLERY_VSN = "2.1.1"

- What OS, Erlang/Elixir versions are you seeing this issue on?
$Env:ERTS_VSN = "10.4" : Elixir Version = 1.9.1

- If possible, also provide your `rel/config.exs`, as it is often

```
# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Distillery.Releases.Config,
# This sets the default release built by `mix release`
default_release: :default,
# This sets the default environment used by `mix release`
default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/config/distillery.html

# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
# If you are running Phoenix, you should make sure that
# server: true is set and the code reloader is disabled,
# even in dev mode.
# It is recommended that you build with MIX_ENV=prod and pass
# the --env flag to Distillery explicitly if you want to use
# dev mode.
set dev_mode: true
set include_erts: false
set cookie: :"VWfe!j]iw),h3]3sx_}~yd.1SVD&|mNN*H7Wr`H}^"
set vm_args: "rel/vm.args"
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default

release :da_siteprocessing_umbrella do
set version: "0.2.4"
set applications: [
:runtime_tools,
loggix: :permanent,
dl_posbypass_gettaghistory: :permanent,
dl_posbypass_gettaghistory_consoleio: :permanent,
dl_posbypass_getdepartedtags: :permanent,
dl_posbypass_getdepartedtags_consoleio: :permanent,
da_bar_query: :permanent,
da_bar_query_consoleio: :permanent
]

set config_providers: [{Mix.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/config.exs"]}]
set commands: [
execute_bar_query: "rel/commands/win/execute-bar-query.ps1",
get_tag_history: "rel/commands/win/get-tag-history.ps1",
get_departed_tags_from_slap: "rel/commands/win/get-departed-tags-from-slap.ps1"
]
set overlays: [
{:mkdir, "releases/<%= release_version %>/commands/win"},
{:copy, "rel/commands/win/get-tag-history.ps1",
"releases/<%= release_version %>/commands/win/get-tag-history.ps1"},
{:copy, "rel/commands/win/get-departed-tags-from-slap.ps1",
"releases/<%= release_version %>/commands/win/get-departed-tags-from-slap.ps1"},
{:copy, "rel/commands/win/execute-bar-query.ps1",
"releases/<%= release_version %>/commands/win/execute-bar-query.ps1"},

{:copy, "config/config.exs", "etc/config.exs"},
{:copy, "priv/msvcr120.dll", "erts-<%= erts_vsn %>/bin/msvcr120.dll"},
{:copy, "priv/run-get-tag-history.bat", "bin/run-get-tag-history.bat"},
{:copy, "priv/run-get-departed-tags-from-slap.bat", "bin/run-get-departed-tags-from-slap.bat"},
{:copy, "priv/execute-bar-query.bat", "bin/execute-bar-query.bat"},
{:copy, "README.md", "README.md"}
]
end
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at releases/0.2.4/da_siteprocessing_umbrella.ps1 around line 92, where the script copies start_erl.data, and review the release configuration and Windows command entry point that produce it. Reproduce the first-run command on a fresh Windows release; done means the var directory exists before the copy and no PowerShell error is shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, powershell
Domain
release
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.