I’ve followed the [docs](<https://www.pulumi.com/d...
# general
c
I’ve followed the [docs](https://www.pulumi.com/docs/guides/continuous-delivery/gitlab-ci/) for a GitLab pipeline and
pulumi
is not found. Yes, I’m updating my path:
Copy code
=== Pulumi is now installed! 🍹 ===
+ Please add /root/.pulumi/bin to your $PATH
+ Get started with Pulumi: <https://www.pulumi.com/docs/quickstart>
$ export PATH=$PATH:$HOME/.pulumi/bin
$ which pulumi
/root/.pulumi/bin/pulumi
$ cd pulumi
$ pulumi login
/bin/sh: eval: line 96: pulumi: not found
m
try running it from
Copy code
/root/.pulumi/bin/pulumi
c
Why should I need to? It’s in my $PATH and
which
finds it fine.
m
I'm not sure why you need to. just trying to help man
👍 1
c
Thanks. I’ve been beating up my pipeline trying to get it to work. Pardon my frustration.
m
it might be because you're using /bin/sh instead of bash
Copy code
#!/bin/bash

# exit if a command returns a non-zero exit code and also print the commands and their args as they are executed
set -e -x
# Download and install required tools.
# pulumi
curl -fsSL <https://get.pulumi.com/> | bash
export PATH=$PATH:$HOME/.pulumi/bin
# Login into pulumi. This will require the PULUMI_ACCESS_TOKEN environment variable
pulumi login
# update the GitLab Runner's packages
apt-get update -y
apt-get install sudo -y
# nodejs
curl -sL <https://deb.nodesource.com/setup_8.x> | sudo -E bash -
apt-get install -y nodejs
# yarn
npm i -g yarn
c
Yeah, maybe.
Copy code
$ $(which pulumi) login
/bin/sh: eval: line 96: /root/.pulumi/bin/pulumi: not found
m
I would just reference the file directly if it is running in a script. as a bonus it is potentially more secure that way
I'm not a pulumi dev but I doubt this is something wrong with pulumi itself. more of a linux issue
it looks like pulumi was installed with a root account but your shell prompt decorator is
$
? It seems weird. usually shell prompt decorator for root user is
#
c
I agree that it’s likely a linux issue. However, I’m following the documentation. Here’s my pipeline stage:
Copy code
install:
  stage: build
  script:
    - apk update && apk upgrade
    - apk add --update --no-cache curl nodejs bash
    - curl -fsSL <https://get.pulumi.com> | bash
    - export PATH=$PATH:$HOME/.pulumi/bin
    - cd pulumi
    - pulumi login
    - npm i
pulumi
is still not found.
New wrinkle: It’s
sh/bash
related. I’ve switched to bash, but have a new error:
Copy code
=== Pulumi is now installed! 🍹 ===
+ Please add /root/.pulumi/bin to your $PATH
+ Get started with Pulumi: <https://www.pulumi.com/docs/quickstart>

+ cd pulumi
+ pulumi login
scripts/setup.sh: line 12: /root/.pulumi/bin/pulumi: No such file or directory
@white-balloon-205 suggestions?
w
Honestly not sure. Doesn't seem to be a
pulumi
issue - seems to be something odd about the environment you are running in? If
which pulumi
is returning the correct thing, I have no idea why your shell would fail to exec
pulumi
. Can you reproduce this outside of GitLab CI?
c
No, everything runs fine “on my box”. I’ve tried both the default image with the runner as well as the
node:dubnium-alpine3.10
image (to avoid trying to install node). I’m not suggesting that it’s a
pulumi
issue, but it is an issue with the documentation, which I’ve been following.
m
It looks like maybe you can't run the file because it is owned by root and the file permissions are not allowing you to see it 🤔
c
That might be the case, but it’s running as the same user as the curl command. It is interesting that it would be running at
root
, but that appears to be the default. So, if
root
installs it, shouldn’t
root
be able to run it?
@white-balloon-205 at this point, with still no success, I’m wanting to see the docs link to a fully functional pipeline in GitLab.
w
Here's one reference to a fully-functional GitLab pipeline using Pulumi (I know many folks have built these - this is one that was used in a demo at KubeCon last year - see https://about.gitlab.com/blog/2020/01/27/kubecon-na-2019-are-you-about-to-break-prod/): •
.gitlab-ci.yml
: https://gitlab.com/rocore/demo-app/-/blob/master/.gitlab-ci.yml
Dockerfile
: https://gitlab.com/rocore/global-infra/-/blob/master/base-image/Dockerfile
Also opened https://github.com/pulumi/docs/issues/2371 to look into the docs themselves.
c
@clever-egg-2543 can you please DM me your
.gitlab-ci.yml
file?
Also, here’s a sample project that uses the same setup as what is in the doc: https://github.com/praneetloke/pulumi-simple-website/. This repo has sample configuration for quite a few CI systems. EDIT: The thing to note in the aforementioned repo is, I have commented out the line that runs
run-pulumi.sh
for merge builds, because it is a demo project.
c
@white-balloon-205 I found that kubecon article and looked at the repo/pipeline. It’s go-specific, but it was helpful. I finally have a functional pipeline, but I’m using the
pulumi/pulumi
image specifically in the stages that require it. This causes me to rebuilt the
npm
dependencies as the node version in the pulumi image is different from my target version. While it’s a bit of a hack to re-install the dependencies for each stage, the pipeline is now functional and each stage passes, so far.
🙂 1
c
@clever-egg-2543 glad that you got it working. Sorry that the experience of setting up the pipeline wasn’t great. Could you please DM me the pipeline configuration that you originally used, which didn’t work? I’d like to see what we can add to our docs to help future users.