-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding the .ts file for commands/internal/container/prestop #3110
base: v2.x/staging
Are you sure you want to change the base?
Conversation
Signed-off-by: Adarshdeep Cheema <[email protected]>
Signed-off-by: Adarshdeep Cheema <[email protected]>
PAX build 2172 FAILED. |
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.
You're on the right track but note a few things:
- You don't have a way for prestop/index.ts to be called. Check other command directories: you need cli.ts + a modification in index.sh that determines whether or not to do shell code or javascript code.
You need to put this boilerplate at the top of index.sh https://github.com/zowe/zowe-install-packaging/blob/congifmgrWorkContainer/bin/commands/internal/start/component/index.sh#L14-L17 and afi
at the bottom.
By the way... If you are editing a non internal index.sh, there's a slightly larger boilerplate about managing the permissions of workspace directory by using a tmpdir, but internal/container is internal, so you don't need https://github.com/zowe/zowe-install-packaging/blob/congifmgrWorkContainer/bin/commands/start/index.sh#L14-L22
- Your code did not compile. Go to
build/zwe
and runnpm run dev
to see if your code compiles. I think you are missing a bracket or something. The pipeline build failed due to this, you can see the TSC error in there.
std.getenv('ZWE_components_api_catalog_port'), | ||
std.getenv('ZWE_zowe_certificate_pem_key'), | ||
std.getenv('ZWE_zowe_certificate_pem_certificate'), | ||
std.getenv('ZWE_zowe_certificate_pem_certificateAuthorities')); |
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.
these come from zowe.yaml.
so, instead please use the configmgr to get them, because it has more validation than just requesting a string from an env var.
For example,
common.requireZoweYaml();
const ZOWE_CONFIG=config.getZoweConfig();
const catalogPort=ZOWE_CONFIG.zowe.components.api-catalog ? ZOWE_CONFIG.zowe.components.api-catalog.port : undefined;
if something is required by schema, you can guarantee it is in the object ZOWE_CONFIG there. but, a lot of these parameters are marked as optional (on purpose or accident) so we need to check them.
common.printFormattedError("Error ZWEL0142E", "zwe-internal-container-prestop,execute", `processComponentDiscoverySharedLibs failure`); | ||
} | ||
} else { | ||
common.printMessage("- nothing to delete"); } |
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.
bracket in a weird place?
import * as component from '../../../../libs/component'; | ||
|
||
export function execute() { | ||
node.requireNode(); |
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.
you may not want this right here. in the shell script, it was assumed most everything required node.
we see in the library file that the catalog thing uses curl.js... so why not put the requireNode() over there
i believe the requireNode() function caches the answer about if node exists, so if you call it multiple times it should not harm performance.
Signed-off-by: Adarshdeep Cheema [email protected]
Please check if your PR fulfills the following requirements. This is simply a reminder of what we are going to look for before merging your PR. If you don't know all of this information when you create this PR, don't worry. You can edit this template as you're working on it.
PR type
What type of changes does your PR introduce to Zowe? Put an
x
in the box that applies to this PR. If you're unsure about any of them, don't hesitate to ask.Relevant issues
Fixes
Changes proposed in this PR
Does this PR introduce a breaking change?
Does this PR do something the person installing Zowe should know about?
multi-line description
Is there a related doc issue or Pull Request?
Doc issue/PR number:
Other information