Skip to main content

Step 7: Platform CLI (Required)

Time: 5 minutes
Purpose: Install company platform CLI (p6m) for repository management and cloud access

Company Requirement

The Platform CLI (p6m) is mandatory for all company development. It's used for repository management, context switching, and accessing cloud resources.

Overview

Platform (p6m) command line utility provides a number of cross-platform conveniences for local development, and encourages conventions, standards, and speed.

Prerequisites

Installation

Depending on your machine, there are few ways to install the p6m-cli:

Windows Installation

A Windows Installer is available on the p6m-cli Github Releases page. The installer will be names like p6m-vX.X.X-windows-x86_64-installer.exe. Simply download and run the installer like any other Windows application.

The installer will ensure the p6m is added to your path. Be sure to restart your terminal (wt.exe) to see the changes.

warning

Windows may view this installer as coming from an "Untrusted Source". You will need to override the exceptions to allow the installation.

info

The Windows x86_64 installer works on both x86_64 and arm64 architectures.

MacOS Installation using Homebrew

A Homebrew Formula is available for the p6m-cli. To install using Homebrew:

brew tap p6m-dev/tap
brew install p6m

Installation using Pre-Compiled Binaries

Pre-compiled binaries for the p6m-cli are available for multiple platforms. You are free to download an archive appropriate for your operating system and architecture from it's Github Releases page, extract the contents, and place the binary on your system's path.

Installation using the source code

Install Rust Lang's build tool be able run cargo.

git clone git@github.com:p6m-dev/p6m-cli.git
cd p6m-cli
cargo install --path .

Check the installation

p6m --version

Post Configuration

Some commands rely on environment variables being set in your shell:

For Artifactory-related commands (p6m context), you need the following set:

ARTIFACTORY_USERNAME         # your e-mail address
ARTIFACTORY_IDENTITY_TOKEN # Generate an Identity Token in Artifactory ("Edit Settings" menu option)

For Github-related command (p6m repos), you need the follow set:

GITHUB_TOKEN  # Generate a classic Personal Access Token in your Github account

Commands

Managing Repositories

Make sure you have configured your GITHUB_TOKEN environment variable, before using these commands.

From the root or outside of your local ~/orgs directory, you can pull all repos from all organizations you have access to:

p6m repos pull  # Pulls all repos from all organizations

From inside an organization within ~/orgs (Ex: ~/orgs/p6m-example), you can pull all repos from within that organization:

p6m repos pull  # Pulls all repos for the organization you are currently in

From any directory, you can specify which organization to pull repos from:

p6m repos pull --org p6m-example  # Pulls all p6m-example repos to ~/orgs/p6m-example

Pull only new repositories. Do not pull existing repos:

p6m repos pull --new  # Only pull new repos

Changing Contexts

Make sure you have configured your ARTIFACTORY_USERNAME & ARTIFACTORY_IDENTITY_TOKEN environment variable, before using these commands.

When changing between organizations, you may need to change local configuration to work specifically with that organization.

For example, you may need to change your ~/.m2/settings.xml to pull artifacts from your organization. You can easily do so by executing the following command:

p6m context # From within an organization within ~/orgs
# or
p6m context --org p6m-example # From anywhere

Looking up Resources

You can quickly view external resources, such as the current GitHub page for the organization or repository you are currently in, or viewing the Artifactory repositories for the organization you are currently in.

# Github
p6m open github
p6m open gh

# Artifactory
p6m open artifactory
p6m open af

#ArgoCD
p6m open argocd
p6m open argo
p6m open acd

Purging Local Caches

p6m purge ide-files # Removes all IDE files from the current directory, recursively, allowing an IDE reset

p6m purge maven {groupId prefix} # Removes all Java Artifacts for the given groupId prefix
# Ex: p6m purge maven p6m
# Ex: p6m purge maven p6m.platform

Automatic SSO Configuration

You can automate configuration of your AWS SSO profiles and credentials to Kubernetes clusters available to you.

Prerequisites:

p6m sso # Runs both aws and azure subcommands

p6m sso aws # Replaces your ~/.aws/config and updates ~/.kube/config with entries for EKS clusters.

p6m sso azure # updates ~/.kube/config with entries for AKS clusters.

Verification

# Check Platform CLI version
p6m --version

# Test repository access (requires GITHUB_TOKEN)
p6m repos pull --new

# Test context functionality (requires ARTIFACTORY_USERNAME & ARTIFACTORY_IDENTITY_TOKEN)
p6m context

Next Step

Step 8: Archetect (Company Required)