fix: install script exec 3 #186
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: Build Jenkins AMI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
buildAmi: | |
if: github.repository == 'RamaRaju-personal-org/ami-jenkins' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup `packer` | |
uses: hashicorp/setup-packer@main | |
id: setup | |
with: | |
version: "latest" | |
- name: Packer format | |
id: fmt | |
run: "packer fmt ." | |
- name: Packer init | |
id: init | |
run: "packer init ." | |
- name: Validate Packer template | |
run: packer validate . | |
- name: Prepare JCasC file to change user credientials | |
run: | | |
sed -i "s|ADMIN_USER|${{ secrets.JENKINS_ADMIN_USER }}|g" jenkins/jenkins.yaml | |
sed -i "s|ADMIN_PASSWORD|${{ secrets.JENKINS_ADMIN_PASSWORD }}|g" jenkins/jenkins.yaml | |
sed -i "s|docker_hub_username|${{ secrets.docker_hub_username }}|g" jenkins/jenkins.yaml | |
sed -i "s|docker_hub_password|${{ secrets.docker_hub_password }}|g" jenkins/jenkins.yaml | |
sed -i "s|jenkins_ami_git_url|${{ secrets.GIT_JENKINS_AMI_REPO_URL }}|g" jenkins/build-docker-image.groovy | |
sed -i "s|git_username|${{ secrets.git_username }}|g" jenkins/jenkins.yaml | |
sed -i "s|GITHUB_TOKEN|${{ secrets.GIT_TOKEN }}|g" jenkins/jenkins.yaml | |
sed -i "s|your_certificate_authority_data|${{ secrets.YOUR_CERTIFICATE_AUTHORITY_DATA }}|g" K8s_config/config.yaml | |
sed -i "s|aws_api_server|${{ secrets.AWS_API_SERVER }}|g" K8s_config/config.yaml | |
shell: bash | |
- name: Build AMI | |
run: | | |
pwd | |
ls -al | |
packer build . |