The purpose of this example is to showcase all available features in PFO. It should help you to kickoff your config with a quick copy paste, and try field behaviours in your environment.
This example includes a:
bitbucket-pipelines.yml - needed for pipeline configuration
pipeline-forms.yml - needed for forms configuration
STEP 1 - bitbucket-pipelines.yml
Pipelines should be enabled in the Repository settings / Pipelines / Settings menu
After this you should navigate to your bitbucket-pipelines.yml and edit the file. It can be done from:
the UI editor in Bitbucket
any text editor you use for version control
image: node:18
definitions:
caches:
sonar: /root/.sonar/cache
frontend-node: static/frontend/node_modules
steps:
- step:
name: Templates
script:
- &build-backend-script |
npm install
npm run build
- &cd-frontend-run-install-script |
cd ./static/frontend
npm install -f
- &build-frontend-script |
cd ./static/frontend
npm install -f
npm run build
- &cd-forge |
cd forge
- &cd-root |
cd ../../
pipelines:
custom:
Demonstration pipeline:
- step:
name: Custom Step
script:
- echo "This step will run on a cloud runner.";
- printenv
Pipeline without forms:
- step:
name: Custom Step
script:
- echo "This step will run on a cloud runner.";
- printenv
Commit your changes.
STEP 2 - pipeline-forms.yml
Open your source code and add a new file on the root level, next to bitbucket-pipelines.yml, named pipeline-forms.yml.
If you struggle creating this file, check out this part of the documentation:
Edit the file with the following content:
groups:
- label: Mega Preset
key: MEGA
fields:
- &atlassian_base-url-text-field
label: Atlassian base URL
type: text
name: ATLASSIAN_BASE_URL
defaultValue: https://bitbucket.org
mandatory: true
note: Atlassian base URL
- &workspace-text-field
label: Workspace
type: text
name: WORKSPACE
mandatory: true
note: Bitbucket workspace
- &repository-text-field
label: Repository
type: text
name: REPOSITORY
mandatory: true
note: Bitbucket repository
- &bitbucket-site-url-text-field
label: Target Bitbucket site URL
type: text
name: SITE_URL
mandatory: true
note: Target bitbucket site URL
- &environment-text-field
label: Environment
type: text
name: ENVIRONMENT
mandatory: true
note: production or staging or other dev environment
- &forge-email-text-field
label: Atlassian account email
type: text
name: FORGE_EMAIL
mandatory: true
note: Atlassian account email
- &forge-password-text-field
label: Forge API token
type: text
name: FORGE_API_TOKEN
mandatory: true
secure: true
note: Forge api token
- &example-text-field
label: Text field
type: text
name: EXAMPLE_TEXT
- &example-regex-text-field
label: Regex test field
type: text
name: EXAMPLE_REGEX_TEXT
regex: ^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$
note: Valid email addresses only
- &example-select-field
label: Menu
type: select
name: EXAMPLE_SELECT
readonly: true
defaultValue: Soup
availableValues:
- Soup
- Meal
- Dessert
- &example-remote-select-field
label: Remote Jira version
type: remote_select
name: EXAMPLE_REMOTE_SELECT
availableValues:
url: "https://hub.docker.com/v2/repositories/atlassian/jira-software/tags/?page=1&page_size=100&name=8"
path: "$.results.[*].name"
- &example-number-field
label: Numbers
type: number
name: EXAMPLE_NUMBER
- &example-textarea-field
label: Big input here
type: textarea
name: EXAMPLE_TEXTAREA
- &example-checkbox-field
label: Agreement
type: checkbox
name: EXAMPLE_CHECKBOX
- &example-checkbox-group-field
label: Select any options
type: checkbox_group
name: EXAMPLE_CHECKBOX_GROUP
availableValues:
- Jira
- Confluence
- Bitbucket
- Other
- &example-radio-field
label: Which radio are you listening?
type: radio
name: EXAMPLE_RADIO
availableValues:
- Radio 1
- Blues Radio
- HipHop Radio
- Other
- &example-date-field
label: Deadline
type: date
name: EXAMPLE_DATE
forms:
- name: Run selenium tests
fields:
- *atlassian_base-url-text-field
- *workspace-text-field
- *repository-text-field
pipeline: run-e2e-tests
- name: Upgrade app
fields:
- *forge-email-text-field
- *forge-password-text-field
- *bitbucket-site-url-text-field
- *environment-text-field
pipeline: upgrade-installed-app
- name: Example with all fields
fields:
- *example-text-field
- *example-regex-text-field
- *example-select-field
- *example-remote-select-field
- *example-number-field
- *example-textarea-field
- *forge-password-text-field
- *example-checkbox-field
- *example-checkbox-group-field
- *example-radio-field
- *example-date-field
pipeline: Demonstration pipeline
groups:
- MEGA
- name: Example with all overwritten fields
fields:
- <<: *example-text-field
mandatory: true
- <<: *example-select-field
readonly: false
defaultValue: Meal
- <<: *example-textarea-field
mandatory: true
- <<: *example-checkbox-field
defaultValue: true
readonly: true
pipeline: Demonstration pipeline
groups:
- MEGA
Commit your changes.
STEP 3 - Open Pipeline Forms
From the sidebar, open the Pipeline Forms menu.
Select your commit and select the form named "Example with all fields".