For the complete documentation index, see llms.txt. This page is also available as Markdown.

Project creation using Lineaje cloud

Pipeline samples demonstrating the project creation using Lineaje Cloud

Bitbucket pipeline example

Here is an example of bitbucket-pipelines.yml. It assumes a user access token (REPO_ACCESS_TOKEN) is created for the project and stored under BitBucket->Project Settings->Respository Variables

image: atlassian/default-image:3
definitions:
  steps:
    # This step exports all env variables required for other steps and stores it in 
    # build.env. build.env is then made available as artifacts thus making sure all
    # steps have access to these env variables
    - step: &set-version-variables
        name: Set Version Variables
        script:
          - export VERSION=${VERSION:-1.0.0}
          - echo export VERSION=${VERSION} >> build.env
          - export REPO_ACCESS_TOKEN=${REPO_ACCESS_TOKEN}
          - echo export REPO_ACCESS_TOKEN=${REPO_ACCESS_TOKEN} >> build.env
          - echo "Version set to $VERSION"
        artifacts:
          - build.env

    # This step triggers a project creation using Lineaje cloud
    # veecli upload command supports trigeering the project in Lineaje cloud
    # veecli accepts a json file as an input that has all inputs about the source code
    # including the url, version, the branch/tag, type, username/token to access the code
    - step: &generate-project-from-src
        name: generate project from src
        # Use amazon/aws-cli as the base image for this step as we have to issue s3 commands
        image: amazon/aws-cli:latest
        script:
          # Make sure to include build.env
          - source build.env
          # Define your aws access keys. This can come from repository variables for your project
          # This can be configured under BitBucket->Project Settings
          - export AWS_ACCESS_KEY_ID=$PROD_AWS_ACCESS_KEY_ID
          - export AWS_SECRET_ACCESS_KEY=$PROD_AWS_SECRET_ACCESS_KEY
          - export AWS_DEFAULT_REGION=us-west-2
          
          # PROJECT_NAME: The project in Lineaje portal will be shown with PROJECT_NAME
          #   $BITBUCKET_REPO_SLUG is the standard BB variabe that carries the project name
          #   You can change this if required
          # REPO_URL: Repo url that can be accssed via Lineaje Cloud
          # REPO_TYPE: Repo type. Accepted values are "github", "bitbucket", "gitlab", "git"
          # REPO_USER: Username who has access to this repo. This can come from repository variable.
          - export REPO_NAME=$BITBUCKET_REPO_SLUG
          - export PROJECT_NAME="$REPO_NAME-repo"
          - export REPO_URL="https://bitbucket.org/<project>/$REPO_NAME"
          - export REPO_TYPE="bitbucket"
          - export REPO_USER="user-abc"

          # Copy the Lineaje tool from s3 location
          # Refer Pre-Requisites section to learn more.
          - aws s3 cp s3:<bucketname>/lineaje-cli/config.json .
          - aws s3 cp s3:<bucketname>/lineaje-cli/veecli .
          - aws s3 cp s3:<bucketname>/lineaje-cli/input-src.json .
          - chmod +x veecli
          - chmod +w input-src.json

          # install jq. This tool wil be used to edit input-src.json
          - yum update --assumeyes
          - yum install --assumeyes jq

          # update the input-src.json
          # Update the project, version, srcurl, type, matchingref (branch/tag)
          # Update the credentails under repository_access_configs
          - tmp=$(mktemp)
          - jq '.project = env.PROJECT_NAME' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.version = env.VERSION' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.inputs[].SrcInfo.srcurl = env.REPO_URL' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.inputs[].SrcInfo.type = env.REPO_TYPE' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.inputs[].SrcInfo.matchingref = env.TAG' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.repository_access_configs[].path = env.REPO_URL' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.repository_access_configs[].type = env.REPO_TYPE' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.repository_access_configs[].user_name = env.REPO_USER' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq '.repository_access_configs[].token = env.REPO_ACCESS_TOKEN' input-src.json > "$tmp" && mv "$tmp" input-src.json
          - jq . input-src.json
          
          # Trigger the project creation job in Lineaje cloud
          # This step will only trigger the job in Lineaje cloud and return back
          - ./veecli upload --input input-src.json --type cli

pipelines:
  custom:
    deploy-to-prod:
      - step: *set-version-variables
      # Below 4 steps are just for illustration
      #- step: *build-artifacts
      #- step: *upload-artifacts-to-artifactory
      #- step: *push-image-to-prod
      #- step: *tag-branch
      - step: *generate-project-from-src

Last updated