Skip to content

Commit

Permalink
[Playground] Docker image build from action (#213)
Browse files Browse the repository at this point in the history
* Adding build-osd-image action

Signed-off-by: Tao Liu <liutaoaz@amazon.com>


---------

Signed-off-by: Tao Liu <liutaoaz@amazon.com>
  • Loading branch information
Flyingliuhub authored Mar 12, 2024
1 parent 09a3863 commit ee48bf2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The current workflows folder contains one deployment workflow(os-osd-deployment.
- os-osd-deployment.yml
- deployment-template.yml
- functional-test-template.yml
- trigger-build-osd-image.yml

## Prerequisites

Expand Down Expand Up @@ -37,6 +38,13 @@ The current workflows folder contains one deployment workflow(os-osd-deployment.
>> - secrets: osd-user, the write access user of OpenSearch Dashboards.
>> - secrets: osd-user-password, the write access user's password for OpenSearch Dashboards.
> trigger-build-osd-image.yml:
>> This GitHub Actions workflow triggers the OSD Build Image Workflow. It is triggered manually using the `workflow_dispatch` event and accepts several input parameters:
>> - `python_version`: The Python version to use for the build. Default value is `'3.9.17'`.
>> - `node_version`: The Node.js version to use for the build. Default value is `'18.19.0'`.
>> - `osd_version`: The OpenSearch Dashboards version to use for the build. Default value is `'3.0.0'`.
>> - `additional_args`: JSON string of additional options for the build. Default value is `'{}'`.
>> - `build_number`: The build number. This parameter is optional.
## Appendix

Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/trigger-build-osd-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Trigger OSD Build Image Workflow

on:
workflow_dispatch:
inputs:
python_version:
description: Python version
type: string
default: '3.9.17'
required: true
node_version:
description: Node version
type: string
default: '18.19.0'
required: true
osd_version:
description: OpenSearch Dashboards version
type: string
default: '3.0.0'
required: true
additional_args:
description: JSON of additional options
type: string
default: '{}'
required: true
build_number:
description: Build number
type: string
default: ''
required: false

jobs:
trigger-osd-build-image:
runs-on: ubuntu-latest
steps:
- name: Trigger Build-OSD-Image Workflow
uses: actions/github-script@v7
with:
github-token: '${{ secrets.GH_ACCESS_TOKEN_RUNNER }}'
script: |
const pythonVersion = '${{ github.event.inputs.python_version }}';
const nodeVersion = '${{ github.event.inputs.node_version }}';
const osdVersion = '${{ github.event.inputs.osd_version }}';
const additionalArgs = '${{ github.event.inputs.additional_args }}';
const buildNumber = '${{ github.event.inputs.build_number }}';
const dispatchResp = await github.request('POST /repos/Flyingliuhub/osd-build-image/actions/workflows/Build-OSD-Image.yml/dispatches', {
ref: 'main',
inputs: {
python_version: pythonVersion,
node_version: nodeVersion,
osd_version: osdVersion,
additional_args: additionalArgs,
build_number: buildNumber,
},
});
console.log(`Event dispatch for osd-build-image : ${dispatchResp.status}`)

0 comments on commit ee48bf2

Please sign in to comment.