Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

We can implement CI workflow using GitHub's runner and SSH into our server to deploy.  However, because of our extra-tier IP restricted firewall.  We cannot use GitHub runner as it have  has the same IP address ranges as Azure Data centers.  Furthermore,  SSH is not possible unless we request Media3 to turn off DUO authentication for the server web user account.  I created a workflow using GitHub Action with our own self-hosted runner (which is installed under my superuser, the web user does not have enough privilege to install and run the runner ) and execute sudo command as the web user account. 

 

  1. Adding a self-hosted runner to a repository or an

    organization 

    organization 

    I added our dev server to the organization as many repositories uses the dev server.  For prod server that only related to one repo (such as SPI), it's better to install to a repository.

You can add self-hosted runners at the organization level, where they can be used to process jobs for multiple repositories in an organization. To add a self-hosted runner to an organization, you must be an organization owner.

...

On GitHub, navigate to the main page of the organization.

...

Under your organization name, click  Settings.

Organization settings buttonImage Removed

 

...

In the left sidebar, click Actions.

Actions settingImage Removed

 

...

Under "Self-hosted runners," click Add new, then click New runner.

...

Select the operating system and architecture of your self-hosted runner machine.

Select self-hosted runner operating systemImage Removed

 

You will see instructions showing you how to download the runner application and install it on your self-hosted runner machine.

Open a shell on your self-hosted runner machine and run each shell command in the order shown.

Note: On Windows, if you want to install the self-hosted runner application as a service, you must open a shell with administrator privileges. We also recommend that you use C:\actions-runner as the directory for the self-hosted runner application so that Windows system accounts can access the runner directory.

The instructions walk you through completing these tasks:


  1. Set up SSH Key for GitHub to skip password at each git command

     

  2. Workflow syntax 

    sample workflow syntax for deploy to dev and prod.

  3. How to run SSH commands

    We probably won't use this approach because of the IP restriction firewall.   I put down my research in case it's useful in the future.

...

...

Configureing as a Service

...

        Stop the self-hosted runner application if it is currently running.

                                Install the service    

                                Start the service   

                                Check the status of the service

Code Block
languagebash
sudo ./svc.sh stop
sudo ./svc.sh install
sudo ./svc.sh start
sudo ./svc.sh status

Checking that your self-hosted runner was successfully added

After completing the steps to add a self-hosted runner, the runner and its status are now listed under "Self-hosted runners".

The self-hosted runner application must be active for the runner to accept jobs. When the runner application is connected to GitHub and ready to receive jobs, you will see the following message on machine's terminal.

√ Connected to GitHub

2019-10-24 05:45:56Z: Listening for Jobs

For more information, see "Monitoring and troubleshooting self-hosted runners."

 

Checking the status of a self-hosted runner

Under "Self-hosted runners," you can view a list of registered runners, including the runner's name, labels, and status.

 

Runner listImage Removed

 

The status can be one of the following:

  • Idle: The runner is connected to GitHub and is ready to execute jobs.
  • Active: The runner is currently executing a job.
  • Offline: The runner is not connected to GitHub. This could be because the machine is offline, the self-hosted runner application is not running on the machine, or the self-hosted runner application cannot communicate with GitHub.

Adding a self-hosted runner to a repository

Adding a self-hosted runner to an organization

How to use GitHub Actions with your own self-hosted runner (aka build agent)

Configuring the self-hosted runner application as a service

Monitoring and troubleshooting self-hosted runners

 

Code Block
languagebash
 

...