Jenkins – 永夜 https://www.shuijingwanwq.com 没有不值得去解决的问题,也没有不值得去学习的技术! Sun, 31 May 2026 03:54:00 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.0 在 Jenkins 中构建镜像时报错:error checking context: ‘can’t stat ‘/dataes/jenkins/workspace/ccp/api/code/vendor/james-heinrich/getid3/demos/demo.mysqli.php” https://www.shuijingwanwq.com/2021/07/28/5099/ https://www.shuijingwanwq.com/2021/07/28/5099/#respond Wed, 28 Jul 2021 07:09:27 +0000 https://www.shuijingwanwq.com/?p=5099 Post Views: 82

1、在 Jenkins 中构建镜像时报错:error checking context: ‘can’t stat ‘/dataes/jenkins/workspace/ccp/api/code/vendor/james-heinrich/getid3/demos/demo.mysqli.php”。如图1

在 Jenkins 中构建镜像时报错:error checking context: 'can't stat '/dataes/jenkins/workspace/ccp/api/code/vendor/james-heinrich/getid3/demos/demo.mysqli.php''

图1

2、Configure -> Build Environment -> Delete workspace before build starts (勾选)。构建环境 -> 在构建开始前删除工作区。如图2

Configure -> Build Environment -> Delete workspace before build starts (勾选)。构建环境 -> 在构建开始前删除工作区。

图2

3、构建成功。构建成功后,可以取消勾选第 3 步骤的设置。后续构建,仍然可以成功。如图3

构建成功。构建成功后,可以取消勾选第 3 步骤的设置。后续构建,仍然可以成功。

图3

 

]]>
https://www.shuijingwanwq.com/2021/07/28/5099/feed/ 0
Error processing tar file(exit status 1): unexpected EOF 的排查分析 https://www.shuijingwanwq.com/2021/03/11/4779/ https://www.shuijingwanwq.com/2021/03/11/4779/#respond Thu, 11 Mar 2021 02:41:24 +0000 https://www.shuijingwanwq.com/?p=4779 Post Views: 292 1、在 Jenkins 中构建镜像,报错:Error processing tar file(exit status 1): unexpected EOF。如图1
在 Jenkins 中构建镜像,报错:Error processing tar file(exit status 1): unexpected EOF。

图1



