diff --git a/.github/workflows/sync-to-codecommit.yml b/.github/workflows/sync-to-codecommit.yml index cfcd699..68512ce 100644 --- a/.github/workflows/sync-to-codecommit.yml +++ b/.github/workflows/sync-to-codecommit.yml @@ -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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/ansible/rhel-arm-baseline.yaml b/ansible/rhel-arm-baseline.yaml index d01cea0..709c935 100644 --- a/ansible/rhel-arm-baseline.yaml +++ b/ansible/rhel-arm-baseline.yaml @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/buildspec.yml b/buildspec.yml index 08c4dcb..140d9b1 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -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: - - '**/*' \ No newline at end of file + - '**/*'