Commit Graph

48 Commits

Author SHA1 Message Date
Zaiming (Stone) Shi 527ce097aa feat: add emqx_secret module 2022-09-27 21:18:07 +02:00
Zaiming (Stone) Shi 0ac78734bd build(update_appup.escript): allow external app non-semver 2022-09-25 14:19:53 +02:00
Zaiming (Stone) Shi 9d00b5b0d6 build(update_appup): red color for error logs 2022-09-20 20:30:38 +02:00
Thales Macedo Garitezi 9e122f38b9 ci(fix): fix check for appup coverage
Before:

```elixir
iex(14)> :re.run('4.3.10', "4\\.3\\.[0-4]", [{:capture, :first, :list}])
{:match, ['4.3.1']}
```
2022-09-09 13:21:05 -03:00
Thales Macedo Garitezi c533f58ee5 fix: rm non-portable `env` option
On some systems, like `centos7`, `env` does not have a `-S` option.
2022-08-03 17:47:11 -03:00
Zaiming (Stone) Shi 215286760a build: ignore _build sub-dir in release dir 2022-06-12 21:07:13 +02:00
Zaiming (Stone) Shi 1bebbd6ee5 fix(emqx_os_mon): ensure alarm is deactivated on unsupported platforms 2022-05-25 16:21:53 +02:00
Zaiming (Stone) Shi 0400638f71 feat(update_appup.escript): allow skipped versions
Say app current version is 1.1.2, and the compare baes is
version 1.1.1, but there is a 1.1.2 in appup.

We may skip updating appup instructions for 1.1.2
as it's never used, (at least not in EMQX)
2022-05-25 15:36:12 +02:00
JianBo He af65310ce7 chore(script): update_appup.escript support the update cmd
We often use the advanced directive `update` when hot upgrading
gen_server, gen_statem, and other such processes, and it will be
parsed as:
```
{suspend,[Mod]},
{load,{Mod,brutal_purge,brutal_purge}},
{code_change,up,[{Mod,[Extra]}]},
{resume,[Mod]},
```
So, we should treat the update instruction as having completed the
upgrade of this module.
2022-03-15 10:51:30 +08:00
Zaiming (Stone) Shi cedeff4dab build(appup): fix module delete instructions
when there is a application_restart instruction, there is no
need to add module delete instructions
2022-03-09 11:18:02 +01:00
Zaiming (Stone) Shi d8e29f19cb refactor(appup): always generate appup from script 2022-03-08 13:24:54 +01:00
Zaiming (Stone) Shi 1ae46cc22a build(appup): exclude gpb from appup checks 2022-03-05 16:49:58 +01:00
Zaiming (Stone) Shi 3b22efeb9c build(update_appup): handle add_module instruction 2022-03-04 12:30:46 +01:00
Zaiming (Stone) Shi 558748dab2 build(update_appup): only download package if not exist 2022-03-02 19:38:25 +01:00
Zaiming (Stone) Shi 0996b79d96 chore: add a script to simplify appup update 2022-03-01 17:02:29 +01:00
Thales Macedo Garitezi 62ff6a8b30
chore(update_appup): rm unused value 2021-12-20 13:41:14 -03:00
Thales Macedo Garitezi b2396438a0
chore(update_appup): add expected versions check
For apps inside emqx umbrella, we try to bump only the patch part of
their version numbers, and use only 3-part version
numbers (`Major.Minor.Patch`).  With those assumptions, we may infer
all versions that need to be covered in a given upgrade, and check if
those are covered in regexes.
2021-12-20 13:38:08 -03:00
Thales Macedo Garitezi ce4a193cbb
chore(update_appup): rm unused fn 2021-12-20 13:21:01 -03:00
Thales Macedo Garitezi af3a1326d1
chore(update_appup): bugfix: variable not pinned in lambda 2021-12-20 13:21:01 -03:00
Thales Macedo Garitezi fef8a18bfb
chore(update_appup): insert `load_module`s after `application:stop`
If there is already any `application:stop(Application)` call in the
appup instructions, we prefer to add `load_module` instructions after
it, so we can be sure that the load is replaced safely.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi 42ca5ab5a9
chore(update_appup): do not force appup render if contents are the same
To avoid losing comments and/or manual indentation in appup files that
are already up to date, we now check whether the contents have the
exact same terms as those we are about to write to an existint .appup
file.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi e1e72c144a
chore(update_appup): do not use load_module if restart_application
Since the appup instruction `restart_application` already loads all
modules of a given application, there is no need to introduce those
instructions if a restart is already present.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi 3ff6661a58
chore(update_appup): take regexes into account when comparing vsns
This change makes the `update_appup.escript` check whether the new
version of an application (the _current_ one) is already contained in
entries in the _new_ .appup file for that application if such .appup
file contains regexes.

