test one more #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Jenkins Deployment | |
# on: | |
# workflow_run: | |
# workflows: [Terraform Deployment] | |
# types: | |
# - completed | |
# Uncomment it for debug purposes | |
on: | |
push: | |
branches: | |
- task_xxx # Replace with your branch name to test GitHub Actions without pushing to the dev branch | |
- task_4 | |
- dev | |
jobs: | |
deploy-jenkins: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup SOCKS5 Proxy | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
BASTION_HOST: ${{ vars.BASTION_HOST }} | |
K3S_SERVER_HOST: ${{ vars.K3S_SERVER_HOST }} | |
BASTION_USER: ${{ vars.BASTION_USER }} | |
EC2_USER: ${{ vars.EC2_USER }} | |
run: | | |
# Start SSH agent and add the SSH key | |
eval "$(ssh-agent -s)" | |
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - | |
ssh -D 1080 -N -q -o StrictHostKeyChecking=no "$BASTION_USER@$BASTION_HOST" & | |
- name: Deploy Jenkins | |
env: | |
KUBECONFIG: /tmp/k3s.yml | |
run: | | |
echo "${{ vars.K3S_CONFIG }}" >> $KUBECONFIG | |
chmod 600 "$KUBECONFIG" | |
kubectl get namespace jenkins || kubectl create namespace jenkins | |
kubectl apply -f jenkins-volume.yaml | |
kubectl apply -f jenkins-sa.yaml | |
helm repo add jenkins https://charts.jenkins.io | |
helm repo update | |
helm upgrade --install jenkins -n jenkins -f jenkins-values.yaml jenkins/jenkins | |
PASSWORD=$(kubectl exec --namespace jenkins -it svc/jenkins -- /bin/cat /run/secrets/additional/chart-admin-password) | |
echo "Jenkins admin password is: $PASSWORD" |