Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ permissions:

jobs:
integration:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
if: |-
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4
Expand Down Expand Up @@ -65,6 +66,8 @@ jobs:
project_id: '${{ vars.PROJECT_ID }}'

- name: 'get-deployment'
shell: bash
shell: 'bash'
env:
NAMESPACE: '${{ vars.NAMESPACE }}'
run: |
kubectl get deployment -n ${{ vars.NAMESPACE }}
kubectl get deployment -n "${NAMESPACE}"
22 changes: 11 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Deploy GKE
name: 'Deploy GKE'
description: |-
Use gke-deploy cli to deploy an image
author: Google LLC
author: 'Google LLC'

inputs:
image:
Expand Down Expand Up @@ -46,12 +46,12 @@ inputs:
namespace:
description: |-
Namespace of GKE cluster to deploy to.
If not provided, it will not be passed to the binary.
If not provided, it will not be passed to the binary.
required: false

expose:
description: |-
The port provided will be used to expose the deployed workload object (i.e., port and targetPort will be set to the value provided in this flag).
The port provided will be used to expose the deployed workload object (i.e., port and targetPort will be set to the value provided in this flag).
If not provided, it will not be passed to the binary.
required: false

Expand All @@ -70,10 +70,10 @@ runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.image }}
- ${{ inputs.app_name }}
- ${{ inputs.region }}
- ${{ inputs.cluster_name }}
- ${{ inputs.project_id }}
- ${{ inputs.namespace }}
- ${{ inputs.expose }}
- '${{ inputs.image }}'
- '${{ inputs.app_name }}'
- '${{ inputs.region }}'
- '${{ inputs.cluster_name }}'
- '${{ inputs.project_id }}'
- '${{ inputs.namespace }}'
- '${{ inputs.expose }}'
36 changes: 18 additions & 18 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@

gha_version="0.1.0"

image="$1"
app_name="$2"
location="$3"
cluster_name="$4"
project_id="$5"
namespace="$6"
expose_port="$7"
k8s_manifests="$8"
image="${1}"
app_name="${2}"
location="${3}"
cluster_name="${4}"
project_id="${5}"
namespace="${6}"
expose_port="${7}"
k8s_manifests="${8}"

gke_deploy_command="gke-deploy run -i $image -a $app_name -l $location -c $cluster_name -p $project_id"
gke_deploy_command="gke-deploy run -i ${image} -a ${app_name} -l ${location} -c ${cluster_name} -p ${project_id}"

# Ensure all required variables are provided by workflow users.
if [ -z "$image" ] || [ -z "$app_name" ] || [ -z "$location" ] || [ -z "$cluster_name" ] || [ -z "$project_id" ]; then
if [ -z "${image}" ] || [ -z "${app_name}" ] || [ -z "${location}" ] || [ -z "${cluster_name}" ] || [ -z "${project_id}" ]; then
echo "Error: Required variables (image, app_name, location, cluster_name, project_id) are not set."
exit 1
fi

# Add namespace if the input is apparent.
if [ -n "$namespace" ]; then
gke_deploy_command="$gke_deploy_command -n $namespace"
if [ -n "${namespace}" ]; then
gke_deploy_command="${gke_deploy_command} -n ${namespace}"
fi

# Add expose port if the input is apparent.
if [ -n "$expose_port" ]; then
gke_deploy_command="$gke_deploy_command -x $expose_port"
if [ -n "${expose_port}" ]; then
gke_deploy_command="${gke_deploy_command} -x ${expose_port}"
fi

# Add k8s manifests file(s) if the input is apparent.
if [ -n "$k8s_manifests" ]; then
gke_deploy_command="$gke_deploy_command -f $k8s_manifests"
if [ -n "${k8s_manifests}" ]; then
gke_deploy_command="${gke_deploy_command} -f ${k8s_manifests}"
fi

# Utilize Google APIs user agent for metrics with the following unique identifier:
export GOOGLE_APIS_USER_AGENT=google-github-action:deploy-gke/$gha_version
export GOOGLE_APIS_USER_AGENT="google-github-action:deploy-gke/${gha_version}"

$gke_deploy_command
${gke_deploy_command}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "deploy-gke",
"version": "0.0.3",
"engines": {
"node": "20.x",
"npm": "10.x"
},
"scripts": {
"build": "exit 0"
}
Expand Down
Loading