Skip to content

Commit

Permalink
artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
MozeBaltyk committed May 24, 2024
1 parent afe7673 commit f75dc43
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 78 deletions.
134 changes: 92 additions & 42 deletions .github/workflows/stage_airgap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
#BUCKET: "terraform-backend-github"
CONTROLLER_COUNT: "1"
WORKER_COUNT: "1"
AIRGAP: "true"
SIZE: "s-2vcpu-4gb"

jobs:
Expand Down Expand Up @@ -117,6 +118,7 @@ jobs:
-var "spaces_access_key_id=${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}" \
-var "spaces_access_key_secret=${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" \
-var "mount_point=${MOUNT_POINT}" \
-var "airgap=${AIRGAP}" \
-var "terraform_backend_bucket_name=${BUCKET}"
continue-on-error: true

Expand All @@ -129,16 +131,29 @@ jobs:
cd ./DO/infra
terraform apply terraform.tfplan
# No relative path allowed
- name: Inventory artifacts
uses: actions/upload-artifact@v4
with:
name: inventory
path: |
${{ github.workspace }}/test/inventory/hosts.ini
${{ github.workspace }}/DO/infra/.key.private
${{ github.workspace }}/DO/infra/.key.pub
if-no-files-found: error
# Save Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Mount Space Bucket
run: |
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Save files
run: |
cp ${{ github.workspace }}/test/inventory/hosts.ini ${MOUNT_POINT}/hosts.ini
cp ${{ github.workspace }}/test/DO/infra/.key.private ${MOUNT_POINT}/.key.private
reachable:
name: Reachable
Expand All @@ -155,16 +170,31 @@ jobs:
- name: Checkout files
uses: actions/checkout@v4

- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory
# Get Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Check if inventory present
- name: Mount Space Bucket
run: |
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Get Artificats
run: |
ls -l /hosts.ini
cat ${{ github.workspace }}/hosts.ini
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
# Reachable
- name: Set up Python
id: setup_python
uses: actions/setup-python@v5
Expand All @@ -177,13 +207,6 @@ jobs:
pip3 install ansible
ansible --version
- name: Get key and hosts.ini
run: |
cp ${{ github.workspace }}/hosts.ini inventory/hosts.ini
cp ${{ github.workspace }}/.key.private ${{ github.workspace }}/DO/infra/.key.private
cp ${{ github.workspace }}/.key.pub ${{ github.workspace }}/DO/infra/.key.pub
shell: bash

- name: Test if reachable
run: |
ANSIBLE_HOST_KEY_CHECKING=False ansible RKE2_CLUSTER -m ping -u root
Expand Down Expand Up @@ -212,18 +235,31 @@ jobs:
cd ..
make prerequis
- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory
# Get Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Get key and hosts.ini
- name: Mount Space Bucket
run: |
cp ${{ github.workspace }}/hosts.ini inventory/hosts.ini
cp ${{ github.workspace }}/.key.private ${{ github.workspace }}/DO/infra/.key.private
cp ${{ github.workspace }}/.key.pub ${{ github.workspace }}/DO/infra/.key.pub
shell: bash
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Get Artificats
run: |
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
# Install
- name: Run playbook hauler_server.yml
run: |
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root playbooks/hauler_server.yml -e dir_target=${MOUNT_POINT}
Expand Down Expand Up @@ -259,18 +295,31 @@ jobs:
- name: Checkout files
uses: actions/checkout@v4

- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory
# Get Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Get key and hosts.ini
- name: Mount Space Bucket
run: |
cp ${{ github.workspace }}/hosts.ini inventory/hosts.ini
cp ${{ github.workspace }}/.key.private ${{ github.workspace }}/DO/infra/.key.private
cp ${{ github.workspace }}/.key.pub ${{ github.workspace }}/DO/infra/.key.pub
shell: bash
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Get Artificats
run: |
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
# Test
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
Expand Down Expand Up @@ -334,6 +383,7 @@ jobs:
-var "spaces_access_key_id=${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}" \
-var "spaces_access_key_secret=${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" \
-var "mount_point=${MOUNT_POINT}" \
-var "airgap=${AIRGAP}" \
-var "terraform_backend_bucket_name=${BUCKET}"
continue-on-error: true

Expand Down
81 changes: 45 additions & 36 deletions .github/workflows/stage_online.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
BUCKET: "rkub-github-action-${{ github.run_id }}"
#BUCKET: "terraform-backend-github"
CONTROLLER_COUNT: "1"
WORKER_COUNT: "0"
WORKER_COUNT: "1"
SIZE: "s-2vcpu-4gb"
AIRGAP: "false"

Expand Down Expand Up @@ -96,16 +96,6 @@ jobs:
cd ./DO/infra
terraform apply terraform.tfplan
# No relative path allowed
- name: Inventory artifacts
uses: actions/upload-artifact@v4
with:
name: inventory
path: |
${{ github.workspace }}/test/inventory/hosts.ini
if-no-files-found: error
retention-days: 1

# Save Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
Expand Down Expand Up @@ -146,11 +136,6 @@ jobs:
uses: actions/checkout@v4

# Get Artifacts
- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory

- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
Expand All @@ -173,8 +158,6 @@ jobs:
run: |
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
ls -l ${{ github.workspace }}/test/inventory/hosts.ini
ls -l ${{ github.workspace }}/test/DO/infra/.key.private
# Test
- name: Set up Python
Expand Down Expand Up @@ -217,18 +200,31 @@ jobs:
cd ..
make prerequis
- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory
# Get Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Get key and hosts.ini
- name: Mount Space Bucket
run: |
cp ${{ github.workspace }}/hosts.ini inventory/hosts.ini
cp ${{ github.workspace }}/.key.private DO/infra/.key.private
cp ${{ github.workspace }}/.key.pub DO/infra/.key.pub
shell: bash
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Get Artificats
run: |
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
# Install
- name: Run playbook install.yml
run: |
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root playbooks/install.yml -e "airgap=false" -e "method=tarball"
Expand Down Expand Up @@ -260,18 +256,31 @@ jobs:
- name: Checkout files
uses: actions/checkout@v4

- name: Download inventory
uses: actions/download-artifact@v4
with:
name: inventory
# Get Artifacts
- name: Install s3fs-fuse on Ubuntu
run: |
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install
- name: Get key and hosts.ini
- name: Mount Space Bucket
run: |
cp ${{ github.workspace }}/hosts.ini inventory/hosts.ini
cp ${{ github.workspace }}/.key.private DO/infra/.key.private
cp ${{ github.workspace }}/.key.pub DO/infra/.key.pub
shell: bash
echo "${{secrets.DIGITALOCEAN_SPACES_ACCESS_TOKEN}}:${{secrets.DIGITALOCEAN_SPACES_SECRET_KEY}}" > ./passwd-s3fs
chmod 600 ./passwd-s3fs
mkdir -p ${MOUNT_POINT}
s3fs ${BUCKET} ${MOUNT_POINT} -o url=https://${REGION}.digitaloceanspaces.com -o passwd_file=./passwd-s3fs
df -Th ${MOUNT_POINT}
- name: Get Artificats
run: |
cp ${MOUNT_POINT}/hosts.ini ${{ github.workspace }}/test/inventory/hosts.ini
cp ${MOUNT_POINT}/.key.private ${{ github.workspace }}/test/DO/infra/.key.private
# Test
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
Expand Down

0 comments on commit f75dc43

Please sign in to comment.