I might be missing something obvious, but I am getting started with Pipelines and want to deploy a simple project to Azure.
According to your documentation, https://bitbucket.org/mojall/bitbucket-pipelines-deploy-to-azure is how to integrate with Azure. On this page, there is not much except a VS Code extension.
I cloned the repo, installed the extension (I do not use VS Code) and am not sure how to proceed now... there's no instructions at all for what to do next?!
Is there any documentation on how to deploy to azure or a simple example perhaps?
Community moderators have prevented the ability to post new answers.
Ok, so I finally figure this out after 10 hours of experimenting and thought I woud shared it here as the documentation for integrations with Bitbucket is virtually non-existent.
So my requirement: Deploy an Angular2 app built with Angular-CLI to Azure on a checkin. It builds a DIST AOT build folder which needs to be tested and deployed to the root of your Azure App Service.
Firstly: The Azure integration document here https://bitbucket.org/mojall/bitbucket-pipelines-deploy-to-azure is not well documented either. It is NOT an example of how to configure it - it is a VS Code extension to help configure it, which is not what I was looking for. I was able to dig in their source to extract the bits I needed:
Here is my Pipeline YAML: I have left in the debugging statements that helped me figure out what was going on. (You can also enable npm test). The variables are from the Azure FTP publishing profile and go into BB Variables.
This chews through Build Minutes (around 8min per build) - I guess you could build a Docker image which already had your version of AngularCLI installed to save some time.
Hope this helps someone...
# http://gimly.github.io/azure/2016/12/27/bitbucket-pipelines-deploy-azure.html # https://bitbucket.org/mojall/bitbucket-pipelines-deploy-to-azure/src/ac127659113e/artifacts/FTP/?at=master # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: node:5.11.0 pipelines: default: - step: script: - echo "Starting - DEV1 Build" - pwd - ls -al - npm i -g firstname.lastname@example.org - npm i #- npm test #if this passes then build package for deployment - ng build --env=dev1 --aot # Build DEV1 Artifacts - ls -al - apt-get update # Now run the FTP bash script to deploy dist folder to DEV1 - apt-get install ncftp - ncftpput -v -u "$FTP_USERNAME" -p "$FTP_PASSWORD" -R $FTP_HOST $FTP_SITE_ROOT dist/* - echo Finished uploading /dist files to $FTP_HOST$FTP_SITE_ROOT
@Rodney Joyce This looks like it works but I am getting a "could not stat dist/*: No such file or directory." error. I check the logs and dist folder does get created. If I replace dist/* with * it starts copying everything across.
Did you have an issue with this?
Didn't see that you had a single step. Should have copy pasted :). I find it a bit unusual that if I create Step 2 it will not find the newly created dist folder.
In order to save some minutes you can go with Kudu API and actually push into it:
name: Build and test
script: # install packages and run tests
- npm install
- npm test
name: Deploy to Azure
- git push https://$AZURE_LOGIN:$AZURE_PASSWORD@$AZURE_APP_NAME.scm.azurewebsites.net:443/$AZURE_APP_NAME.git master
credentials from Azure FTP Deployment saved as project variable in Bitbucket settings
more details on BitBucket docs
I'm not too knowledgeable on specifics with Azure. However, this page had some more information:
It looks like you can run something in the VS Code extension you installed that will generate the required files for you to deploy to Azure from Bitbucket Pipelines.
Let me know your findings. Include the generated files here if you get stuck (remove any secrets first of course :wink:).
@Philip Hodder I tried using the extension and while it works (copies from all folders), I only want to copy from the dist folder. If I replace * with dist/* it says
could not stat dist/*: No such file or directory.
ncftpput dist/*: no valid files were specified.
Turns out I needed to have this in a single step. When I list folders I do see it in Step 2 but ftp command does not find it. The other thing I would liked to have is not install the ftp program every time. That chews up the build time.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events