Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Bitbucket is a Web UI/Online Git repository manager. A cloud version of Bitbucket with Pipelines is now available.

General Uses:

  • Can be used to collaborate on code with inline comments and pull requests.

  • Can create, manage, and share Git (with version control) repositories to build and ship software.

  • Can perform lightweight code reviews.

Access and Configuration:

  1. Login to the Bitbucket Cloud uconnbitbucket workspace with your NetID credentials:.

  2. You will need to either update the remote URLs for all repositories or re-clone them from Bitbucket Cloud. When cloning from Bitbucket Cloud for the first time, you will be prompted to grant access between the repository and your client. If you’re logged into the VPN, you may receive a “Could not resolve host: bitbucket.org” message. You will need to disconnect and clone your repository.

  3. In order to perform git operations over HTTPS, you will need to log in to Bitbucket cloud and create an app password (recommended) or upload the public key of an existing (or new) SSH key, as these were not migrated.

    1. To create an App Password:

      1. Click on the cog in the upper right-hand corner, select Personal Bitbucket settings.

      2. From the left navigation menu, select App passwords, then click on Create app password.

      3. You will need save it somewhere because it’s long. The app password might be required each time you pull/commit changes to the repository, especially if you use Visual Studio Code. Another option for pull/commit changes is SourceTree.  The password is automatically saved.

    2. You can also create an SSH key (more advanced). Keep in mind if you use multiple workstations, you’ll need to copy the key to each. The SSH Key persists.

Tips:

  • Your Bitbucket username may be different than your NetID. Click on Account Settings to take note of your Bitbucket username.

  • Click on App authorizations to view which applications you have authorized.

  • If you have access to multiple workspaces in the cloud, click on your avatar in the upper right corner, then select the workspace to switch back and forth between workspaces.

  • If you are creating a new project, do not use a hyphen "-" as part of the project key.  You can use an underscore "_".

  • If you are creating new repositories, please add a unique value to the name.  For example, you can use the project key as a prefix.

  • If you experience an authentication error in SourceTree, you can delete this file: C:\Users\<netid>\AppData\Local\Atlassian\SourceTree\passwd.

  • If you cannot view repos within your projects (typically as a result of going back and forth to DC or Cloud), try clearing your cache. (Or test in private / incognito window.).

Bitbucket Pipelines:

Bitbucket pipelines is Atlassian’s CI/CD tool that is integrated with the cloud version of Bitbucket. It can aid users in creating powerful, automated workflows and deployments.

Pipelines:

  1. If you are deploying to an external server, make sure you contact (Zach Robert) to allow access to the university’s firewall for port 22 to your server from Bitbucket Cloud.

  2. There are two variables set at the workspace for the SSH Key, if required to deploy to an external server as we do today with Bamboo.

    1. $DEPLOY64_KEY is encoded.

    2. $DEPLOY_KEY is decoded.

  3. Scroll down to Pipelines>Settings and Enable Pipelines, if not already.

  4. Here’s an example bitbucket-pipelines.yml.file.

    1. Sample. This example will tar up a project then sftp to a server, then run the pre-generated script. You’ll need to modify it for your needs. Here’s a site that shows many examples on adding pipes to your file. This is just one way of writing the bitbucket-pipelines.yml.file.

    2. To add variables, go to Pipelines>Deployments and you’ll see several pre-defined environments that you add then to.

      1. SFTP_SERVER <server name>

      2. SFTP_USER deploy

    3. The default section below, will execute every time you commit files to the repository.

# Template PHP Build

image: php:7.4.33

definitions:
  steps:
    -steps: &build
     name: build the app
     scriptL
      -mkdir build
      -tar --exclude=build --exclude='bitbucket-pipelines.yml' -czvf build/pinnrpt.tar.gz*
    artifacts: 
     -build/**
   - step: &deploy-test
     name: deploy to test
     deployment: test
     script:
      - pipe: atlassian/scp-deploy:1.2.1
        variables:
         USER: $SFTP_USER
         SERVER: $SFTP_SERVER
         SSH_KEY:$DEPLOY64_KEY
         REMOTE_PATH:'/Apps/'
         LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/build/pinnrpt.tar.gz'
         DEBUG: 'true'
      -'echo "tar -xzf/Apps/pinnrpt.tar.gz -C /Apps/PinnRpt" > build-app-sh'
      -'echo "chown -R deploy:deploy/Apps/PinnRpt/" >> build-app.sh'
      -'echo "rm-f /Apps/pinnrpt.tar.gz">>build-app.sh'
      - pipe: atlassian/ssh-run:0.2.2
        variables:
         SSH_USER: $SFTP_USER
         SERVER: $SFTP_SERVER
         SSH_KEY: $DEPLOY64_KEY
         PORT: '22'
         MODE: 'script'
         COMMAND: 'build-app.sh'
      - step: &deploy-production
         name: deploy to production
         deployment: production
         script:
         - pipe: atlassian/scp-deploy:1.2.1
          variables:
          USER:$SFTP_USER
          SERVER:$SFTP_SERVER
          SSH_KEY:$DEPLOY64_KEY
          REMOTE_PATH:'/Apps/'
          LOCAL_PATH:'${BITBUCKET_CLONE_DIR}/build/pinnrpt.tar.gz'
          DEBUG: 'true'
        -'echo "tar -xzf/Apps/pinnrpt.tar.gz -C/Apps/PinnRpt">>build-app.sh'
        -'echo "chown -R deploy:deploy/Apps/PinnRpt/">> build-app.sh'
        -'echo "rm -f /Apps/pinnrpt.tar.gz" >>build-app.sh'
        - pipe: atlassian/ssh-run:0.2.2
         variables:
          SSH_USER: $SFTP_USER
          SERVER: $SFTP_SERVER
          SSH_KEY: $DEPLOY64_KEY
          PORT: '22'
          MODE: 'script'
          COMMAND: 'build-app.sh'
      -step: &deploy-production
        name: deploy to production
        deployment: production
        script:
         - pipe: atlassian/scp-deploy:1.2.1
           variables:
            USER: $SFTP_USER
            SERVER: $SFTP_SERVER
            SSH_KEY: $DEPLOY64_KEY
            REMOTE_PATH:'/Apps/'
            LOCAL_PATH:'${BITBUCKET_CLONE_DIR}/build/pinnrpt.tar.gz'
            DEBUG: 'true'
          -'echo "tar -xzf /Apps/pinnrpt.tar.gz -C /Apps/PinnRpt"> build-app.sh'
          -'echo "chown -R deploy:deploy /Apps/PinnRpt/">> build-app.sh'
          -'echo "rm -f /Apps/pinnrpt.tar.gz">> build-app.sh'
          -pipe: atlassian/ssh-run:0.2.2
           variables:
            SSH_USER: $SFTP_USER
            SERVER: $SFTP_SERVER
            SSH_KEY: $DEPLOY64_KEY
            PORT: '22'
            MODE: 'script'
            COMMAND: 'build-app.sh'
      
      pipelines:
       default:
        - step: *build
        - step:
           <<: *deploy-test
           deployment: Test
        custom:
         production:
         -step: *build
         -step:
           <<: *deploy-production
           deployment: Production
  • No labels