Skip to content

Commit

Permalink
Merge pull request #14 from openmainframeproject/new-action
Browse files Browse the repository at this point in the history
Auto update submodules
  • Loading branch information
pleia2 authored May 28, 2024
2 parents 6f46ea2 + 82c36c3 commit 0db9941
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/updatesubmodules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Sync Submodules
on: workflow_dispatch
jobs:

repo_sync:
name: Sync with Main repo
runs-on: ubuntu-latest
steps:
- name: ssh and git module update
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd /opt/software-discovery-tool-deploy
git checkout -b "$(date +%b%d)"
cd /opt/software-discovery-tool-deploy/software-discovery-tool
git checkout master
git pull origin master
cd /opt/software-discovery-tool-deploy
git remote remove git_update
git remote add git_update https://${{ secrets.SDT_USER_PUSH }}:${{ secrets.SDT_PAT_PUSH }}@github.com/openmainframeproject/software-discovery-tool-deploy.git
git commit -sam "Auto updated submodule references" && git push git_update "$(date +%b%d)" || echo "No changes to commit"
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Bootstrapping the Software Discovery Tool Deployment Repository
## Introduction
This guide will walk you through the process of setting up the Software Discovery Tool deployment repository from scratch on an Ubuntu system. We'll use submodules to include the main repository and the data repository within the deployment repository.

## What are Submodules?
Submodules in Git allow you to include other Git repositories as subdirectories of your own repository. In our case, we use submodules to include the main Software Discovery Tool repository and the data repository within the deployment repository.

# Step-by-Step Instructions
1. Install Ubuntu:
Follow the installation instructions for Ubuntu on your virtual machine (VM) [Link](https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox#1-overview)

2. Clone the Deployment Repository:
Use the following command to clone the deployment repository and its submodules:
```sudo git clone --recurse-submodules https://github.com/openmainframeproject/software-discovery-tool-deploy.git /opt/software-discovery-tool-deploy```
This command will clone the deployment repository and automatically initialize and update all submodules.

3. Create Symbolic Link:
Create a symbolic link to the Software Discovery Tool directory:
```sudo ln -s /opt/software-discovery-tool-deploy/software-discovery-tool/ /opt/software-discovery-tool
```
This command creates a symbolic link named `/opt/software-discovery-tool` pointing to the `software-discovery-tool` directory within the deployment repository.

# Directory Structure
After completing the above steps, your directory structure should resemble the following:
```
/opt/
├── software-discovery-tool-deploy/ # Deployment repository
│ ├── software-discovery-tool/ # Main repository (submodule)
│ └── data/ # Data repository (submodule)
└── software-discovery-tool/ # Symbolic link to the Software Discovery Tool directory
```


# How To Deploy
The whole SDT deployment is maintained by:
- [cicd.yml](https://github.com/rachejazz/software-discovery-tool-deploy/blob/main/.github/workflows/cicd.yml) workflow
- [config_build.py](https://github.com/openmainframeproject/software-discovery-tool/blob/master/bin/config_build.py) to create new sections in the distro config file
- [package_build.py](https://github.com/openmainframeproject/software-discovery-tool/blob/master/bin/package_build.py) to update existing distro files to latest versions

# Contribute to the deployment workflow

## Contribute to deployment script
The deployment uses [appleboy's ssh workflow](https://github.com/appleboy/ssh-action)
The deployment is thus triggered at every new pusb into the main branch.
The script section uses the required server credentials to be able to host the tool.
```yml
script: |
cd /opt/software-discovery-tool-deploy
sudo chown -R sdtuser .
git checkout main
git pull origin main --recurse-submodules
sudo cp -u -r software-discovery-tool/ ../software-discovery-tool/
[cicd.yml](https://github.com/rachejazz/software-discovery-tool-deploy/blob/main/.github/workflows/cicd.yml)
```
It includes
- Pulling the latest changes
- Copies the contents to the main directory
- Uses config_build.py to check for new data files
- Uses package_build.py to update the existing files with the recent pkg versions
- Restart the server
## Contribute to package_build.py
The binary has separate methods to extract data from Linux Distributions and [PDS]().
Check [SDT-data]() repo to find out the distro list we support.
## Contribute to config_build.py
This file controls the `supported_distro.py` file that resides inside `src/config` directory.
It checks for any new data file inside `distro_files` directory and adds it's mapping to the `supported_distro.py`.
Any existing data file from PDS is updated from upstream.


_NOTE_
Any contribution to the binary should be done in the main repository.

# Report bugs and issues
Feel free to add new issues or features that you would like SDT to support.
Bugs are given high priority since this is an active project used by users of IBM zSystems and LinuxONE .

For deployment improvements, use this repository.
For new feature request to SDT, use the [main repository](https://github.com/openmainframeproject/software-discovery-tool).
For new data files request, use the [data repository](https://github.com/openmainframeproject/software-discovery-tool-data).

Appreciating all the contributions that you do for the Open Mainframe Project.

0 comments on commit 0db9941

Please sign in to comment.