我正在尝试通过bitbucket管道构建然后部署工件(jar)。构建工作正常,但是工件的部署无法按我的意愿进行。
当管道完成时,我拥有所有代码文件(src / main / java等),而不是ftp服务器上的jar。
您看到我在哪里做错了吗?实际上,我还寻找了另一个ftp函数,但是失败了。
管道:
# 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
答案 0 :(得分:1)
为解决此问题,我将SSH密钥添加到Bitbucket。然后,我可以使用lftp和docker镜像通过sftp进行部署。
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"