23  Code Workspaces

23.1 Objective

Create a Foundry Code Workspace VS Code session to document your work inside the Foundry enclave.

23.2 Prerequisites

Before you start, complete:

  • fnd-getting-started.qmd (login, create a project, tagging for discovery, groups/permissions, etc.)

You also need:

  • access to create a Code Repository in your Foundry Project
  • VS Code installed locally
  • DoD Certificates installed locally
  • Palantir extension for VS Code

23.3 Can I import an existing repo I developed?

BLUF: Yes, but you won’t be able to run it in the Palantir Foundry Code Workspaces VS Code environment unless it meets specific requirements.

  • For a repo to be able to run inside a Foundry VS Code session, it must meet a set of deployment requirements.
  • These requirements are described in Palantir documentation.
  • Users are advised to begin with one of the Palantir maintained VS Code project templates.
  • Once created in Code Workspaces, follow the instructions below to clone it locally for use outside Palantir.

23.4 Key steps (overview)

  1. Open an existing project in Foundry.
  2. Create a Foundry Code Repository using a template (e.g., Functions, Pipelines).
  3. Open this repo in a Code Workspaces VS Code session.
  4. Clone this repo to your computer.

23.5 Initial Configuration

Follow these steps once to ensure you have a working environment.

Install DoD Certificates

InstalRoot is the app that DoD uses to ensure secure communication. - Use USACE App Portal to install InstallRoot. - Open the InstallRoot app and click the “Install Certificates” button to install the required certificates.

Tell Git to use the Windows credential store

git config --global http.sslBackend schannel

Install the Palantir extension for Visual Studio Code

The Palantir extension for VS Code is used to clone a repository stored in Foundry Code Repositories. See install instructions here. - Download the extension .visx file. - On the VS Code Extensions tab, use the “three dot” menu, and select “Install from VSIX…” - In the Open dialog, navigate to the palantir extension .vsix file and click the “Install” button.


23.6 Step-by-Step

Step 1 - In Palantir Foundry Code Repositories, create a new repository

  • Open a web browser and log into Army Vantage (Palantir Foundry).
  • Go to the Code Repositories platform app.
  • Create a new repository using one of the existing templates (e.g., Functions, Transforms).
  • Choose to run this repo in VS Code.
  • Click the “Work Locally” button and copy the URL to the repository.
  • This should be structured something like: https://<your-id>:<giant-string-1>@vantage.army.mil/stemma/git/ri.stemma.main.repository.<giant-string-2>/<your-repo-name>

Step 2 - In VS Code on your computer, use the Palantir extension to clone the repo

  • Open a new empty session in VS Code.
  • In the Palantir extension, click the “Clone Repository” button.
  • When prompted, paste the you copied in the previous step.
  • This should trigger the clone operation. You should now see the repo you created in Foundry.

Step 3 - Make changes to your repo and commit as usual

  • Make changes and commit.
  • Use standard VS Code tools to push to Foundry.
  • If you have branches other than main, push them as well.

Step 4 - Verify in Foundry

  • Open the new Code Repository in Foundry to confirm your code and history have been imported.