devstream-io / devstream

DevStream: the open-source DevOps toolchain manager (DTM).
https://www.devstream.io
Apache License 2.0
857 stars 193 forks source link

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

Closed aFlyBird0 closed 2 years ago

aFlyBird0 commented 2 years ago

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.

QinZhanlong commented 2 years ago

I accept this assignment and assign it to me @aFlyBird0

aFlyBird0 commented 2 years ago

Enjoy coding! 👏 @QinZhanlong

QinZhanlong commented 2 years ago

@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 不在一个主机上,不能一键创建完成

aFlyBird0 commented 2 years ago

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: