My pipeline deploys my symfony app to an Azure app service after generating build assets in two steps through composer and yarn.
However, the server doesn't have the vendor folder generate by composer and webpack files generated in the node step are also missing.
Here is the pipeline file
pipelines:
branches:
main:
- step:
name: Build
image: composer:2.6
script:
- composer install --no-interaction --prefer-dist --optimize-autoloader --no-scripts --no-dev
- ls -l $BITBUCKET_CLONE_DIR
- echo "Installing composer dependencies complete"
caches:
- composer
artifacts: # defining the artifacts to be passed to each future step.
- vendor/**
- public/**
- step:
name: Frontend assets
image: node:20.9.0
caches:
- node
script:
- yarn add --dev @symfony/webpack-encore
- yarn run encore production
- ls -l $BITBUCKET_CLONE_DIR
- echo "Installing yarn dependencies complete"
artifacts:
- public/**
- step: &deploy-production
name: Deployment
deployment: Production
script:
- ls -l $BITBUCKET_CLONE_DIR
- sudo apt-get update
- sudo apt-get install zip
- zip -r bundle.zip . -x *.git* *.yml *.env
- pipe: atlassian/azure-web-apps-deploy:1.1.0
variables:
AZURE_APP_ID: $AZURE_APP_ID
AZURE_PASSWORD: $AZURE_PASSWORD
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_RESOURCE_GROUP: $AZURE_RESOURCE_GROUP
AZURE_APP_NAME: 'my-app'
ZIP_FILE: 'bundle.zip'
Any kind of pointers will be highly appreciated.
Hello @marvoh,
thank you for reaching out to Community!
An artifact definition will only make the current step to pass the artifact to the next step. If in the second step, you also want to pass the same artifacts, you will need to provide the artifacts paths again, and so on.
In your example, the vendor folder was defined as an artifact just in the first step. This means the second step will receive this artifact, but the third will not, because the second step doesn't have declared an artifact for the vendor/** folder.
If the missing files are just for the vendor folder, the solution would be to include that folder also in the definition of the second step, like below :
- step:
name: Frontend assets
image: node:20.9.0
caches:
- node
script:
- yarn add --dev @symfony/webpack-encore
- yarn run encore production
- ls -l $BITBUCKET_CLONE_DIR
- echo "Installing yarn dependencies complete"
artifacts:
- public/**
- vendor/**
It's important to note that those paths are relative to $BITBUCKET_CLONE_DIR. If the files you are trying to generate artifacts from are in a different directory, you will first need to move the files to a directory under $BITBUCKET_CLONE_DIR and then generate the artifacts from it.
You can also use the command
ls -lar $BITBUCKET_CLONE_DIR
in each of the step to recursively list all the files within that directory, and compare the results of the different steps to confirm if the file was indeed generated.
You can also download the artifact from the UI by clicking on the step that generated the artifact, selecting the Artifact tab in the result view, and clicking on the download icon. With this, you can extract the artifact file locally, confirm which files were included in the artifact generated, and make the adjustments accordingly.
For more details about artifacts, you may also find the following documentation helpful :
Thank you, @marvoh !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.