目标:试图通过循环管道获取机器的公共ip
我使用的代码:
version: 2.1
orbs:
jq: circleci/jq@2.2.0
executors:
my-executor-terraform:
docker:
- image: docker.mirror.hashicorp.services/hashicorp/terraform:light
working_directory: /home/circleci/workingfile
jobs:
findpublicip:
executor: my-executor-terraform
steps:
- checkout
- run:
name: get ip to add to azure storage account
command: |
apt-get install -y sudo
sudo apt-get install curl
ip=$(curl ifconfig.me)
echo $ip
workflows:
example-workflow:
jobs:
- findpublicip我得到的错误:
#!/bin/sh -eo pipefail
apt-get install -y sudo
sudo apt-get install curl
ip=$(curl ifconfig.me)
echo $ip
/bin/sh: apt-get: not found
Exited with code exit status 127
CircleCI received exit code 127循环使用的VM:
Build-agent version 1.0.133815-bc3df9c1 (2022-07-26T23:08:57+0000)
System information:
Server Version: 20.10.16
Storage Driver: overlay2
Backing Filesystem: xfs
Cgroup Driver: cgroupfs
Cgroup Version: 1
Kernel Version: 5.13.0-1023-aws
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
Starting container docker.mirror.hashicorp.services/hashicorp/terraform:light
image is cached as docker.mirror.hashicorp.services/hashicorp/terraform:light, but refreshing...
light: Pulling from hashicorp/terraform
Digest: sha256:7cb0feb2b2c9839830a5be18f266d417bc4619f9eade9a326b019a0886c60a01
Status: Image is up to date for docker.mirror.hashicorp.services/hashicorp/terraform:light
docker.mirror.hashicorp.services/hashicorp/terraform:light:
using image hashicorp/terraform@sha256:7cb0feb2b2c9839830a5be18f266d417bc4619f9eade9a326b019a0886c60a01
pull stats: Image was already available so the image was not pulled
time to create container: 627ms你能帮我找到失踪的地方吗?Circleci使用基于ubuntu的vm来执行工作流。我试着用apt-get安装,但是它说它找不到apt-get
发布于 2022-07-28 10:57:37
解决方案是使用apk add curl而不是apt or apg-get,因为runner vm是基于高寒码头映像的。希望这有助于其他面临类似问题的人确保您使用的是哪种类型的linux风格。
https://stackoverflow.com/questions/73140408
复制相似问题