devstream icon indicating copy to clipboard operation
devstream copied to clipboard

:open_book: `Docs`: Enhance `shell` scripts in Jenkins plugin

Open aFlyBird0 opened this issue 3 years ago • 4 comments

What should be changed?

Now we already have a plugin named jenkins to install Jenkins in an existing K8s cluster.

Doc is here: https://docs.devstream.io/en/latest/plugins/jenkins/ .

The following is part of the plugin documentation:

image

As we can see, the shell script here is not perfect, because the user needs to manually copy the result of the first step cd ~ && echo pwd (dtm home directory), and then manually paste and splice the subsequent commands.

Why don't we just wrap the result of cd ~ && echo pwd into a shell variable and let the user copy and run it with one click?

Here's the hard part: cd ~ && echo pwd and mkdir.... commands do not run on the same machine, one is the local machine and the other is the docker container.You have to run cd ~ && echo pwd on the local machine and then pass the result into the docker container, not cd directly inside the docker container.

Anything else

The source code of the doc is here:

English: https://github.com/devstream-io/devstream/blob/main/docs/plugins/jenkins.md Chinese: https://github.com/devstream-io/devstream/blob/main/docs/plugins/jenkins.zh.md

Please read the documents below.

  • [X] I've read the documents above. (If you want to submit a document type contribution.)

aFlyBird0 avatar Aug 03 '22 17:08 aFlyBird0

I accept this assignment and assign it to me @aFlyBird0

QinZhanlong avatar Aug 20 '22 07:08 QinZhanlong

Enjoy coding! 👏 @QinZhanlong

aFlyBird0 avatar Aug 20 '22 08:08 aFlyBird0

@aFlyBird0 Sorry, wrong operation, reassign the next task,I think:

1 在 dtm 运行的主机的执行下面shell,获取创建目录的路径和需要设置的权限

homeDir=${cd ~ && pwd -P} echo -e "\nsudo mkdir -p $homeDir/data/jenkins-volume/\nsudo chown -R 1000:1000 $homeDir/data/jenkins-volume/"

2 进入运行着 k8s 的主机

2.1 如果你是 minikube

minikube ssh

2.2 如果你是 kind

docker exec -it bash

3 复制1的输出,在 k8s 运行的主机上执行

因为dtm与k8s 不在一个主机上,不能一键创建完成

QinZhanlong avatar Aug 21 '22 02:08 QinZhanlong

Thank you for your contribution! It's true that it's hard to do it in one click without being on the same host. 👏

So doing the command splicing on the console and then letting the user copy it with one click is considered the best way to go.

One thing I should note is that I got an error when copying the first command line.

I guess the first line should be

homeDir=`cd ~ && pwd -P`

Also, I am very sorry that Daniel Hu mentioned creative PR #1021 this morning. we don't need to create this folder anymore.

@QinZhanlong thanks for your contribution! Please join CNCF's Slack, and join our channel in CNCF Slack! Here are a few useful things for you to continue your open-source journey:

aFlyBird0 avatar Aug 22 '22 02:08 aFlyBird0