-
Notifications
You must be signed in to change notification settings - Fork 61
using garage-check automatically at the end of garage-deploy #1244
Conversation
6375dcd
to
6298745
Compare
Codecov Report
@@ Coverage Diff @@
## master #1244 +/- ##
==========================================
+ Coverage 79.46% 79.68% +0.21%
==========================================
Files 169 170 +1
Lines 10136 10144 +8
==========================================
+ Hits 8055 8083 +28
+ Misses 2081 2061 -20
Continue to review full report at Codecov.
|
@@ -122,6 +122,14 @@ int main(int argc, char **argv) { | |||
LOG_FATAL << e.what(); | |||
return EXIT_FAILURE; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a check for dry run, like in the rest of the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes sense! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested the code yet, just pushed it here to get your advices. Am I on the right track?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's going in the right direction. I would just move CheckRefValid
in a new source file.
src/sota_tools/garage_deploy.cc
Outdated
@@ -122,6 +122,14 @@ int main(int argc, char **argv) { | |||
LOG_FATAL << e.what(); | |||
return EXIT_FAILURE; | |||
} | |||
|
|||
std::string cmd("garage check"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to have a typo, garage-check
is the correct tool name.
But also, it would be best to not launch another process and just call some C++ code as garage-check's code lives in this repo. This way, garage-check wouldn't need to be in the $PATH
.
It would probably require a small refactor to move garage-check's logic in a small library that would be used by garage-check
and garage-deploy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit complicated than I thought, but this looks like the right way to do it. Thank you!
615c252
to
68cf26b
Compare
I tested the garage-deploy tool, looks good. The log showed the process succeed. I checked my other test account, the image I deployed was present on the server. Is there anything else I should test or fix? |
src/sota_tools/deploy.cc
Outdated
@@ -77,18 +81,18 @@ bool OfflineSignRepo(const ServerCredentials &push_credentials, const std::strin | |||
boost::filesystem::remove_all(local_repo); | |||
} | |||
|
|||
std::string init_cmd("garage-sign init --repo aktualizr --credentials "); | |||
std::string init_cmd("./garage-sign/bin/garage-sign init --repo aktualizr --credentials "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would switch back to init_cmd("garage-sign init --repo aktualizr --credentials ");
, this would make problems in the actual released code.
src/sota_tools/deploy.h
Outdated
@@ -43,4 +43,10 @@ bool OfflineSignRepo(const ServerCredentials& push_credentials, const std::strin | |||
bool PushRootRef(const ServerCredentials& push_credentials, const OSTreeRef& ref, const std::string& cacerts, | |||
RunMode mode); | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that works but it's maybe a bit confusing to have this function as part of deploy.cc
. Maybe just add it to a new translation unit check.cc
and check.h
.
da060ca
to
fc4988f
Compare
src/sota_tools/check.cc
Outdated
} | ||
|
||
int CheckRefValid(const TreehubServer &treehub, const std::string &ref, RunMode mode, int max_curl_requests) { | ||
// vim: set tabstop=2 shiftwidth=2 expandtab: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This vim comment shouldn't probably be here.
Only a very small nitpick and it should be good. |
f56b1c9
to
6581cff
Compare
Moved garage-check's logic in a small library Added check.cc and check.h Deleted the vim comment Signed-off-by: Zee314159 <[email protected]>
6581cff
to
17fc673
Compare
Draft code.