Skip to content

Appimage automated build#1136

Merged
mssalvatore merged 26 commits intodevelopfrom
appimage-automated-build
May 3, 2021
Merged

Appimage automated build#1136
mssalvatore merged 26 commits intodevelopfrom
appimage-automated-build

Conversation

@mssalvatore
Copy link
Collaborator

@mssalvatore mssalvatore commented Apr 30, 2021

What does this PR do?

Modifies the AppImage build script so that AppImage packages can be easily build locally by developers or by Jenkins.

Closes #1103

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • Was the CHANGELOG.md updated to reflect the changes?
  • Was the documentation framework updated to reflect the changes?

Testing Checklist

  • Added relevant unit tests?
  • Have you successfully tested your changes locally? Elaborate:

    Tested by building locally and running on my local network. Then I built a package with Jenkins and ran blackbox tests.

  • If applicable, add screenshots or log transcripts of the feature working
The node modules do not need to be deliverer with the appimage. Removing them from the AppDir saves 50MB.
Jenkins sets a $WORKSPACE environment variable. We'll use this if it's been set. Otherwise, use $HOME.
@mssalvatore mssalvatore requested a review from VakarisZ April 30, 2021 14:23
@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #1136 (f475df7) into develop (78ca2c2) will decrease coverage by 0.33%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## develop #1136 +/- ## =========================================== - Coverage 28.73% 28.40% -0.34%  =========================================== Files 410 410 Lines 12869 13104 +235 =========================================== + Hits 3698 3722 +24  - Misses 9171 9382 +211 
Impacted Files Coverage Δ
monkey/infection_monkey/utils/linux/users.py 90.32% <0.00%> (-1.68%) ⬇️
monkey/infection_monkey/utils/windows/users.py 24.35% <0.00%> (-0.30%) ⬇️
monkey/infection_monkey/dropper.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/hadoop.py 0.00% <0.00%> (ø)
monkey/infection_monkey/windows_upgrader.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/shellshock.py 0.00% <0.00%> (ø)
...ction_monkey/system_info/windows_info_collector.py 0.00% <0.00%> (ø)
...n_monkey/post_breach/actions/use_signed_scripts.py 0.00% <0.00%> (ø)
monkey/infection_monkey/control.py 23.15% <0.00%> (+1.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78ca2c2...f475df7. Read the comment docs.

@VakarisZ
Copy link
Contributor

Do we have OS compatibility for app-image documented somewhere?

@mssalvatore
Copy link
Collaborator Author

Do we have OS compatibility for app-image documented somewhere?

Not yet. We have to decide on an official standard for how we test compatibility. It should work on "any modern Linux" as long as FUSE is available. There will, of course, be exceptions.

log_message "downloading configuration"
curl -L -s -o "$tmpfile" "$CONFIG_URL"
is_valid_git_repo() {
pushd "$1" 2>/dev/null || return 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, what's the $1 argument?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A local directory that potentially contains a valid git repo.

case "$1" in
--agent-binary-dir)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
agent_binary_dir=$2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these flags are parsed with basically the same code, except the argument is assigned to a different variable, maybe there's an opportunity to remove duplication

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash functions are a little strange, so I can't get it quite as clean as I would like, but I've made a modest improvement.

missing_argument "$1"
fi
;;
-*)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the dash?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't have any positional arguments, we don't. Good catch.

remove_node_modules() {
# Node has served its purpose. We don't need to deliver the node modules with
# the AppImage.
rm -rf "$ISLAND_PATH"/cc/ui/node_modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably be slow. can we use npx remove-node-modules?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran a single test. The rm ran in 1.7 seconds. the npx remode-node-modules ran in 5.9 seconds.

Copy link
Contributor

@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but adress my questions before merging

@mssalvatore mssalvatore merged commit 7f06ec4 into develop May 3, 2021
@mssalvatore mssalvatore deleted the appimage-automated-build branch May 13, 2021 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants