Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

what context or artifacts or variables are accessible during a pipeline deployment step?

I have been trying to setup a deployment step in my bitbucket-pipelines.yml but the documentation on what that step (in a typical or suggested workflow) is just not that clear.  All of the documentation has one-liners like "python deploy-to-prod.py".... ok,... what does that script *do* or *what* is that script acting on?

I see that you can set variables at the deployment level.  I am assuming people store credentials required to take action on your deployment (to push to a cloud resource).

What other variables does it have access to?... all of the variables that are used in other pipeline steps?

Does it have access to artifacts?

Could someone post a pseudo-code "deploy-to-prod.py" that might suggest a typical workflow of pushing the yielded build of a pipeline step to a production system.

 

1 answer

1 accepted

0 votes
Answer accepted

Hi Brad,

A deployment step has access to artifacts defined in previous steps, repository variables, workspace variables, default variables as listed here: https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/, and variables defined for that specific deployment environment.

It doesn't have access to variables of other deployment environments. I am not sure what you are referring to with variables that are used in other pipeline steps? Do you mean variables that you defined in the script of previous steps?

I am not sure about the deploy-to-prod.py file as I've never used Python, but I believe that it would contain commands to push all or certain repo files or files you generated during the build to a remote server.

When you run a Pipelines build the repo is cloned in a Docker container, so repo files on that commit or files you create during the build can be deployed to a server.

There are different tools that can be used for deployment, you can check the following guide that has examples of deployments to different platforms, in case you use any of them:

In many of these use cases, deployment can be done with a pipe, so you may not need to have any additional commands. You can check e.g. the following deployment guide from the above page, you can use a certain pipe to deploy files to your server via SSH:

Other users may use e.g. git ftp for this purpose, in this case the deployment step would include git ftp commands.

I hope this helps, please feel free to let me know if you have any other questions.

Kind regards,
Theodora

Thanks for the reply.   I think maybe I was not thinking of the atomic content you describe here...  When you run a Pipelines build the repo is cloned in a Docker container, so repo files on that commit or files you create during the build can be deployed to a server.

I approached my deployment by using an artifact to store the docker image tag that should be deployed in the deployment step.   All of my projects build and push docker images so there really is no artifact.   I guess it's intuitive to others but an example of this would have helped me a lot.

Your answer is descriptive and helps.  In general, probably wasn't thinking of the step semantics with regard to the examples provided.

 

  - step:
script:
- docker login ....
- buildRelease.sh
-
 - # might be composed from facts known in this step only
- docker_tag=${BITBUCKET_BUILD_NUMBER}
-
- docker push ....
- echo export DOCKER_TAG=${docker_tag} > artifact-tag
artifacts:
- artifact-tag
- step:
deployment: test
script:
- source artifact-tag
- pipe: atlassian/google-gke-kubectl-run:1.3.0
variables:
# ... some reference to the DOCKER_TAG here

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,903 views 0 7
Read article

Community Events

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

Events near you