Given the following CodeShip files:
codeship-services.yml
my_app_service: build: dockerfile: Dockerfile encrypted_env_file: codeship.env.encrypted cached: true
codeship-steps.yml
- name: build_and_test service: my_app_service command: npm install && npm test - name: deploy_to_staging service: my_app_service tag: staging command: ./deploy_script.sh staging
Define the pipeline in workflow.yaml
and store it in the .cloudbees/workflows/
directory of the repository. Alternatively, configure workflows directly in the CloudBees Unify UI.
For more information, refer to Workflows documentation.
workflow.yaml
apiVersion: automation.cloudbees.io/v1alpha1 kind: workflow name: My App CI/CD on: push: branches: - main - develop pull_request: {} permissions: scm-token-own: read scm-token-org: read id-token: write jobs: build-and-test: if: ${{ vars.environment == 'development' }} services: database: image: postgres:14 env: POSTGRES_DB: app_db POSTGRES_USER: user POSTGRES_PASSWORD: secret DB_PORT: 5432 steps: - name: Checkout Code uses: https://github.com/cloudbees-io/checkout@v1 - name: Install Dependencies and Test uses: docker://node:18-alpine run: | npm install npm test deploy-to-staging: needs: build-and-test env: STAGE_ENV: staging steps: - name: Checkout Code uses: https://github.com/cloudbees-io/checkout@v1 - name: Execute Deployment Script uses: docker://node:18-alpine run: | cd scripts ./deploy_script.sh ${{ env.STAGE_ENV }}