Skip to content

Appimage automated build - #1136

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

mssalvatore merged 26 commits into
developfrom
appimage-automated-build

Conversation

@mssalvatore

@mssalvatore mssalvatore commented Apr 30, 2021 •

Copy link
Copy Markdown
Collaborator

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

codecov Bot commented Apr 30, 2021 •

Copy link
Copy Markdown

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
Copy Markdown
Contributor

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

@mssalvatore

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread appimage/build_appimage.sh Outdated
missing_argument "$1"
fi
;;
-*)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@VakarisZ VakarisZ left a comment

Copy link
Copy Markdown
Contributor

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppImage jenkins script

2 participants