Closed shubhbapna closed 1 year ago
I would suggest to use build resume instead of tool it looks like more intuitive to me thinking wdyt guys?
@Ginxo Adding resume
as a build command might be tough to integrate since build commands need to have a certain flow. Although I could do something which is bit hacky:
build-chain build resume
resume
command it will switch to "tool" modewdyt?
fixes #450
Overview
This PR implements a basic
resume
command. Wheneverbuild-chain
runs in CLI mode it will store all its state in a json file. This file is later on picked up by theresume
command which continues the build after reconstructing the build-chain's previous state. For example if I run:and the command fails to build the 3rd project then when I run
build-chain resume
in the same workspace like this:build-chain will continue its execution from the 3rd project
I can also specify the workspace by passing the
-w, --workspace
optionImplementation details
After analyzing all the services, the only ones needed for reconstruction of a state are: configuration service, flow service and checkout service
These services implement a Serializable interface which makes it super simple to serialize them to JSON using the
toJSON
method and deserialize the JSON back into the object using thefromJSON
static method. Furthermore checkout and flow service maintain a saved state as well as current state variable to keep track of the new state they are producing as well as the previous one they got back from the state file. The new state is used to update the state file again.I chose not to serialize
GitTokenService
since storing tokens in plain text is not a good idea. Because of this, when running the resume command the user has to pass the tokens again or make sure they are available as env variables.