【发布时间】:2020-01-22 23:45:48
【问题描述】:
这里有新的 CircleCI 用户。我一直在努力尝试执行mkdir 命令。或者,更准确地说,是找到命令执行的结果。
该步骤在我的工作流程中成功退出,但该文件夹似乎实际上并不存在。我无法在文件系统中的任何位置找到它。
这是我的 config.yml 文件:
# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
build:
branches:
only:
- staging
working_directory: ~/build
docker:
- image: circleci/php:7.2-node-browsers
steps:
- checkout
- run:
name: APT Installs (ZIP, PDO, MySQL, Composer)
command: |
sudo docker-php-ext-install zip
sudo docker-php-ext-install pdo pdo_mysql
sudo apt-get install software-properties-common
sudo composer self-update
- run:
name: Install Python and PIP
command: |
sudo apt-get install -y python3.7
sudo apt install -y python3-pip
sudo pip3 install --upgrade pip
sudo pip3 install --upgrade awscli
sudo pip3 install --upgrade awsebcli
- run:
name: Create Image Directory (if not exists)
command: |
sudo mkdir -m 0755 -p /var/user_image
ls -l /var/user_image
- run:
name: Setup AWS credentials
command: |
mkdir ~/.aws && printf "[profile eb-cli]\naws_access_key_id = $REDACTED\naws_secret_access_key = $REDACTED" > ~/.aws/config
- deploy:
name: Deploy to Elastic Beanstalk
command: |
eb deploy PixapadTest-env
# Download and cache dependencies
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- restore_cache:
keys:
- node-v1-{{ checksum "package.json" }}
- node-v1-
- run:
name: Install app dependencies
command: |
composer install -n --prefer-dist
- save_cache:
key: v1-dependencies-{{ checksum "composer.json" }}
paths:
- ./vendor
- run:
name: Database Setup
command: |
vendor/bin/phinx migrate -e staging
这是最近成功的工作流程的屏幕截图:
我哪里错了?
编辑 #1: 在 CircleCI 用户的建议下,我将 ls -l /var/user_image 添加到我的 config.yml 中,就在 sudo mkdir -m 0755 -p /var/user_image 下方。工作流步骤输出以下内容:
没有错误,但我仍然找不到目录。我怀疑此时它正在被某个进程删除...我只是不确定为什么。
编辑 #2: 更新为完整的 config.yml。
【问题讨论】:
-
如何检查目录是否存在?
-
使用
sudo find /var/user_image、sudo find *user_image*以及手动打开文件夹和使用ll。此外,在 CircleCI 用户的推荐下,我在我的 config.yml 中添加了ls -l /var/user_image。它输出“total 0”而没有错误。该文件夹似乎已创建,但可能在某个时候被删除。 -
我们需要查看更多配置或构建链接,以了解发生了什么。我运行了您的配置的简化版本,它对我来说很好用。 circleci.com/gh/felicianotech/cci-testing-pub/927
-
太棒了!更新。感谢您的观看!
-
嗯,刚上床我就有了一个启示。我正在寻找生产箱上的文件夹,同时告诉 CircleCI 在容器中创建它。哦!如果它在我的 Elastic Beanstalk 实例中不存在,我只需要弄清楚如何创建它。
标签: ubuntu circleci amazon-linux