apache / openwhisk-wskdeploy

Apache OpenWhisk utility for deploying and managing OpenWhisk projects and packages
https://openwhisk.apache.org/
Apache License 2.0
77 stars 74 forks source link

Need a force function for undeploy (to keep going on error) #786

Open mrutkows opened 6 years ago

mrutkows commented 6 years ago

Goal: Improve rollback on failed installation, and do not fail on underdeploy if object doesn’t exist due to install failure

Scenario: In trying to automate wskdeploy Dan Krook found that undeploy hits an error and stops processing leaving server in unknown state. In one example he sent to me...

He deployed a manifest where

undeploy tries to delete Rule (does not exist) and Errors out and stops trying to undeploy at that point

Manifest: https://github.com/IBM/ibm-cloud-functions-refarch-data-processing-message-hub/blob/master/runtimes/nodejs/manifest.yaml

packages:
    data-processing-message-hub:
        actions:
            # Action named "receive-consume"
            # Creating action as a regular Node.js action
            receive-consume:
                function: actions/receive-consume.js
            # Action named "transform-produce"
            transform-produce:
                function: actions/transform-produce.js
                inputs:
                    topic: $DEST_TOPIC
                    kafka: $KAFKA_INSTANCE
        sequences:
            # Sequence named "message-processing-sequence"
            # Creating the sequence that links the get and post actions
            message-processing-sequence:
                actions: receive-consume, transform-produce
        triggers:
            # Creating the message-trigger trigger"
            message-trigger:
                feed: Bluemix_${KAFKA_INSTANCE}_Credentials-1/messageHubFeed
                inputs:
                    isJSONData: true
                    topic: $SRC_TOPIC
        rules:
            # Rule named "message-rule"
            # Creating the rule that links the trigger to the sequence
            message-rule:
                trigger: message-trigger
                action: message-processing-sequence

output:

First step: Broken install on trigger

Genet:nodejs krook$ wskdeploy
Info: The API host is [openwhisk.ng.bluemix.net], from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is [_], from .wskprops.
Info: The apigw access token is set, from .wskprops.
Info: Unmarshal OpenWhisk runtimes from internet at https://openwhisk.ng.bluemix.net.
Warning: The mandatory key [package version] should be set. Using default value [0.0.1]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Warning: The mandatory key [package license] should be set. Using default value [unlicensed]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Info: Deploying package [data-processing-message-hub] ...
Info: package [data-processing-message-hub] has been successfully deployed.

Info: Deploying action [data-processing-message-hub/receive-consume] ...
Info: action [data-processing-message-hub/receive-consume] has been successfully deployed.

Info: Deploying action [data-processing-message-hub/transform-produce] ...
Info: action [data-processing-message-hub/transform-produce] has been successfully deployed.

Info: Deploying action [data-processing-message-hub/message-processing-sequence] ...
Info: action [data-processing-message-hub/message-processing-sequence] has been successfully deployed.

Info: Deploying trigger feed [message-trigger] ...
Error: Deployment did not complete sucessfully. Run `wskdeploy undeploy` to remove partially deployed assets.
Error: servicedeployer.go [1622]: [ERROR_WHISK_CLIENT_ERROR]: Error code: 246: The following application error was received: {}: HTTP Response Status: application error HTTP Response Body: {"duration":768,"name":"messageHubFeed","subject":"krook@us.ibm.com","activationId":"1f8f478e441648218f478e441628210d","publish":false,"annotations":[{"key":"path","value":"whisk.system/messaging/messageHubFeed"},{"key":"waitTime","value":60},{"key":"kind","value":"nodejs:6"},{"key":"limits","value":{"timeout":60000,"memory":256,"logs":10}},{"key":"initTime","value":488}],"version":"0.0.38","response":{"result":{"error":"Error: Document update conflict."},"success":false,"status":"application error"},"end":1520621154257,"logs":[],"start":1520621153489,"namespace":"krook@us.ibm.com_refarch"}

Second step: Undeploy broken on partial install

Info: Undeploying rule [message-rule] ...
Error: Undeployment did not complete sucessfully.
Error: servicedeployer.go [1622]: [ERROR_WHISK_CLIENT_ERROR]: Error code: 148: The requested resource does not exist. (code 328091): HTTP Response Status: 404 Not Found HTTP Response Body: {"error":"The requested resource does not exist.","code":328091}

expected:

Genet:bx-wsk krook$ ./deploy.sh --uninstall
Uninstalling...
error: Unable to disable rule 'message-rule': The requested resource does not exist. (code 6201033)
error: Unable to get trigger 'message-trigger': The requested resource does not exist. (code 338338)
ok: deleted action data-processing-message-hub/message-processing-sequence
mrutkows commented 6 years ago

@pritidesai I am not saying we should impl. a force feature/flag, but that is how request was formed to me from Daniel.