Skip to content
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

Open
wants to merge 2 commits into
base: v2.x/staging
Choose a base branch
from

Conversation

AdarshdeepCheema
Copy link
Contributor

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.

  • Tests for the changes have been added (for bug fixes / features)
  • Necessary documentation (if appropriate) have been added / updated
  • DCO signoffs have been added to all commits, including this PR

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.

  • Bugfix
  • Feature
  • Other... Please describe:

Relevant issues

Fixes

Changes proposed in this PR

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR do something the person installing Zowe should know about?


  • Affected function: general area of interest *

  • Description: 1 line description *

  • Part: name of customizable file involved *

multi-line description

Is there a related doc issue or Pull Request?

Doc issue/PR number:

Other information

@github-actions
Copy link

github-actions bot commented Oct 14, 2022

PAX build 2172 FAILED.
Link to workflow run: https://github.com/zowe/zowe-install-packaging/actions/runs/3252923110

Copy link
Member

@1000TurquoisePogs 1000TurquoisePogs left a 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:

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 run npm 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.

Comment on lines +46 to +49
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'));
Copy link
Member

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"); }
Copy link
Member

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();
Copy link
Member

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.

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.

2 participants