From 545967cef78e8efb389127407a55a49c5a854b24 Mon Sep 17 00:00:00 2001 From: Luca Stocchi Date: Mon, 28 Sep 2020 16:59:32 +0200 Subject: [PATCH 1/2] Add support for OpenShift Action Signed-off-by: Luca Stocchi --- ci/openshift.yml | 48 +++++++++++++++++++++++++ ci/properties/openshift.properties.json | 7 ++++ icons/openshift.svg | 1 + 3 files changed, 56 insertions(+) create mode 100644 ci/openshift.yml create mode 100644 ci/properties/openshift.properties.json create mode 100644 icons/openshift.svg diff --git a/ci/openshift.yml b/ci/openshift.yml new file mode 100644 index 0000000..ce91015 --- /dev/null +++ b/ci/openshift.yml @@ -0,0 +1,48 @@ +# This workflow will set up the oc CLI in your GitHub Action workflow and deploy your application to your OpenShift cluster. +# +# This workflow assumes you already have access to an OpenShift cluster. +# For instructions to get started with OpenShift see https://www.openshift.com/try +# +# To configure this workflow: +# +# 1. Set up a secret in your repository named OPENSHIFT_SERVER_URL with the value of your OpenShift server URL. +# +# 2. Set up another secret named API_TOKEN with the value of a valid token to authenticate to OpenShift. +# +# 3. Change the values for the PROJECT and APP_NAME environment variables (below). +# +# For more information on the OpenShift Action, refer to https://github.com/redhat-developer/openshift-actions +name: Build and Deploy to OpenShift +on: + push: + branches: + - master + +# Environment variables available to all jobs and steps in this workflow +env: + PROJECT: myproject + APP_NAME: myapp + +jobs: + build: + name: Setup and Deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + # Set up the oc CLI, authenticate and deploy to OpenShift + - name: Set up oc CLI and deploy to OpenShift + uses: redhat-developer/openshift-actions@v2.1.0 + with: + version: '4.3' + openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }} + parameters: '{"apitoken": "${{ secrets.API_TOKEN }}", "acceptUntrustedCerts": "true"}' + cmd: | + oc project ${PROJECT} + oc new-app ${GITHUB_WORKSPACE} --name ${APP_NAME} + # Expose the service created by using the oc CLI installed previously + - name: Execute additional oc commands + run: | + oc expose svc/${{ env.APP_NAME }} \ No newline at end of file diff --git a/ci/properties/openshift.properties.json b/ci/properties/openshift.properties.json new file mode 100644 index 0000000..fd5fc0e --- /dev/null +++ b/ci/properties/openshift.properties.json @@ -0,0 +1,7 @@ +{ + "name": "OpenShift", + "description": "Set up the oc CLI in your GitHub Actions workflow and deploy your application to OpenShift.", + "creator": "Red Hat", + "iconName": "openshift", + "categories": null +} \ No newline at end of file diff --git a/icons/openshift.svg b/icons/openshift.svg new file mode 100644 index 0000000..85149ff --- /dev/null +++ b/icons/openshift.svg @@ -0,0 +1 @@ +plugin_icons_0918_RGB_openshift_color \ No newline at end of file From 12319ff7dedc697d5a8418b79cc3be4ae66e6ea4 Mon Sep 17 00:00:00 2001 From: Luca Stocchi Date: Mon, 28 Sep 2020 17:10:57 +0200 Subject: [PATCH 2/2] update branch Signed-off-by: Luca Stocchi --- ci/openshift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/openshift.yml b/ci/openshift.yml index ce91015..978d3a1 100644 --- a/ci/openshift.yml +++ b/ci/openshift.yml @@ -16,7 +16,7 @@ name: Build and Deploy to OpenShift on: push: branches: - - master + - $default-branch # Environment variables available to all jobs and steps in this workflow env: