I'm trying to build a pipeline to build and deploy to S3 one of our angular projects.
I can use the atlassian pipe for this (atlassian/aws-s3-deploy:0.2.4), but since I'm using the same build task for staging and production a specific configuration variable needs to be "injected" on artifact to be uploaded with different values to each environment.
The developer asked a file with the URL for the API backend to be inserted (to use the staging or prod API on build).
I thought of running another script step to generate the file (using a value from a deployment variable) on the distribution directory, but this doesn't seem to work:
image: node:10.15.1
definitions:
build:
- step: &build-generate
script:
- npm install
- npm run build:prod
artifacts:
- dist/**
deploy: &deploy-to-s3
- step:
name: Deploying
deployment: staging
script:
- echo "var BASE_URL = \"$API_CORE_URL\";" > dist/site-admin/assets/config.js
- pipe: atlassian/aws-s3-deploy:0.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: "eu-west-1"
S3_BUCKET: $OUR_AWS_BUCKET_NAME
LOCAL_PATH: "dist/site-admin"
ACL: "public-read"
CACHE_CONTROL: 'max-age=3600'
DELETE_FLAG: 'true'
EXTRA_ARGS: '--follow-symlinks'
pipelines:
tags:
release-*:
- step: *build-generate
- step:
<<: *deploy-to-s3
deployment: 'production'
custom:
deploy-to-staging:
- step: *build-generate
- step:
<<: *deploy-to-s3
I get an error saying
No commands or pipes defined for the step at [pipelines > custom > deploy-to-staging > 1 > step]. Check that you have defined a valid "script" section.
Apparently this is not valid. How should I do this instead?
Thanks @davina Davina. Now I get
There is an error in your bitbucket-pipelines.yml at [pipelines > custom > deploy-to-staging > 1 > step]. To be precise: This section should be a map (it is currently defined as a list).
The validator says it's fine, although it's not. Would be nice if the validator ran some of the same checks than the actual thing does.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't get any validation errors after that fix.
image: node:10.15.1
definitions:
build:
- step: &build-generate
script:
- npm install
- npm run build:prod
artifacts:
- dist/**
deploy:
- step: &deploy-to-s3
name: Deploying
deployment: staging
script:
- echo "var BASE_URL = \"$API_CORE_URL\";" > dist/site-admin/assets/config.js
- pipe: atlassian/aws-s3-deploy:0.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: "eu-west-1"
S3_BUCKET: $OUR_AWS_BUCKET_NAME
LOCAL_PATH: "dist/site-admin"
ACL: "public-read"
CACHE_CONTROL: 'max-age=3600'
DELETE_FLAG: 'true'
EXTRA_ARGS: '--follow-symlinks'
pipelines:
tags:
release-*:
- step: *build-generate
- step:
<<: *deploy-to-s3
deployment: 'production'
custom:
deploy-to-staging:
- step: *build-generate
- step:
<<: *deploy-to-s3
Try copy the whole file with the fix.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.