diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 491a9dc..2b84abc 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 @@ -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}" diff --git a/action.yml b/action.yml index f1aab9b..091df81 100644 --- a/action.yml +++ b/action.yml @@ -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: @@ -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 @@ -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 }}' diff --git a/entrypoint.sh b/entrypoint.sh index 07b53d9..c08352b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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} diff --git a/package.json b/package.json index 8c70445..e8131cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "name": "deploy-gke", "version": "0.0.3", + "engines": { + "node": "20.x", + "npm": "10.x" + }, "scripts": { "build": "exit 0" }