diff --git a/fn-ci-cd-deployment-pipeline/oci-fn-build.yml b/fn-ci-cd-deployment-pipeline/oci-fn-build.yml index 18c8be4..ed44afd 100644 --- a/fn-ci-cd-deployment-pipeline/oci-fn-build.yml +++ b/fn-ci-cd-deployment-pipeline/oci-fn-build.yml @@ -2,8 +2,7 @@ name: 'oci-fn-build' permissions: contents: read on: - # Trigger the workflow on push or pull request, - # but only for the main branch + # Add Trigger for push or pull request, if needed workflow_dispatch: inputs: OCI_FN_COMPARTMENT: @@ -11,7 +10,7 @@ on: default: ocid1.compartment.oc1.... jobs: - # This workflow contains a single job called "build" + # This workflow contains a single job called "Build" Build: # The type of runner that the job will run on runs-on: ubuntu-latest diff --git a/fn-ci-cd-deployment-pipeline/oci-fn-deploy.yml b/fn-ci-cd-deployment-pipeline/oci-fn-deploy.yml index d793350..74b1224 100644 --- a/fn-ci-cd-deployment-pipeline/oci-fn-deploy.yml +++ b/fn-ci-cd-deployment-pipeline/oci-fn-deploy.yml @@ -2,8 +2,8 @@ name: 'oci-fn-deploy' permissions: contents: read on: - # Trigger the workflow on push or pull request, - # but only for the main branch + # Add Trigger for push or pull request, if needed + workflow_dispatch: inputs: OCI_FN_NAME: @@ -18,9 +18,15 @@ on: OCI_FN_IMAGE: description: OCIR Image to use for Function default: bom.ocir.io/ + WORKFLOW_TYPE: + description: Workflow Type for create or updae function + type: choice + options: + - create + - update jobs: - # This workflow contains a single job called "build" + # This workflow contains a single job called "Deploy" Deploy: runs-on: ubuntu-latest @@ -65,7 +71,8 @@ jobs: fn use context ${{ vars.OCI_TENANCY_NAME }} fn update context registry ${{ vars.OCI_FN_REGISTRY }} fn update context oracle.compartment-id ${{ inputs.OCI_FN_COMPARTMENT }} - fn update context api-url ${{ vars.OCI_FN_API_URL }} + fn update context api-url ${{ vars.OCI_FN_API_URL }} + - name: 'Create or Update OCI Function' run: | - fn update function ${{ inputs.OCI_FN_APP }} ${{ inputs.OCI_FN_NAME }} --image ${{ inputs.OCI_FN_IMAGE }} + fn ${{ inputs.WORKFLOW_TYPE }} function ${{ inputs.OCI_FN_APP }} ${{ inputs.OCI_FN_NAME }} ${{ inputs.OCI_FN_IMAGE }}