Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
pipeline:
  - app.install:
      github: "acme/my-pipeforce-app"
      secret: "my-github-token"

Via GitHub Action

Status
colourYellow
titleDRAFT: NEEDS REVIEW + TEST

In order to setup a CI/CD process, you can use GitHub Actions. Using this approach, you can automate the deployment of an app to a PIPEFORCE instance every time a specific event happened in the repository. Such an event for example could be a push to a specific branch. Every time a new push to this branch is executed, the app will be updated on the instance as configured before.

To enable this approach, you have to follow the steps below to create a GitHub Action configuration and enable it.

Go to your local repo folder of your app, create a new file at root level: .github/workflows and add these lines to the file:

Code Block
languageyaml
name: "Deploy all apps of repo"

# Define when the workflow must be triggered
on: 
  push:
    branches: ["master"]

env:
  PI_INSTANCE_URL: https://hub-NS.pipeforce.net
  PI_SECRET_NAME: github-token
  PI_USERNAME_PASSWORD: ${{ secrets.PIPEFORCE_DEVOP_USER }} 
  GH_REPO: path/to-app-repo
  GH_BRANCH: master

# Allows to trigger the action also manually on the GitHub UI
workflow_dispatch:

# The tasks to execute on trigger
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install app
        run: | 
            curl --fail --trace-ascii -u ${PI_USERNAME}:${PI_PASSWORD} -m 300 -X GET --location "${PI_INSTANCE_URL}/api/v3/command:app.install?secret=${PI_SECRET_NAME}&github=${GH_REPO}&branch=${GH_BRANCH}&overwrite=true"

Adjust the file to fit your needs:

  • Define the trigger when the action should run. See GitHub Actions documentation about all options.

  • Change the env variables accordingly:

    • PI_INSTANCE_URL = The url of the instance you would like to deploy to.

    • PI_SECRET_NAME = The name of the GitHub personal token stored inside PIPEFORCE under this name as described for Private Repo.

    • PI_USERNAME_PASSWORD = The username and password of the user who is allowed to execute the app.install command on PIPEFORCE. Make sure it is stored in GitHub as secret under this name and in format username:password.

    • GH_REPO = The name of the repo which contains the apps to be deployed.

    • GH_BRANCH = The branch of the repo to be deployed.

Finally push your changes to GitHub.

In future, every time the trigger as defined in on: section happens, the app gets updated.

From Marketplace

In order to install an app from the Apps Marketplace, see here: /wiki/spaces/DEV/pages/2423062592

...