Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #176

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions .github/workflows/rocky8.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
---
name: Rocky 8
name: Ansible build test for Rocky 8

on:
pull_request:
workflow_dispatch:

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1


jobs:

lint-test:
name: Lint
name: Lint for PR
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -41,7 +38,7 @@ jobs:
run: ansible-lint

rocky8-test:
name: Initial build test
name: Ansible build test for Rocky 8
runs-on: ubuntu-latest
needs: ['lint-test']

Expand Down Expand Up @@ -77,6 +74,10 @@ jobs:
cd testing/
terraform plan -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -var "os=rocky8" -no-color
continue-on-error: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
Expand All @@ -86,6 +87,10 @@ jobs:
run: |
cd testing/
terraform apply -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -var "os=rocky8" -auto-approve
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Set up Python
id: setup_python
Expand Down Expand Up @@ -114,6 +119,10 @@ jobs:
echo "" >> ansible.cfg
echo "remote_user=centos" >> ansible.cfg
echo "private_key_file=.key" >> ansible.cfg
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Check hosts.ini and ansible.cfg
run: |
Expand Down Expand Up @@ -155,7 +164,11 @@ jobs:
echo "[all:vars]" >> hosts.ini
echo "kubernetes_api_server_host=$(aws ec2 describe-instances --filters "Name=tag:Owner,Values=rke2-ansible-github-actions" "Name=tag:NodeType,Values=Server" "Name=tag:github_run,Values=$GITHUB_RUN_ID" --query "Reservations[*].Instances[*].PrivateIpAddress" --output text | head -1)" >> hosts.ini
cp hosts.ini inventory/rocky8/hosts.ini

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Run playbook again with added hosts
run: |
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/rocky8/hosts.ini -u centos --verbose --private-key .key site.yml
Expand All @@ -180,3 +193,8 @@ jobs:
run: |
cd testing/
terraform destroy -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -auto-approve
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

38 changes: 27 additions & 11 deletions .github/workflows/ubuntu20.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
---
name: Ubuntu 20.04
name: Ansible build test for Ubuntu

on:
pull_request:
workflow_dispatch:

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

jobs:

lint-test:
name: Lint
name: Lint for PR
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -41,7 +36,7 @@ jobs:
run: ansible-lint

ubuntu20-test:
name: Initial build test
name: Ansible build test for Ubuntu
runs-on: ubuntu-latest
needs: ['lint-test']

Expand Down Expand Up @@ -77,6 +72,10 @@ jobs:
cd testing/
terraform plan -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -var "os=ubuntu20" -no-color
continue-on-error: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
Expand All @@ -86,7 +85,11 @@ jobs:
run: |
cd testing/
terraform apply -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -var "os=ubuntu20" -auto-approve

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Set up Python
id: setup_python
uses: actions/setup-python@v2
Expand Down Expand Up @@ -114,7 +117,11 @@ jobs:
echo "" >> ansible.cfg
echo "remote_user=ubuntu" >> ansible.cfg
echo "private_key_file=.key" >> ansible.cfg

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Check hosts.ini and ansible.cfg
run: |
cat hosts.ini
Expand Down Expand Up @@ -155,7 +162,11 @@ jobs:
echo "[all:vars]" >> hosts.ini
echo "kubernetes_api_server_host=$(aws ec2 describe-instances --filters "Name=tag:Owner,Values=rke2-ansible-github-actions" "Name=tag:NodeType,Values=Server" "Name=tag:github_run,Values=$GITHUB_RUN_ID" --query "Reservations[*].Instances[*].PrivateIpAddress" --output text | head -1)" >> hosts.ini
cp hosts.ini inventory/ubuntu20/hosts.ini

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

- name: Run playbook again with added hosts
run: |
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/ubuntu20/hosts.ini -u ubuntu --verbose --private-key .key site.yml
Expand All @@ -175,3 +186,8 @@ jobs:
run: |
cd testing/
terraform destroy -var "GITHUB_RUN_ID=$GITHUB_RUN_ID" -auto-approve
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-gov-west-1

3 changes: 3 additions & 0 deletions roles/rke2_common/tasks/previous_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
args:
executable: /usr/bin/bash
when: rke2_binary.stat.exists
failed_when: >
(installed_rke2_version_tmp.rc != 141) and
(installed_rke2_version_tmp.rc != 0)

- name: Determine if current version differs what what is being installed
ansible.builtin.set_fact:
Expand Down
Loading