我是CI / CD的新手,我已经尝试了几天在AWS S3上将应用程序部署到我们的存储桶中。
此: https://circleci.com/docs/1.0/continuous-deployment-with-amazon-s3/
这个: https://medium.com/@zlwaterfield/circleci-s3-upload-dbffa0956b6f
但是不知怎的,我试图这样做是不可能成功的。 Circleci说我的文件成功是构建的,但不知何故没有进行部署并且没有收到错误消息。我的AWS权限已设置,因此这项任务非常令人沮丧。
这是我的最终档案:
jobs:
build:
docker:
-
image: "circleci/openjdk:8-jdk"
environment:
JVM_OPTS: "-Xmx3200m"
TERM: dumb
steps:
- checkout
-
restore_cache:
keys:
- "v1-dependencies-{{ checksum \"build.gradle\" }}"
- v1-dependencies-
-
run: "gradle dependencies"
-
save_cache:
key: "v1-dependencies-{{ checksum \"build.gradle\" }}"
paths:
- ~/.gradle
-
run: "gradle test"
working_directory: ~/repo
deploy:
machine:
enabled: true
steps:
-
run:
command: 'aws s3 sync ${myAppName}/ s3://${myBucketName} --region us-west-2'
name: Deploy
working_directory: ~/repo
version: 2
任何人都能说清楚我做错了什么?
先谢谢!
答案 0 :(得分:-1)
更新:我找到了办法。如果有人需要,这是我的解决方案:
jobs:
build:
docker:
-
image: "circleci/openjdk:8-jdk"
environment:
JVM_OPTS: "-Xmx3200m"
TERM: dumb
steps:
- checkout
-
restore_cache:
keys:
- "v1-dependencies-{{ checksum \"build.gradle\" }}"
- v1-dependencies-
-
run: "gradle dependencies"
-
save_cache:
key: "v1-dependencies-{{ checksum \"build.gradle\" }}"
paths:
- ~/.gradle
-
run: "gradle build"
-
run: "gradle test"
- run:
command: "sudo apt-get -y -qq install awscli"
name: "Install awscli"
-
run:
command: "aws configure list"
name: "show credentials"
-
run:
command: "aws s3 ls"
name: "List all buckets"
-
run:
command: "aws s3 sync /tmp/app/myProject/build/libs s3://my-aws-bucket"
name: "Deploy to my AWS bucket"
working_directory: /tmp/app
version: 2
workflows:
build-deploy:
jobs:
-
build-job:
filters:
branches:
only:
- /development.*/
- /staging.*/
version: 2