Skip to content

Commit

Permalink
Updated pipeline configs and playbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
lolli001 committed Jul 18, 2024
1 parent cb98058 commit 7ce4f44
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 60 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/sync-to-codecommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ name: Sync to CodeCommit
on:
push:
branches:
- master
- main

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Configure Git for CodeCommit
run: |
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1

- name: Sync to CodeCommit - Goss Testing
run: |
git remote add goss-upstream ssh://git-codecommit.us-gov-west-1.amazonaws.com/v1/repos/image-pipeline-goss-testing
git push goss-upstream master --force
- name: Sync to CodeCommit Goss Testing
run: |
git remote add goss-upstream ssh://git-codecommit.us-gov-west-1.amazonaws.com/v1/repos/image-pipeline-goss-testing
git push goss-upstream main --force
- name: Sync to CodeCommit - Ansible Playbooks
run: |
git remote add ansible-upstream ssh://git-codecommit.us-gov-west-1.amazonaws.com/v1/repos/image-pipeline-ansible-playbooks
git push ansible-upstream master --force
- name: Sync to CodeCommit Ansible Playbooks
run: |
git remote add ansible-upstream ssh://git-codecommit.us-gov-west-1.amazonaws.com/v1/repos/image-pipeline-ansible-playbooks
git push ansible-upstream main --force
43 changes: 23 additions & 20 deletions ansible/rhel-arm-baseline.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
---
- name: RHEL ARM Baseline Configuration
hosts: all
become: true
tasks:
- name: Ensure latest packages are installed
yum:
name: '*'
state: latest
- name: Install required packages
yum:
name:
- vim
- git
- curl
state: present
- name: Create a user
user:
name: exampleuser
state: present
groups: wheel
name: RHEL ARM Baseline
hosts: all
become: true

tasks:
- name: Ensure latest packages are installed
yum:
name: '*'
state: latest

- name: Install required packages
yum:
name:
- vim
- git
- curl
state: present

- name: Create example user
user:
name: exampleuser
state: present
groups: wheel
31 changes: 6 additions & 25 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,14 @@ phases:
runtime-versions:
python: 3.11
commands:
- echo "Installing Python version 3.11 ..."
- pyenv global $PYTHON_311_VERSION
- echo "Installing Ansible and Packer ..."
- pip install ansible
- curl -s -qL -o packer.zip https://releases.hashicorp.com/packer/1.10.3/packer_1.10.3_linux_amd64.zip
- unzip -o packer.zip
- mv packer /bin
pre_build:
commands:
- echo "Configuring AWS credentials"
- aws configure set region $AWS_REGION
- aws configure set aws_access_key_id `jq -r '.AccessKeyId' aws_credentials.json`
- aws configure set aws_secret_access_key `jq -r '.SecretAccessKey' aws_credentials.json`
- aws configure set aws_session_token `jq -r '.Token' aws_credentials.json`
- echo "Installing dependencies..."
- pip install ansible boto3

build:
commands:
- echo "Building HashiCorp Packer template, build.pkr.hcl"
- cd ${CODEBUILD_SRC_DIR}/${CODE_SRC_DIR}
- /bin/packer init build.pkr.hcl
- ln -s ${CODEBUILD_SRC_DIR_SourceAnsibleOutput}/roles
- /bin/packer build -var project_name=rhel-arm-image-pipeline-demo -var ansible_dir=${CODEBUILD_SRC_DIR_SourceAnsibleOutput} build.pkr.hcl
post_build:
commands:
- echo "Build completed"
- cd ${CODEBUILD_SRC_DIR}/${CODE_SRC_DIR}
- test -s ami_id.txt || exit 1
- echo "Running Packer build..."
- packer build -var project_name=rhel-arm-image-pipeline-demo -var ansible_dir=${CODEBUILD_SRC_DIR_SourceAnsibleOutput} build.pkr.hcl

artifacts:
files:
- '**/*'
- '**/*'

0 comments on commit 7ce4f44

Please sign in to comment.