forked from joseph/gitea_CICD
update env source
This commit is contained in:
parent
2892a9f0b6
commit
971929ac29
|
|
@ -37,13 +37,11 @@ Copy environment file
|
||||||
|
|
||||||
### 5) Fill in environment variables (\*)
|
### 5) Fill in environment variables (\*)
|
||||||
|
|
||||||
- Git username:
|
|
||||||
<div><img src="https://i.ibb.co/pLR2BjH/image.png" alt="getUsername" width="300"></div>
|
|
||||||
|
|
||||||
root@root#
|
root@root#
|
||||||
```sh
|
```sh
|
||||||
nano service_run/giteaService.conf
|
nano service_run/giteaService.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6) Add Nginx configuration
|
### 6) Add Nginx configuration
|
||||||
- Open the Nginx configuration file.
|
- Open the Nginx configuration file.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,30 @@ if [ -d "/etc/systemd/system" ]; then
|
||||||
find $pwd_install/service -type f -not -name "giteaService.conf" -exec cp {} $pwd_install/service_run \;
|
find $pwd_install/service -type f -not -name "giteaService.conf" -exec cp {} $pwd_install/service_run \;
|
||||||
|
|
||||||
sleep 2 &&
|
sleep 2 &&
|
||||||
|
|
||||||
sudo sed -i "s#ExecStart=.*#ExecStart=$escaped_pwd_install/service_run/giteaService.sh#" $pwd_install/service_run/giteaHook.service &&
|
sudo sed -i "s#ExecStart=.*#ExecStart=$escaped_pwd_install/service_run/giteaService.sh#" $pwd_install/service_run/giteaHook.service &&
|
||||||
echo -e "* \e[32mExecStart\e[0m *" &&
|
echo -e "* \e[32mExecStart\e[0m *" &&
|
||||||
sleep 1 &&
|
sleep 1 &&
|
||||||
|
|
||||||
sudo sed -i "s#WorkingDirectory=.*#WorkingDirectory=$escaped_pwd_install/service_run#" $pwd_install/service_run/giteaHook.service &&
|
sudo sed -i "s#WorkingDirectory=.*#WorkingDirectory=$escaped_pwd_install/service_run#" $pwd_install/service_run/giteaHook.service &&
|
||||||
echo -e "* \e[32mWorkingDirectory\e[0m *" &&
|
echo -e "* \e[32mWorkingDirectory\e[0m *" &&
|
||||||
sleep 1 &&
|
sleep 1 &&
|
||||||
|
|
||||||
sudo sed -i "s#EnvironmentFile=.*#EnvironmentFile=$escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.service &&
|
sudo sed -i "s#EnvironmentFile=.*#EnvironmentFile=$escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.service &&
|
||||||
echo -e "* \e[32mEnvironmentFile\e[0m *" &&
|
echo -e "* \e[32mEnvironmentFile\e[0m *" &&
|
||||||
sleep 1 &&
|
sleep 1 &&
|
||||||
|
|
||||||
sudo sed -i "s#HOOK_PATH=.*#HOOK_PATH=$escaped_pwd_install#" $pwd_install/service_run/giteaService.conf &&
|
sudo sed -i "s#HOOK_PATH=.*#HOOK_PATH=$escaped_pwd_install#" $pwd_install/service_run/giteaService.conf &&
|
||||||
echo -e "* \e[32mHOOK_PATH\e[0m *" &&
|
echo -e "* \e[32mHOOK_PATH\e[0m *" &&
|
||||||
sleep 1 &&
|
sleep 1 &&
|
||||||
|
|
||||||
sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.sh &&
|
sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.sh &&
|
||||||
echo -e "* \e[32mEXEC_FILE\e[0m *" &&
|
echo -e "* \e[32mEXEC_FILE\e[0m *" &&
|
||||||
echo ""
|
echo ""
|
||||||
sleep 1 &&
|
sleep 1 &&
|
||||||
|
|
||||||
|
sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaService.sh &&
|
||||||
|
|
||||||
systemctl stop giteaHook.service
|
systemctl stop giteaHook.service
|
||||||
|
|
||||||
input_file="$pwd_install/service_run/giteaService.conf" &&
|
input_file="$pwd_install/service_run/giteaService.conf" &&
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
source /home/phuc/gitea_CICD/service_run/giteaService.conf
|
||||||
# Đường dẫn tới tệp index.js
|
# Đường dẫn tới tệp index.js
|
||||||
indexjs_path=$HOOK_PATH/index.js
|
indexjs_path=$HOOK_PATH/index.js
|
||||||
project_path=$HOOK_PATH
|
project_path=$HOOK_PATH
|
||||||
USERNAME=$(echo "$GIT_USERNAME" | sed 's/@/%40/g')
|
|
||||||
PASSWORD=$(echo "$GIT_PASSWORD" | sed 's/@/%40/g')
|
USERNAME=$(echo "$GIT_USERNAME" | sed 's/@/%40/g')
|
||||||
|
PASSWORD=$(echo "$GIT_PASSWORD" | sed 's/@/%40/g')
|
||||||
|
|
||||||
REPOSITORY_AUTH="https://$USERNAME:$PASSWORD@$(echo $GIT_REPOSITORY | sed 's#https://##')"
|
REPOSITORY_AUTH="https://$USERNAME:$PASSWORD@$(echo $GIT_REPOSITORY | sed 's#https://##')"
|
||||||
|
|
||||||
cd "$PROJECT_PATH" &&
|
cd "$PROJECT_PATH" &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue