1
votes

I'm trying to build and then deploy the artifacts (jar) by the bitbucket pipeline. The build is working but the deploy of the artifacts doesnt work as I want it.

When the pipeline is finished I have all code files (src/main/java etc) instead of the jar on the ftp server.

Do you see where I do the mistake? Actually I also looked for a another ftp function but failed.

Pipeline:

# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.3.9

pipelines:
  default:
    - step:
        name: Build
        caches:
          - maven
        script:
          - apt-get update
          - apt-get install -y openjfx
          - mvn install -DskipTests
        artifacts:
          - /opt/atlassian/pipelines/agent/build/target/**
          - target/**
          # - /**.jar

    - step:
        name: Deploy
        script: 
          - apt-get update
          - apt-get -qq install git-ftp
          - git ftp init --user $user --passwd $pw -v sftp://$host:5544/$folder
1

1 Answers

1
votes

To solve this problem I added the SSH-Key to Bitbucket. Then I could do the deploy by sftp using lftp and docker images.

pipelines:
  branches:
    master:
      - step:
          name: Build
          image: tgalopin/maven-javafx
          caches:
            - maven
          script:
            - mvn install
          artifacts:
            - target/**

      - step:
          name: Deploy
          image: alpacadb/docker-lftp
          script:
            - lftp sftp://$user:$pw@$host:$port  -e "put /my-file; bye"