NOTE: this does not cover the case in which we calculate the
difference between _old_ and _new_ appup entries, and those consist of
regexes.  In such case, we would need to check if one regex is
"contained" in the other, which is not currently supported by this
patch.
2021-12-17 16:53:55 -03:00
Thales Macedo Garitezi 93caddd448
refactor(review): factor out common functionality 2021-11-29 10:23:54 -03:00
Thales Macedo Garitezi 0932920d36
chore(appup): make update_appup.escript output only differences for
external dependencies

Currently, the update_appup.escript outputs as an error the full appup
file for external dependencies, even if all the changes are already
contained in the depency.  Here, we make it only output the missing
actions to be inserted, to aid in seeing what are the differences.
2021-11-25 15:21:25 -03:00
Thales Macedo Garitezi 29f982385d
chore(appup): remove old file extension and preserve dirname for apps 2021-11-24 15:09:25 -03:00
Thales Macedo Garitezi c950566294
chore(appup): minor fixes to update_appup.escript
- Fixes clause error on `create_stub/1`.
- Small optimization: do not download the same file multiple times
  with `wget`.
2021-11-24 14:22:51 -03:00
k32 113cfa6422 fix(update_appup): Fix warnings, add support for external repos 2021-11-18 12:31:02 +01:00
k32 7d07e8d948 chore(emqx): Update version and appup file 2021-11-08 14:24:37 +01:00
Zaiming Shi 51bc9c83c3 fix: ignore unused var 2021-10-15 15:49:26 +08:00
k32 14aaa4affe fix(update_appup): Fix dependency check 2021-10-14 14:18:09 +02:00
k32 cb5db8059b fix(update_appup): Use a different syntax for substitution 2021-10-14 13:47:04 +02:00
k32 703f52cec7 feat(update_appup): Support binary releases (.zip) 2021-10-13 17:25:29 +02:00
k32 4643415b0b chore(appup): Update appup scripts 2021-10-12 17:45:10 +02:00
k32 668bcad4e0 fix(update_appup): Add forgotten CLI parameter 2021-10-07 09:59:32 +02:00
k32 20ee42be87 chore(update-appup): s/Pred/Prev/g 2021-10-06 23:45:52 +02:00
k32 29ad2c04da fix: Use application version instead of the release version 2021-10-06 23:45:52 +02:00
k32 ecf4d196eb feat(update_appup): Return error when missing appup.src 2021-10-06 23:45:52 +02:00
k32 89fbf5fea2 feat(update_appup): Add a warning message 2021-10-06 23:45:52 +02:00
k32 ca77749281 feat(update_appup): Add a full description of the algorithm 2021-10-06 23:45:52 +02:00
k32 6bee6279f8 feat(update_appup): Make the script more generic 2021-10-06 23:45:52 +02:00
k32 c50c72b18e fix(update_appup): Fix downgrade module loading 2021-10-06 23:45:52 +02:00
k32 f793883e35 refactor(update_appup): Minor code cleanup 2021-10-06 23:45:52 +02:00
k32 aca6367561 feat(update_appup): Create stubs 2021-10-06 23:45:52 +02:00
k32 4020db8fc1 feat(update_appup): Compare beam files 2021-10-06 23:45:52 +02:00
Zaiming Shi 54458e3924 chore(appup): ensure emqx_app alwasy loaded in appup 2021-06-03 13:02:49 +02:00
Tobias Lindahl 981364341e chore(appup): load emqx_channel in appup
Note that the large whitespace diff on the appup file is because this
is the first time the new script for modifying appup files is used.
2021-06-03 12:22:58 +02:00
k32 4f425828d6 feat(scripts): Add an appup helper script 2021-06-02 11:50:49 +02:00