Skip to content

Commit

Permalink
Merge pull request #101 from zowe/update-sample-plugin
Browse files Browse the repository at this point in the history
Update sample plugin to make compatible with vnext
  • Loading branch information
zFernand0 authored Mar 15, 2024
2 parents a9a99b3 + 79c3fd0 commit 6c8aeeb
Show file tree
Hide file tree
Showing 24 changed files with 1,498 additions and 2,654 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

All notable changes to the Sample Plug-in for Zowe CLI will be documented in this file.
All notable changes to the sample plug-in for Zowe CLI will be documented in this file.

## Recent Changes

- Enhancement: Added plugin lifecycle example.
- Enhancement:
- Removed detailed Jenkins information and switched to GHA
- Updated imports and resolved errors when making plug-in v3 compatible [#96](https://github.com/zowe/zowe-cli-sample-plugin/issues/96)

- Enhancement: Added plug-in lifecycle example.
- Enhancement: Removed deprecated pluginHealthCheck.
- BugFix: Updated dependencies for technical currency.

Expand Down
93 changes: 0 additions & 93 deletions CICD-TEMPLATE.md

This file was deleted.

18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contribution Guidelines
This document is intended to be a living summary of conventions & best practices for development within Sample Plug-in for Zowe CLI.
# Contribution guidelines
This document is intended to be a living summary of conventions & best practices for development within Sample plug-in for Zowe CLI.

## Changelog Update Guidelines
## Changelog update guidelines

The changelog should be updated for any PR that updates code that will be distributed to the end user. Changes to certain files, such as the Jenkinsfile, do not require an update to the changelog.
The changelog should be updated for any PR that updates code that will be distributed to the end user. Changes to certain files, for example those listed in `.gitignore`, do not require an update to the changelog.

The following code block should be inserted into the Changelog above the last released version:

Expand All @@ -14,20 +14,20 @@ The following code block should be inserted into the Changelog above the last re
- <be documented here>
```

# Primary Contribution Guidelines
# Primary contribution guidelines

We provide guidelines for developing Zowe CLI plug-ins in the [Zowe CLI GitHub repository](https://github.com/zowe/zowe-cli). The following information is critical to working with the code, running/writing/maintaining automated tests, developing consistent syntax in your plug-in, and ensuring that your plug-in integrates with Zowe CLI properly:

| For more information about ... | See: |
| ------------------------------ | ----- |
| General guidelines that apply to contributing to Zowe CLI and Plug-ins | [Contribution Guidelines](https://github.com/zowe/zowe-cli/blob/master/CONTRIBUTING.md) |
| General guidelines that apply to contributing to Zowe CLI and plug-ins | [Contribution Guidelines](https://github.com/zowe/zowe-cli/blob/master/CONTRIBUTING.md) |
| Conventions and best practices for creating packages and plug-ins for Zowe CLI | [Package and Plug-in Guidelines](https://github.com/zowe/zowe-cli/blob/master/docs/PackagesAndPluginGuidelines.md)|
| Guidelines for running tests on Zowe CLI | [Testing Guidelines](https://github.com/zowe/zowe-cli/blob/master/docs/TESTING.md) |
| Guidelines for running tests on the plug-ins that you build for Zowe CLI | [Plug-in Testing Guidelines](https://github.com/zowe/zowe-cli/blob/master/docs/PluginTESTINGGuidelines.md) |
| Documentation that describes the features of the Imperative CLI Framework | [About Imperative CLI Framework](https://github.com/zowe/imperative/wiki) |
Versioning conventions for Zowe CLI and Plug-ins| [Versioning Guidelines](https://github.com/zowe/zowe-cli/blob/master/docs/MaintainerVersioning.md) |
Versioning conventions for Zowe CLI and plug-ins| [Versioning Guidelines](https://github.com/zowe/zowe-cli/blob/master/docs/MaintainerVersioning.md) |

## Contribution Guidelines Specific to the CICS Plug-in
The following guidelines apply specifically to the Sample Plug-in for Zowe CLI:
## Contribution guidelines specific to the CICS plug-in
The following guidelines apply specifically to the Sample plug-in for Zowe CLI:

- None at this time.
109 changes: 54 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,87 @@
# Zowe CLI Sample Plug-in
# Zowe CLI sample plug-in

This repository contains a sample Zowe CLI plug-in that adheres to the contribution guidelines for the project. Use this project and the associated tutorials as a starting point for creating Zowe CLI plug-ins.

- [Zowe CLI Sample Plug-in](#zowe-cli-sample-plug-in)
- [Why Create a Zowe CLI Plug-in?](#why-create-a-zowe-cli-plug-in)
- [Tutorials, Documentation, and Guidelines](#tutorials-documentation-and-guidelines)
- [Zowe CLI sample plug-in](#zowe-cli-sample-plug-in)
- [Sample plug-in overview](#sample-plug-in-overview)
- [Why create a Zowe CLI plug-in?](#why-create-a-zowe-cli-plug-in)
- [Tutorials, documentation, and guidelines](#tutorials-documentation-and-guidelines)
- [Tutorials](#tutorials)
- [Contribution Guidelines](#contribution-guidelines)
- [Imperative CLI Framework Documentation](#imperative-cli-framework-documentation)
- [Jenkinsfile Guidelines](#jenkinsfile-guidelines)
- [Prerequisites](#prerequisites)
- [Create a Local Development Space](#create-a-local-development-space)
- [Clone zowe-cli-sample-plugin and Build From Source](#clone-zowe-cli-sample-plugin-and-build-from-source)
- [Run the Automated Tests](#run-the-automated-tests)
- [Install the zowe-cli-sample-plugin to Zowe CLI](#install-the-zowe-cli-sample-plugin-to-zowe-cli)

## Why Create a Zowe CLI Plug-in?

You might want to create a Zowe CLI plug-in to accomplish the following:

* Provide new scriptable functionality for yourself, your organization, or to a broader community.
- [Imperative CLI framework documentation](#imperative-cli-framework-documentation)
- [Contribution guidelines](#contribution-guidelines)
- [CICD guidelines](#cicd-guidelines)
- [Set up your development environment](#set-up-your-development-environment)
- [Prerequisites](#prerequisites)
- [Initial setup](#initial-setup)
- [Next steps: using your sample plug-in](#next-steps-using-your-sample-plug-in)

## Sample plug-in overview

This sample includes:
- Source code for extending the Zowe CLI with a command that lists the contents of a remote directory.
- Tutorials for:
- [Building the plug-in](docs/tutorials/list-directory-contents/ListDirectoryContentsPlugin.md) to use its `zowe zowe-cli-sample list directory-contents` command.
- [Enhancing the sample](docs/tutorials/files-util/FilesUtilPlugin.md) with a third-party package and creating a new command for file-diff highlighting.
- [Augmenting the code](docs/tutorials/list-typicode-todo/ListTypicodeTodoPlugin.md) to connect with Typicode's external API, a simulator of backend data, to walk through the cli's interaction with RESTful services.
- [Using profiles](docs/tutorials/profile-example/ProfilePlugin.md) with your plug-in.
- Examples of lifecycle hooks and GitHub Actions workflows for CICD.
- Templates for unit, system and integration testing suites.

## Why create a Zowe CLI plug-in?

You might want to create a Zowe CLI plug-into accomplish the following:

* Provide new script-able functionality for yourself, your organization, or to a broader community.
* Make use of Zowe CLI infrastructure (profiles and programmatic APIs).
* Participate in the Zowe CLI community space.

## Tutorials, Documentation, and Guidelines

We also provide the following tutorials, guidelines, and documentation to assist you during development:
## Tutorials, documentation, and guidelines


### Tutorials

To learn about how to work with this sample plug-in, build new commands, or build a new Zowe CLI plug-in, see [Extend Zowe CLI](https://docs.zowe.org/stable/extend/extend-zowe-overview/#extend-zowe-cli).
This sample plug-in comes with [tutorial information](docs/tutorials), but more in-depth documentation can be found online. See [Extend Zowe CLI](https://docs.zowe.org/stable/extend/extend-zowe-overview/#extend-zowe-cli) to learn more about how to work with this sample plug-in, build new commands, or build a new Zowe CLI plug-in.

**Note:** For an advanced example on how to create a plug-in that serves as a Credential Manager, see [Zowe CLI secrets for Kubernetes](https://github.com/zowe/zowe-cli-secrets-for-kubernetes/)

### Contribution Guidelines
**Note:** For an advanced example on how to create a plug-in that serves as a Credential Manager, see [Zowe CLI secrets for Kubernetes](https://github.com/zowe/zowe-cli-secrets-for-kubernetes/)

The Zowe CLI [contribution guidelines](CONTRIBUTING.md) contain standards and conventions for developing Zowe CLI plug-ins.
### Imperative CLI framework documentation

The guidelines contain critical information about working with the code, running/writing/maintaining automated tests, developing consistent syntax in your plug-in, and ensuring that your plug-in integrates with Zowe CLI properly.
Previously, Zowe CLI required the Imperative CLI Framework as an external dependency. Starting with V3, the Imperative Framework is integrated directly into the CLI, forming its core foundation. Archived details on the [Imperative CLI Framework](https://github.com/zowe/imperative/wiki) remain useful for understanding Zowe CLI's features and structure. Refer to this information when developing plug-ins.

### Imperative CLI Framework Documentation
### Contribution guidelines

[Imperative CLI Framework](https://github.com/zowe/imperative/wiki) documentation is a key source of information to learn about the features of Imperative CLI Framework (the code framework that you use to build plug-ins for Zowe CLI). Refer to these documents during development.
The Zowe CLI [contribution guidelines](CONTRIBUTING.md) contain standards and conventions for developing Zowe CLI Plug-ins.

### Jenkinsfile Guidelines
The guidelines contain critical information about working with the code, running/writing/maintaining automated tests, developing consistent syntax in your plug-in, and ensuring that your plug-in integrates with Zowe CLI properly.

Reference the [Jenkinsfile Guidelines](CICD-TEMPLATE.md) for information about setting up and maintaining automated testing/deployment for your plug-in with Jenkins automation server.
### CICD guidelines

## Prerequisites
Reference our [included GitHub Actions workflows](.github/workflows/) for guidance about setting up and maintaining automated testing and deployment for your plug-in with GitHub Actions.

Before you work with the Zowe CLI sample plug-in, [install Zowe CLI globally.](https://docs.zowe.org/active-development/user-guide/cli-installcli.html)
## Set up your development environment

## Create a Local Development Space
### Prerequisites

To create your development space, clone and build the Zowe CLI sample plug-in from source.
[Install Zowe CLI](https://docs.zowe.org/stable/user-guide/cli-installcli) and its dependencies globally.

Create a local development folder named `zowe-tutorial`. You will clone and build all projects in this folder.
### Initial setup

Clone the repositories into your development folder to match the following structure:
To create your development space, you will clone and build the zowe-cli-sample-plugin from source.

Clone the repository into your development folder to match the following structure:
```
zowe-tutorial
└── zowe-cli-sample-plugin
```

### Clone zowe-cli-sample-plugin and Build From Source

See [setup](docs/tutorials/Setup.md).

### Run the Automated Tests

**Note:** If you don't have access to a z/OSMF instance at your site, run `npm run server:start` to launch a mock server at http://localhost:3000.

1. `cd __tests__/__resources__/properties`
2. Copy `example_properties.yaml` to `custom_properties.yaml`.
3. Edit the properties within `custom_properties.yaml` to contain valid system information for your site.
4. `cd` to your `zowe-cli-sample-plugin` folder
5. `npm run test`

### Install the zowe-cli-sample-plugin to Zowe CLI
1. `cd` to your `zowe-tutorial` folder
2. `git clone https://github.com/zowe/zowe-cli-sample-plugin`
3. `cd zowe-cli-sample-plugin`
4. `npm install`
5. `npm run build`

This process assumes that you already installed Zowe CLI on your PC in the previous steps.
## Next steps: using your sample plug-in

1. `cd` to your `zowe-tutorial` folder.
2. `zowe plugins install ./zowe-cli-sample-plugin`
3. `zowe zowe-cli-sample`
You should see help text displayed if the installation was successful.
After you complete your setup, follow the [Installing the sample plug-in to Zowe CLI](docs/tutorials/list-directory-contents/ListDirectoryContentsPlugin.md) tutorial to install, use and test this sample plug-in with the Zowe CLI.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`zowe-cli-sample fail error-handler command should fail the handler 2`]
\\"exitCode\\": 1,
\\"message\\": \\"\\\\\\"zowe zowe-cli-sample zcsp fail error-handler\\\\\\" command failed!\\",
\\"stdout\\": \\"\\",
\\"stderr\\": \\"Command Error:\\\\n\\\\\\"zowe zowe-cli-sample zcsp fail error-handler\\\\\\" command failed!\\\\n\\",
\\"stderr\\": \\"Unable to perform this operation due to the following problem.\\\\n\\\\\\"zowe zowe-cli-sample zcsp fail error-handler\\\\\\" command failed!\\\\n\\",
\\"data\\": {},
\\"error\\": {
\\"msg\\": \\"\\\\\\"zowe zowe-cli-sample zcsp fail error-handler\\\\\\" command failed!\\"
Expand Down
Loading

0 comments on commit 6c8aeeb

Please sign in to comment.