Skip to content

Particular/setup-oracle-action

Repository files navigation

setup-oracle-action

This action handles the setup and teardown of an Oracle database.

Usage

See action.yml

steps:
- name: Setup Oracle
  uses: Particular/[email protected]
  with:
    connection-string-name: <my connection string name>
    tag: <my tag>
    init-script: /path/to/init-oracle.sql
    registry-login-server: index.docker.io
    registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
    registry-password: ${{ secrets.DOCKERHUB_TOKEN }}}}    

connection-string-name and tag are required. init-script is optional.

For logging into a container registry when running on Windows:

  • registry-login-server defaults to index.docker.io and is not required if logging into Docker Hub.
  • registry-username and registry-password are optional and will result in pulling the container anonymously if omitted.

License

The scripts and documentation in this project are released under the MIT License.

Development

Open the folder in Visual Studio Code. If you don't already have them, you will be prompted to install remote development extensions. After installing them, and re-opening the folder in a container, do the following:

Log into Azure

az login
az account set --subscription SUBSCRIPTION_ID

Run the npm installation

npm install

When changing index.js, either run npm run dev beforehand, which will watch the file for changes and automatically compile it, or run npm run prepare afterwards.

Testing

With Node.js

To test the setup action an .env.setup file in the root directory with the following content

# Input overrides
INPUT_CONNECTION-STRING-NAME=OracleConnectionString
INPUT_TAG=setup-oracle-action
INPUT_INIT-SCRIPT=.github/workflows/scripts/init.sql

# Runner overrides
# Use LINUX to run on Linux
RUNNER_OS=WINDOWS
RESOURCE_GROUP_OVERRIDE=yourResourceGroup
REGION_OVERRIDE=West Europe

then execute the script

node -r dotenv/config dist/index.js dotenv_config_path=.env.setup

To test the cleanup action add a .env.cleanup file in the root directory with the following content

# State overrides
STATE_IsPost=true
STATE_containerName=nameOfPreviouslyCreatedContainer
STATE_storageName=nameOfPreviouslyCreatedContainer
node -r dotenv/config dist/index.js dotenv_config_path=.env.cleanup

With PowerShell

To test the setup action set the required environment variables and execute setup.ps1 with the desired parameters.

$Env:RUNNER_OS=Windows
$Env:RESOURCE_GROUP_OVERRIDE=yourResourceGroup
$Env:REGION_OVERRIDE=yourRegion
.\setup.ps1 -ContainerName psw-oracle-1 -StorageName psworacle1 -ConnectionStringName OracleConnectionString -Tag setup-oracle-action -$InitScript .github/workflows/scripts/init.sql

To test the cleanup action set the required environment variables and execute cleanup.ps1 with the desired parameters.

$Env:RUNNER_OS=Windows
$Env:RESOURCE_GROUP_OVERRIDE=yourResourceGroup
.\cleanup.ps1 -ContainerName psw-oracle-1 -StorageName psworacle1 -ConnectionStringName OracleConnectionString -Tag setup-oracle-action -$InitScript .github/workflows/scripts/init.sql