mongodb - 如何将 awscli 内容移动到 MongoDB
问题描述
下面是 Gitlab 控制台的输出,现在我想要将文件夹 Jun-06-1560275587 的所有内容(包括文件夹名称 Jun-06-1560275587)移动到 MongoDB,我的问题是如何配置 mongodb 以与 Gitlab 的 awscli 控制台对话然后将文件夹内容推送到 MongoDB
我正在使用 AWS 和 Gitlab
$ aws s3 cp s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG} s3://${BUCKET_NAME}/PreviousExecuted/$(date +"%h-%m-%s") -- recursive --include "binaries/${filename}*"
Completed 108.5 KiB/83.7 MiB (240.2 KiB/s) with 359 file(s) remaining
copy: s3://gitlabgatlingreport/master/index.html to s3://gitlabgatlingreport/PreviousExecuted/Jun-06- 1560275587/index.html
Completed 108.5 KiB/83.7 MiB (240.2 KiB/s) with 358 file(s) remaining
Completed 140.1 KiB/83.7 MiB (294.6 KiB/s) with 358 file(s) remaining
copy: s3://gitlabgatlingreport/master/js/moment.min.js to s3://gitlabgatlingreport/PreviousExecuted/Jun-06- 1560275587/js/moment.min.js
Completed 140.1 KiB/83.7 MiB (294.6 KiB/s) with 357 file(s) remaining
Completed 140.2 KiB/83.7 MiB (286.9 KiB/s) with 357 file(s) remaining
copy: s3://gitlabgatlingreport/master/js/assertions.xml to s3://gitlabgatlingreport/PreviousExecuted/Jun-06- 1560275587/js/assertions.xml
Completed 140.2 KiB/83.7 MiB (286.9 KiB/s) with 356 file(s) remaining
Completed 153.3 KiB/83.7 MiB (309.9 KiB/s) with 356 file(s) remaining
copy: s3://gitlabgatlingreport/master/js/all_sessions.js to s3://gitlabgatlingreport/PreviousExecuted/Jun-06- 1560275587/js/all_sessions.js
Completed 153.3 KiB/83.7 MiB (309.9 KiB/s) with 355 file(s) remaining
Completed 156.9 KiB/83.7 MiB (311.0 KiB/s) with 355 file(s) remaining
copy: s3://gitlabgatlingreport/master/js/gatling.js to
s3://gitlabgatlingreport/PreviousExecuted/Jun-06-
1560275587/js/gatling.js
我需要将文件夹 Jun-06-1560275587 的所有内容(包括文件夹名称 Jun-06-1560275587)从 gitlab awscli 移动到 MongoDB
这是我的 Gitlab yaml,如果我需要在我的 Gitlab yaml 中添加一些 MongoDB 图像,请告诉我,以便 mongoDB 和 gitlab awscli 可以相互连接
displayresults:
image: python:latest
stage: displayresults
tags:
- docker
dependencies:
- cleanup
before_script:
- pip install awscli # Install the SDK
script:
- 'find /builds/LOT/perftestsgeneric'
- 'find binaries'
- 'cd /builds/LOT/perftestsgeneric/binaries/${filename}* && ls && hostname -i' - 'aws s3 cp /builds/LOT/perftestsgeneric/binaries/${filename}* s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive' # Replace example-bucket with your bucket
- 'aws s3 cp s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG} s3://${BUCKET_NAME}/PreviousExecuted/$(date +"%h-%m-%s") -- recursive --include "binaries/${filename}*"'
environment:
name: ${CI_COMMIT_REF_SLUG}
url: http://${BUCKET_NAME}.s3-website.${AWS_DEFAULT_REGION}.amazonaws.com/${CI_COMMIT_REF_SLUG} # This is the url of the bucket we saved before
on_stop: clean_s3 # When the branch is merged, we clean up after ourself
clean_s3:
image: "python:latest"
stage: displayresults
tags:
- docker
before_script:
- pip install awscli
script:
- aws s3 rm s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive #
Replace example-bucket with your bucket
environment:
name: ${CI_COMMIT_REF_SLUG}
action: stop
when: manual
解决方案
推荐阅读
- next.js - nextjs+Dockerfile:环境变量传递给 nextjs.config.js
- windows - 当我关闭一个窗口时,所有 Chrome 窗口都会关闭
- python - OneHotEncoder - 一次多列
- jquery - 设置字幕文件后,视频播放器字幕未启用
- python - Python:数据框中的分类值图
- python - 计算字符串中纯整数的数量
- typescript - 从 Typescript 中的字符串推断表达式
- mongodb - MongoDB (Mongoose) 使用分页连接查询
- reactjs - 如何使用 React Hooks 和 Redux 将数据传递给对象
- python - 使用 types_linq 模块中的 Enumerable 类计算 python3 中 XML 文件中的特定标记