Step 10/10 : RUN chown -R nginx:nginx /mcloud/ &&     chmod 777 /mcloud/cmp_main/data &&     chmod 777 /usr/share/sync.sh &&     chmod 777 /mcloud/cmp_main/attachment &&     chmod +x /config/init/* &&     chmod +x /etc/nginx/conf.d/* &&     chmod +x /etc/supervisord.d/* &&     rm -rf /mcloud/cmp_main/data/tpl/ &&     rm -rf /etc/nginx/conf.d/status.conf
 ---> Running in 800972ee06bc
Error processing tar file(exit status 1): unexpected EOF
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE


2、查看 Dockerfile ,应该是 ADD 命令的行数过多了一些,进而导致空间不足。参考网址:https://stackoverflow.com/questions/42784396/docker-error-error-processing-tar-fileexit-status-1-unexpected-eof 。如图2
查看 Dockerfile ,应该是 ADD 命令的行数过多了一些,进而导致空间不足。

图2



ADD code /mcloud/cmp_main
ADD code/build/c_files/ /
ADD code/build/sync.sh /usr/share/sync.sh
ADD code/build/cacheJsSDK.sh /usr/share/cacheJsSDK.sh
ADD code/build/MP_verify_3RUFnkMVef9eh3mJ.txt /mcloud/cmp_main/
ADD code/build/MP_verify_qxIMkC3go7fNqBzb.txt /mcloud/cmp_main/

RUN sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system/disable_functions = system/g' /usr/local/php/etc/php.ini

RUN chown -R nginx:nginx /mcloud/ && \
    chmod 777 /mcloud/cmp_main/data && \
    chmod 777 /usr/share/sync.sh && \
    chmod 777 /mcloud/cmp_main/attachment && \
    chmod +x /config/init/* && \
    chmod +x /etc/nginx/conf.d/* && \
    chmod +x /etc/supervisord.d/* && \
    rm -rf /mcloud/cmp_main/data/tpl/ && \
    rm -rf /etc/nginx/conf.d/status.conf


3、剪切 /build/sync.sh 至 /build/c_files/usr/share/sync.sh。剪切 /build/cacheJsSDK.sh 至 /build/c_files/usr/share/cacheJsSDK.sh。剪切 /build/MP_verify_3RUFnkMVef9eh3mJ.txt 至 /build/c_files/mcloud/cmp_main/MP_verify_3RUFnkMVef9eh3mJ.txt。剪切 /build/MP_verify_qxIMkC3go7fNqBzb.txt 至 /build/c_files/mcloud/cmp_main/MP_verify_qxIMkC3go7fNqBzb.txt。编辑 Dockerfile,删除了 4 行 ADD。如图3
剪切 /build/sync.sh 至 /build/c_files/usr/share/sync.sh。剪切 /build/cacheJsSDK.sh 至 /build/c_files/usr/share/cacheJsSDK.sh。剪切 /build/MP_verify_3RUFnkMVef9eh3mJ.txt 至 /build/c_files/mcloud/cmp_main/MP_verify_3RUFnkMVef9eh3mJ.txt。剪切 /build/MP_verify_qxIMkC3go7fNqBzb.txt 至 /build/c_files/mcloud/cmp_main/MP_verify_qxIMkC3go7fNqBzb.txt。编辑 Dockerfile,删除了 4 行 ADD。

图3



RUN sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system/disable_functions = system/g' /usr/local/php/etc/php.ini

ADD code /mcloud/cmp_main
ADD code/build/c_files/ /

RUN chown -R nginx:nginx /mcloud/ && \
    chmod 777 /mcloud/cmp_main/data && \
    chmod 777 /usr/share/sync.sh && \
    chmod 777 /mcloud/cmp_main/attachment && \
    chmod +x /config/init/* && \
    chmod +x /etc/nginx/conf.d/* && \
    chmod +x /etc/supervisord.d/* && \
    rm -rf /mcloud/cmp_main/data/tpl/ && \
    rm -rf /etc/nginx/conf.d/status.conf


4、再次构建,第一次构建报错:unknown parent image ID sha256:。不过第二次构建成功。如图4
再次构建,第一次构建报错:unknown parent image ID sha256:。不过第二次构建成功。

图4

5、调整前后的镜像大小分别为:4711、3882。大小减少了:4711 – 3882 = 829。如图5
调整前后的镜像大小分别为:4711、3882。大小减少了:4711 - 3882 = 829。

图5

6、另一个可能的原因在于 Dockerfile 刚经过大幅度的修改。此种情况下,建议多构建几次。最终还是可以构建成功。]]>
https://www.shuijingwanwq.com/2021/03/11/4779/feed/ 0
两个项目,前后端合并至一个镜像、一个容器,以端口进行区分的实现流程 https://www.shuijingwanwq.com/2021/02/24/4750/ https://www.shuijingwanwq.com/2021/02/24/4750/#respond Wed, 24 Feb 2021 02:23:26 +0000 https://www.shuijingwanwq.com/?p=4750 Post Views: 101 1、两个项目,前后端,两个镜像,两个容器。如图1
两个项目,前后端,两个镜像,两个容器。

图1

2、前端构建目录结构。如图2
前端构建目录结构

图2

3、接口构建目录结构。如图3
接口构建目录结构

图3

4、前端构建的相关配置。如图4
前端构建的相关配置

图4

5、接口构建的相关配置。如图5
接口构建的相关配置

图5

6、调整前端的构建目录结构。将 build 重合名为 dist。将 build_docker 重合名为 build。将 build_docker/c_files/config/init/config0.sh 重命名为 build/c_files/config/init/config_front0.sh。删除 Dockerfile。如图6
调整前端的构建目录结构。将 build 重合名为 dist。将 build_docker 重合名为 build。将 build_docker/c_files/config/init/config0.sh 重命名为 build/c_files/config/init/config_front0.sh。删除 Dockerfile。

图6

7、调整接口的构建目录中的 Dockerfile。如图7
调整接口的构建目录中的 Dockerfile。

图7

8、在 Jenkins 的配置中,Source Code Management – Multiple SCMs 。添加 2 个 Git 仓库。分别为接口与前端。如图8
在 Jenkins 的配置中,Source Code Management -  Multiple SCMs 。添加 2 个 Git 仓库。分别为接口与前端。

图8

9、在 Jenkins 的配置中,Build – Docker Build and Publish 。Tag:pcsfront_dev_65e60624dcbc98445056a602d27c2552e58532df_pcsapi_dev_$GIT_COMMIT。前端的提交 ID,需要每一次手动更改。接口的提交 ID,可以自动读取。如图9
在 Jenkins 的配置中,Build -  Docker Build and Publish 。Tag:pcsfront_dev_65e60624dcbc98445056a602d27c2552e58532df_pcsapi_dev_$GIT_COMMIT。前端的提交 ID,需要每一次手动更改。接口的提交 ID,可以自动读取。

图9

10、查看容器中的目录结构,前端与接口皆存在。且分别可以正常访问。符合预期。如图10
查看容器中的目录结构,前端与接口皆存在。且分别可以正常访问。符合预期。

图10

 


[root@api-5db464c777-fp9gk /]# cd /etc/nginx/conf.d/
[root@api-5db464c777-fp9gk conf.d]# ls -l
total 8
-rwxrwxr-x 1 root root 1109 Feb 23 15:33 pcs_api.conf
-rwxrwxr-x 1 root root  928 Feb 23 15:33 pcs_front.conf
[root@api-5db464c777-fp9gk conf.d]# cd /mcloud/www/
[root@api-5db464c777-fp9gk www]# ls -l
total 16
drwxrwxr-x 1 nginx nginx 4096 Feb 23 15:33 pcs_api
drwxrwxr-x 1 nginx nginx 4096 Feb 23 15:11 pcs_front
[root@api-5db464c777-fp9gk www]# curl http://api.pcs:82/api.txt
api
[root@api-5db464c777-fp9gk www]# curl http://api.pcs/front.txt
front
[root@api-5db464c777-fp9gk www]# curl http://pcsapi.dev.chinamcloud.cn/api.txt
api
[root@api-5db464c777-fp9gk www]# curl http://pcsfront.dev.chinamcloud.cn/front.txt
front
[root@api-5db464c777-fp9gk www]# 


]]>
https://www.shuijingwanwq.com/2021/02/24/4750/feed/ 0
在 Jenkins 中,多个 Tag 的最后提交 ID 相同时,确保镜像地址为其中某个具体 Tag 名的实现 https://www.shuijingwanwq.com/2021/02/22/4742/ https://www.shuijingwanwq.com/2021/02/22/4742/#respond Mon, 22 Feb 2021 05:11:24 +0000 https://www.shuijingwanwq.com/?p=4742 Post Views: 79

1、在 GitLab 中,多个 Tag 的最后提交 ID 相同。如图1

在 GitLab 中,多个 Tag 的最后提交 ID 相同。

图1

2、在 Jenkins 中,设置构建的 Tag 名:pcs_api_1.13.5.0_base。如图2

在 Jenkins 中,设置构建的 Tag 名:pcs_api_1.13.5.0_base。

图2

3、但是,最后构建出的镜像名中包含的 Tag 名:pcs_api_1.13.5.0。不符合预期(与设置不相等)。如图3

但是,最后构建出的镜像名中包含的 Tag 名:pcs_api_1.13.5.0。不符合预期(与设置不相等)。

图3

4、在 Build History 列表中,Edit Build Information。如图4

在 Build History 列表中,Edit Build Information。

图4

5、编辑 DisplayName,如图5

编辑 DisplayName

图5

6、在 Build History 列表中,构建出的镜像名中包含的 Tag 名:pcs_api_1.13.5.0_base。符合预期。如图6

在 Build History 列表中,构建出的镜像名中包含的 Tag 名:pcs_api_1.13.5.0_base。符合预期。

图6

 

]]>
https://www.shuijingwanwq.com/2021/02/22/4742/feed/ 0
在 jenkins 中构建镜像时,报错:repository not found: does not exist or no pull access 的分析解决 https://www.shuijingwanwq.com/2020/08/07/4370/ https://www.shuijingwanwq.com/2020/08/07/4370/#respond Fri, 07 Aug 2020 06:22:27 +0000 https://www.shuijingwanwq.com/?p=4370 Post Views: 230 1、在 jenkins 中构建镜像时,报错:repository registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php72 not found: does not exist or no pull access。如图1
在 jenkins 中构建镜像时,报错:repository registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php72 not found: does not exist or no pull access。

图1



RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/cmcp-api && \
    composer install


2、调整配置项,Build – Execute shell – Command,用户名与密码的值需要修改。如图2
调整配置项,Build - Execute shell - Command,用户名与密码的值需要修改。

图2



#!/bin/bash
docker login --username= --password= registry-vpc.cn-beijing.aliyuncs.com


3、再次构建,构建成功。如图3
再次构建,构建成功。

图3

]]>
https://www.shuijingwanwq.com/2020/08/07/4370/feed/ 0
在 jenkins 中构建镜像时,报错:fatal Could not read from remote repository 的解决 https://www.shuijingwanwq.com/2020/08/03/4340/ https://www.shuijingwanwq.com/2020/08/03/4340/#respond Mon, 03 Aug 2020 06:00:44 +0000 https://www.shuijingwanwq.com/?p=4340 Post Views: 104 1、在 jenkins 中构建镜像时,报错:fatal: Could not read from remote repository.。虽然 Packagist 镜像地址已经切换为阿里云:https://mirrors.aliyun.com/composer/ 。查看 Dockerfile。如图1
在 jenkins 中构建镜像时,报错:fatal: Could not read from remote repository.。虽然 Packagist 镜像地址已经切换为阿里云:https://mirrors.aliyun.com/composer/ 。查看 Dockerfile。

图1



RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/cmcp-api && \
    composer install


2、最终决定将 /vendor 目录添加至 Git 仓库:# /vendor,编辑 .gitignore


# Env
/.env

# Composer
# /vendor
composer.phar

# JS
node_modules
spa/npm-debug.log
spa/yarn-error.log


# IDE
.idea
nbproject
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# Mac DS_Store Files
.DS_Store

# phpunit
phpunit.phar
/phpunit.xml

# Vagrant
/.vagrant

# Tests
tests/codeception/*/_support/_generated/*



3、编辑 Dockerfile,删除与 composer 相关的 4 行命令。构建成功。如图3
编辑 Dockerfile,删除与 composer 相关的 4 行命令。构建成功。

编辑 Dockerfile,删除与 composer 相关的 4 行命令。构建成功。



RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf


 ]]>
https://www.shuijingwanwq.com/2020/08/03/4340/feed/ 0
将 /vendor 加入至 Git 仓库后,Docker 部署,升级失败的分析解决 https://www.shuijingwanwq.com/2020/05/11/4130/ https://www.shuijingwanwq.com/2020/05/11/4130/#respond Mon, 11 May 2020 12:03:38 +0000 https://www.shuijingwanwq.com/?p=4130 Post Views: 223

1、编辑 .gitignore,将 /vendor 加入至 Git 仓库,如图1

编辑 .gitignore,将 /vendor 加入至 Git 仓库

图1


# composer vendor dir
# /vendor


2、在 Jenkins 中构建失败,查看 Console Output。如图2

在 Jenkins 中构建失败,查看 Console Output

图2


[0mThe command '/bin/sh -c chown -R nginx:nginx /mcloud/www/ &&     rm -rf /etc/nginx/conf.d/status.conf &&     chmod +x /usr/local/bin/composer &&     composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ &&     cd /mcloud/www/pcs-api &&     composer install' returned a non-zero code: 1
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE


3、Docker 部署,删除 composer install。编辑 Dockerfile。如图3

Docker 部署,删除 composer install。编辑 Dockerfile。

图3


RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/pcs-api && \
    composer install



RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf


4、在 Jenkins 中构建成功。如图4

在 Jenkins 中构建成功。

图4

5、在 Rancher 中启动失败,查看日志。如图5

在 Rancher 中启动失败,查看日志。

图5


2020/5/8 下午2:48:45
2020/5/8 下午2:48:45  ... initialization completed.
2020/5/8 下午2:48:45
2020/5/8 下午2:48:45 PCS_API_CFG_MIGRATE=true


6、编辑 build/c_files/config/init/console_init.sh。删除 $PCS_API_CFG_MIGRATE == “true” 的相关命令。如图6

编辑 build/c_files/config/init/console_init.sh。删除 $PCS_API_CFG_MIGRATE == "true" 的相关命令。

图6

7、在 Rancher 中启动成功,查看日志。如图7

在 Rancher 中启动成功,查看日志。

图7


2020/5/8 下午2:48:45
2020/5/8 下午2:48:45  ... initialization completed.
2020/5/8 下午2:48:45
2020/5/8 下午2:48:45 PCS_API_CFG_MIGRATE=true


8、进入容器,手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。未成功运行,因为无相应输出。如图8

进入容器,手动执行 $PCS_API_CFG_MIGRATE == "true" 的相关命令。未成功运行,因为无相应输出。

图8

9、进入将 /vendor 加入至 Git 仓库前的容器。手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。成功运行,因为有相应输出。如图9

进入将 /vendor 加入至 Git 仓库前的容器。手动执行 $PCS_API_CFG_MIGRATE == "true" 的相关命令。成功运行,因为有相应输出。

图9

10、在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。未成功运行,报错。如图10

在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == "true" 的相关命令。未成功运行,报错。

图10


PS E:\wwwroot\pcs-api-develop> ./yii migrate --migrationPath=@yii/log/migrations/ --interactive=0
PHP Warning:  require(E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/src/Codeception/function.php): fa
iled to open stream: No such file or directory in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php on line 6
6

Warning: require(E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/src/Codeception/function.php): failed
to open stream: No such file or directory in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php on line 66
PHP Fatal error:  require(): Failed opening required 'E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/s
rc/Codeception/function.php' (include_path='.;C:\php\pear') in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.
php on line 66

Fatal error: require(): Failed opening required 'E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/src/Co
deception/function.php' (include_path='.;C:\php\pear') in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php o
n line 66


11、文件 E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/src/Codeception/function.php 不存在,如图11

文件 E:\wwwroot\pcs-api-develop\vendor\composer/../codeception/verify/src/Codeception/function.php 不存在

图11

12、进入将 /vendor 加入至 Git 仓库前的容器。文件 \vendor\composer/../codeception/verify/src/Codeception/function.php 存在。如图12

进入将 /vendor 加入至 Git 仓库前的容器。文件 \vendor\composer/../codeception/verify/src/Codeception/function.php 存在。

图12

13、查看 E:\wwwroot\pcs-api\vendor\codeception\verify,其目录下存在相应的文件。且 Git 显示是已经提交至仓库。如图13

查看 E:\wwwroot\pcs-api\vendor\codeception\verify,其目录下存在相应的文件。且 Git 显示是已经提交至仓库。

图13

14、进入将 /vendor 加入至 Git 仓库前的本地环境。发现 \vendor\codeception\verify 已经存在于 Git 中。只不过是 master 分支。如图14

进入将 /vendor 加入至 Git 仓库前的本地环境。发现 \vendor\codeception\verify 已经存在于 Git 中。只不过是 master 分支。

图14

15、最终决定切换至 master 分支,合并 develop 分支的代码。再推送至远程的 master 分支。在远程仓库中文件:\vendor\composer/../codeception/verify/src/Codeception/function.php 仍然不存在。如图15

最终决定切换至 master 分支,合并 develop 分支的代码。再推送至远程的 master 分支。在远程仓库中文件:\vendor\composer/../codeception/verify/src/Codeception/function.php 仍然不存在。

图15

16、删除目录:E:\wwwroot\pcs-api\vendor\codeception\verify\.git,将未显示已经提交至仓库的文件,添加至仓库。如图16、17

删除目录:E:\wwwroot\pcs-api\vendor\codeception\verify\.git,将未显示已经提交至仓库的文件,添加至仓库。

图16

 

删除目录:E:\wwwroot\pcs-api\vendor\codeception\verify\.git,将未显示已经提交至仓库的文件,添加至仓库。

图17

17、在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。未成功运行,报错,但是 /codeception/verify 相应的错误已经得到解决。参考步骤 16 同样处理。后续在运行命令的过程中报错的类似问题,皆可以如此处理。


PS E:\wwwroot\pcs-api-develop> ./yii migrate --migrationPath=@yii/log/migrations/ --interactive=0
PHP Warning:  require(E:\wwwroot\pcs-api-develop\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): faile
d to open stream: No such file or directory in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php on line 66

Warning: require(E:\wwwroot\pcs-api-develop\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to
open stream: No such file or directory in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php on line 66
PHP Fatal error:  require(): Failed opening required 'E:\wwwroot\pcs-api-develop\vendor\composer/../myclabs/deep-copy/sr
c/DeepCopy/deep_copy.php' (include_path='.;C:\php\pear') in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php
 on line 66

Fatal error: require(): Failed opening required 'E:\wwwroot\pcs-api-develop\vendor\composer/../myclabs/deep-copy/src/Dee
pCopy/deep_copy.php' (include_path='.;C:\php\pear') in E:\wwwroot\pcs-api-develop\vendor\composer\autoload_real.php on l
ine 66


18、在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。成功运行。如图18

在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == "true" 的相关命令。成功运行。

图18

19、进入将 /vendor 加入至 Git 仓库前的本地环境。执行命令:composer install。成功运行。如图19

进入将 /vendor 加入至 Git 仓库前的本地环境。执行命令:composer install。成功运行。

图19


PS E:\wwwroot\pcs-api-feature-plan-tonglian> composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files


20、在本地环境中全新部署,执行命令:composer install。未成功运行。如图20

在本地环境中全新部署,执行命令:composer install。未成功运行。

图20


PS E:\wwwroot\pcs-api-develop> composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files


  [RuntimeException]
  Could not scan for classes inside "E:\wwwroot\pcs-api-develop\vendor/sebastian/object-enumerator/src/" which does n
  ot appear to be a file nor a folder


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--n
o-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative]
 [--apcu-autoloader] [--ignore-platform-reqs] [--] []...



21、实际上,第 16、17 步骤,可以通过执行命令:composer require codeception/verify myclabs/deep-copy 来解决,而无需一定要将这 2 个包提交至 Git 仓库中。不过,即使采用此方案,仍然会存在第 20 步骤中所存在的问题。而且还会改变 /vendor/composer 中的其他文件。此方案不太可取。如图21

实际上,第 16、17 步骤,可以通过执行命令:composer require codeception/verify myclabs/deep-copy 来解决,而无需一定要将这 2 个包提交至 Git 仓库中。不过,即使采用此方案,仍然会存在第 20 步骤中所存在的问题。而且还会改变 /vendor/composer 中的其他文件。此方案不太可取。

图21

22、最终决定,先删除掉 /vendor ,提交至 Git 仓库,执行命令:composer install –no-dev。–no-dev:跳过 require-dev 字段中列出的包。再将 /vendor 提交至 Git 仓库。因为,已经确定,–dev:安装 require-dev 字段中列出的包 ( 这是一个默认值 )。提交至 Git 仓库仅能够提交空目录。如图22

最终决定,先删除掉 /vendor ,提交至 Git 仓库,执行命令:composer install --no-dev。--no-dev:跳过 require-dev 字段中列出的包。再将 /vendor 提交至 Git 仓库。因为,已经确定,--dev:安装 require-dev 字段中列出的包 ( 这是一个默认值 )。提交至 Git 仓库仅能够提交空目录。

图22

23、执行命令:composer install。安装 require-dev 字段中列出的包。再将 /vendor 提交至 Git 仓库。如图23

执行命令:composer install。安装 require-dev 字段中列出的包。再将 /vendor 提交至 Git 仓库。

图23

24、在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == “true” 的相关命令。成功运行。不符合预期。如图24

在本地环境中全新部署,手动执行 $PCS_API_CFG_MIGRATE == "true" 的相关命令。成功运行。不符合预期。

图24

25、查看全新部署的文件,目录:\codeception\verify、\vendor\myclabs\deep-copy 皆存在。如图25

查看全新部署的文件,目录:\codeception\verify、\vendor\myclabs\deep-copy 皆存在。

图25

26、在 /vendor 目录中搜索:.git,不存在相应的目录。而之前执行命令:composer install。未成功运行。在 /vendor 目录中搜索:.git,存在相应的目录。如图26

在 /vendor 目录中搜索:.git,不存在相应的目录。而之前执行命令:composer install。未成功运行。在 /vendor 目录中搜索:.git,存在相应的目录。

图26

27、编辑 build/c_files/config/init/console_init.sh。恢复 $PCS_API_CFG_MIGRATE == “true” 的相关命令。在 Rancher 中启动成功,查看日志。如图27

编辑 build/c_files/config/init/console_init.sh。恢复 $PCS_API_CFG_MIGRATE == "true" 的相关命令。在 Rancher 中启动成功,查看日志。

图27

28、在另一个产品中,在 /vendor 目录中搜索:.git,存在相应的目录。如图28

在另一个产品中,在 /vendor 目录中搜索:.git,存在相应的目录。

图28

29、在 Rancher 中启动失败,查看日志。如图29

在 Rancher 中启动失败,查看日志。

图29


2020/5/9 下午7:01:07 PHP Fatal Error 'yii\base\ErrorException' with message 'Class 'wartron\yii2uuid\behaviors\UUIDBehavior' not found'
2020/5/9 下午7:01:07
2020/5/9 下午7:01:07 in /mcloud/www/channel-pub-api/common/behaviors/UUIDBehavior.php:7
2020/5/9 下午7:01:07
2020/5/9 下午7:01:07 Stack trace:
2020/5/9 下午7:01:07 #0 [internal function]: yii\base\ErrorHandler->handleFatalError()
2020/5/9 下午7:01:07 #1 {main}


30、由于仅有一个目录:.git,决定采用第 16、17 步骤的方案。在 Rancher 中启动成功,查看日志。如图30

由于仅有一个目录:.git,决定采用第 16、17 步骤的方案。在 Rancher 中启动成功,查看日志。

图30

31、在 Jenkins 中构建时间的前后对比,分别为:13分钟、43秒。如图31

在 Jenkins 中构建时间的前后对比,分别为:13分钟、43秒。

图31

]]>
https://www.shuijingwanwq.com/2020/05/11/4130/feed/ 0
在 Jenkins 中报错:Failed to connect to repository Command git ls-remote -h https gitlab.chinamcloud.compcspcs_api.git HEAD returned status code 128 的分析解决 https://www.shuijingwanwq.com/2020/04/10/4097/ https://www.shuijingwanwq.com/2020/04/10/4097/#respond Fri, 10 Apr 2020 02:40:24 +0000 https://www.shuijingwanwq.com/?p=4097 Post Views: 267 1、参考网址:https://www.shuijingwanwq.com/2020/04/09/4084/ ,在 GitLab 中调整项目的所属组及其名称。 2、在 Jenkins 中配置后,报错:repository ‘https://gitlab.chinamcloud.com/pcs/pcs_api.git/’ not found,如图1
在 Jenkins 中配置后,报错:repository 'https://gitlab.chinamcloud.com/pcs/pcs_api.git/' not found

图1



Failed to connect to repository : Command "git ls-remote -h https://gitlab.chinamcloud.com/pcs/pcs_api.git HEAD" returned status code 128:
stdout:
stderr: fatal: repository 'https://gitlab.chinamcloud.com/pcs/pcs_api.git/' not found


3、分析组 php 下的用户列表,存在用户:JenkinsIntegration,如图2
分析组 php 下的用户列表,存在用户:JenkinsIntegration

图2

4、在组 pcs 下的用户列表,添加用户:JenkinsIntegration,身份为:Guest,如图3
在组 pcs 下的用户列表,添加用户:JenkinsIntegration,身份为:Guest

图3

5、在 Jenkins 中配置后,报错:unable to access ‘https://gitlab.chinamcloud.com/pcs/pcs_api.git/’: The requested URL returned error: 403


Failed to connect to repository : Command "git ls-remote -h https://gitlab.chinamcloud.com/pcs/pcs_api.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://gitlab.chinamcloud.com/pcs/pcs_api.git/': The requested URL returned error: 403


6、在组 pcs 下的用户列表,修改用户:JenkinsIntegration,身份为:Developer,如图4
在组 pcs 下的用户列表,修改用户:JenkinsIntegration,身份为:Developer

图4

7、在 Jenkins 中配置后,未再报错,但是仍然构建失败。如图5
在 Jenkins 中配置后,未再报错,但是仍然构建失败。

图5

8、联系运维在 Registry 上新建 pcs_api 后,构建成功。如图6
联系运维在 Registry 上新建 pcs_api 后,构建成功。

图6

]]>
https://www.shuijingwanwq.com/2020/04/10/4097/feed/ 0
Docker 部署,将目录 sobey 修改为 mcloud,构建镜像时,报错:composer install returned a non-zero code: 255 的分析解决 https://www.shuijingwanwq.com/2019/07/23/3368/ https://www.shuijingwanwq.com/2019/07/23/3368/#respond Tue, 23 Jul 2019 09:42:15 +0000 http://www.shuijingwanwq.com/?p=3368 Post Views: 139 1、Docker 部署,在 Jenkins 上构建镜像时,报错:composer install returned a non-zero code: 255,如图1
Docker 部署,在 Jenkins 上构建镜像时,报错:composer install returned a non-zero code: 255

图1



Step 7 : RUN chown -R nginx:nginx /mcloud/www/ &&     rm -rf /etc/nginx/conf.d/status.conf &&     composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ &&     cd /mcloud/www/pcs-api &&     composer install
 ---> Running in a73905f2bdbc
Do not run Composer as root/super user! See https://getcomposer.org/root for details
The command '/bin/sh -c chown -R nginx:nginx /mcloud/www/ &&     rm -rf /etc/nginx/conf.d/status.conf &&     composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ &&     cd /mcloud/www/pcs-api &&     composer install' returned a non-zero code: 255
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE


2、Dockerfile 执行命令失败的代码如下


FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php72:0.1.12

MAINTAINER wangqiang@chinamcloud.com

RUN sed -i 's/open_basedir = .\/:\/mcloud:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/mcloud:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
    sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini

COPY code /mcloud/www/pcs-api
COPY code/build/c_files/ /

RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/pcs-api && \
    composer install


3、编辑 Dockerfile,构建成功,可见失败的原因在于:composer install


RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/pcs-api


4、编辑 Dockerfile,查看 composer 的版本信息与全局配置选项的列表


RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/pcs-api && \
    composer --version && \
    composer config --global --list


5、在 Jenkins 上构建镜像时,仍然报错:composer install returned a non-zero code: 255,可见,composer 相关的命令是执行不了的,不仅是 composer install,如图2
在 Jenkins 上构建镜像时,仍然报错:composer install returned a non-zero code: 255,可见,composer 相关的命令是执行不了的,不仅是 composer install

图2

6、编辑 Dockerfile,下载 Composer 的可执行文件,局部安装


RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    cd /mcloud/www/pcs-api && \
    curl -sS https://getcomposer.org/installer | php && \
    php composer.phar install


7、在 Jenkins 上构建镜像时,报错:php composer.phar install returned a non-zero code: 1,如图3
在 Jenkins 上构建镜像时,报错:php composer.phar install returned a non-zero code: 1

图3



RUN chown -R nginx:nginx /mcloud/www/ &&     rm -rf /etc/nginx/conf.d/status.conf &&     cd /mcloud/www/pcs-api &&     curl -sS https://getcomposer.org/installer | php &&     php composer.phar install
 ---> Running in 28a2ad979c18
All settings correct for using Composer

Warning: is_dir(): open_basedir restriction in effect. File(/root/.composer) is not within the allowed path(s): (./:/sobey:/tmp:/data:/webtv:/var/log:/mcloud) in Standard input code on line 495

Warning: is_dir(): open_basedir restriction in effect. File(/root/.composer) is not within the allowed path(s): (./:/sobey:/tmp:/data:/webtv:/var/log:/mcloud) in Standard input code on line 685
Unable to create Composer home directory "/root/.composer": mkdir(): open_basedir restriction in effect. File(/root/.composer) is not within the allowed path(s): (./:/sobey:/tmp:/data:/webtv:/var/log:/mcloud)
The command '/bin/sh -c chown -R nginx:nginx /mcloud/www/ &&     rm -rf /etc/nginx/conf.d/status.conf &&     cd /mcloud/www/pcs-api &&     curl -sS https://getcomposer.org/installer | php &&     php composer.phar install' returned a non-zero code: 1
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE


8、醒悟过来,原因在于 Dockerfile 文件,之前执行了批量替换,将 sobey 批量替换为 mcloud,决定仅替换其中的 3 处,其余 2 处的 mcloud 还原为 sobey,如图4
醒悟过来,原因在于 Dockerfile 文件,之前执行了批量替换,将 sobey 批量替换为 mcloud,决定仅替换其中的 3 处,其余 2 处的 mcloud 还原为 sobey

图4



FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php72:0.1.12

MAINTAINER wangqiang@chinamcloud.com

RUN sed -i 's/open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
    sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini

COPY code /mcloud/www/pcs-api
COPY code/build/c_files/ /

RUN chown -R nginx:nginx /mcloud/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    cd /mcloud/www/pcs-api && \
    composer install


9、Docker 部署,在 Jenkins 上构建镜像成功,后续有待于基础镜像升级之后,才能够全部执行替换了的。如图5
Docker 部署,在 Jenkins 上构建镜像成功,后续有待于基础镜像升级之后,才能够全部执行替换了的。

图5

]]>
https://www.shuijingwanwq.com/2019/07/23/3368/feed/ 0
Jenkins 构建镜像时,报错:The Process class relies on proc_open, which is not available on your PHP installation.的解决 https://www.shuijingwanwq.com/2018/07/17/2796/ https://www.shuijingwanwq.com/2018/07/17/2796/#comments Tue, 17 Jul 2018 07:27:30 +0000 http://www.shuijingwanwq.com/?p=2796 Post Views: 301 1、由于无法从 dist 下载 yiisoft/yii2-composer (2.0.7),现在尝试从源代码下载,Process 类依赖于 proc_open ,这在PHP安装中不可用,如图1
由于无法从 dist 下载 yiisoft/yii2-composer (2.0.7),现在尝试从源代码下载,Process 类依赖于 proc_open ,这在PHP安装中不可用

图1

2、编辑 Dockerfile,在 disable_functions 中删除 proc_open、proc_close


FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4

MAINTAINER wjtester@sobey.com

RUN sed -i 's/open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
    sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,passthru,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini

COPY code /sobey/www/pcs-api
COPY code/build/c_files/ /

RUN chown -R nginx:nginx /sobey/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    cd /sobey/www/pcs-api && \
    composer install


3、之前 proc_open、proc_close 也是禁用的,可以正常构建,原因在于可以从 dist 正常下载 yiisoft/yii2-composer (2.0.6),因此,不会从源代码下载,也就不会使用到 proc_open、proc_close,如图2
之前 proc_open、proc_close 也是禁用的,可以正常构建,原因在于可以从 dist 正常下载 yiisoft/yii2-composer (2.0.6),因此,不会从源代码下载,也就不会使用到 proc_open、proc_close

图2

4、重新构建镜像,从源代码下载成功,构建成功,如图3
重新构建镜像,从源代码下载成功,构建成功

图3

]]>
https://www.shuijingwanwq.com/2018/07/17/2796/feed/ 2