Skip to content

Commit 5879b07

Browse files
authored
MRG: Merge pull request #16 from octue/remove-gcp-environment-input
Remove GCP environment input
2 parents 1d4a51c + 1b0c0c1 commit 5879b07

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
gcp_region: europe-west6
6767
gcp_resource_affix: my-affix
6868
gcp_service_name: my-test-service
69-
gcp_environment: main
7069

7170
- name: Get short SHA
7271
id: get-short-sha

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3.10.7-slim
22

33
RUN apt-get update -y && apt-get install -y --fix-missing curl git && rm -rf /var/lib/apt/lists/*
44

5-
RUN pip3 install git+https://github.com/octue/get-deployment-info@0.2.3
5+
RUN pip3 install git+https://github.com/octue/get-deployment-info@0.3.0
66

77
COPY get_deployment_info/entrypoint.sh /entrypoint.sh
88

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ steps:
2525

2626
- name: Get deployment info
2727
id: get-deployment-info
28-
uses: octue/get-deployment-info@0.2.3
28+
uses: octue/get-deployment-info@0.3.0
2929
with:
3030
gcp_project_name: test-project
3131
gcp_project_number: 1234

action.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ inputs:
2020
gcp_service_name:
2121
description: "The name of the service being deployed."
2222
required: true
23-
gcp_environment:
24-
description: "The environment in Google Cloud the service is being deployed into e.g. 'staging' or 'production'."
25-
required: false
26-
default: main
2723

2824
outputs:
2925
branch_tag_kebab:
@@ -58,16 +54,16 @@ outputs:
5854
description: "A label to affix to the names of the resources created during deployment. This helps avoid confusion about what resources belong to what applications and aids cleanup of old resources."
5955
gcp_service_name:
6056
description: "The name of the service being deployed."
61-
gcp_environment:
62-
description: "The environment in Google Cloud the service is being deployed into e.g. 'staging' or 'production'."
63-
57+
gcp_environment_kebab:
58+
description: "If the branch is 'main', this is 'production'; otherwise it's 'staging'."
59+
gcp_environment_screaming:
60+
description: "If the branch is 'main', this is 'PRODUCTION'; otherwise it's 'STAGING'."
6461
runs:
6562
using: "docker"
66-
image: "docker://octue/get-deployment-info:0.2.3"
63+
image: "docker://octue/get-deployment-info:0.3.0"
6764
args:
6865
- ${{ inputs.gcp_project_name }}
6966
- ${{ inputs.gcp_project_number }}
7067
- ${{ inputs.gcp_region }}
7168
- ${{ inputs.gcp_resource_affix }}
7269
- ${{ inputs.gcp_service_name }}
73-
- ${{ inputs.gcp_environment }}

get_deployment_info/entrypoint.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ GCP_PROJECT_NUMBER=$2
55
GCP_REGION=$3
66
GCP_RESOURCE_AFFIX=$4
77
GCP_SERVICE_NAME=$5
8-
GCP_ENVIRONMENT=$6
98

109
# Get package version.
1110
if [ -f "pyproject.toml" ]; then VERSION=$(poetry version -s); \
@@ -23,7 +22,6 @@ echo "gcp_project_number=$GCP_PROJECT_NUMBER" >> $GITHUB_OUTPUT
2322
echo "gcp_region=$GCP_REGION" >> $GITHUB_OUTPUT
2423
echo "gcp_resource_affix=$GCP_RESOURCE_AFFIX" >> $GITHUB_OUTPUT
2524
echo "gcp_service_name=$GCP_SERVICE_NAME" >> $GITHUB_OUTPUT
26-
echo "gcp_environment=$GCP_ENVIRONMENT" >> $GITHUB_OUTPUT
2725

2826
# Get slugified branch name, resource names, and docker image tags.
2927
SHORT_SHA="$(git config --global --add safe.directory /github/workspace && git rev-parse --short HEAD)"
@@ -39,10 +37,14 @@ if [ "$BRANCH_TAG_KEBAB" = "main" ]; then
3937
REVISION_TAG=$VERSION
4038
IMAGE_VERSION_TAG="$BRANCH_TAG_KEBAB-$REVISION_TAG"
4139
IMAGE_LATEST_TAG="$BRANCH_TAG_KEBAB-latest"
40+
GCP_ENVIRONMENT=production >> $GITHUB_OUTPUT
41+
GCP_ENVIRONMENT_SCREAMING=PRODUCTION >> $GITHUB_OUTPUT
4242
else
4343
REVISION_TAG=$(expr substr "$BRANCH_TAG_KEBAB" 1 12)
4444
IMAGE_VERSION_TAG="$REVISION_TAG"
4545
IMAGE_LATEST_TAG="$REVISION_TAG-latest"
46+
GCP_ENVIRONMENT_KEBAB=staging >> $GITHUB_OUTPUT
47+
GCP_ENVIRONMENT_SCREAMING=STAGING >> $GITHUB_OUTPUT
4648
fi
4749

4850
echo "revision_tag=$REVISION_TAG" >> $GITHUB_OUTPUT
@@ -59,6 +61,7 @@ echo "image_version_artifact=$IMAGE_VERSION_ARTIFACT" >> $GITHUB_OUTPUT
5961
IMAGE_LATEST_ARTIFACT="$GCP_REGION-docker.pkg.dev/$GCP_PROJECT_NAME/$GCP_RESOURCE_AFFIX/$GCP_SERVICE_NAME:$IMAGE_LATEST_TAG"
6062
echo "image_latest_artifact=$IMAGE_LATEST_ARTIFACT" >> $GITHUB_OUTPUT
6163

64+
6265
# Echo the outputs to stdout to aid debugging.
6366
echo ""
6467
echo "OUTPUTS"
@@ -79,4 +82,5 @@ echo "- gcp_project_number: $GCP_PROJECT_NUMBER"
7982
echo "- gcp_region: $GCP_REGION"
8083
echo "- gcp_resource_affix: $GCP_RESOURCE_AFFIX"
8184
echo "- gcp_service_name: $GCP_SERVICE_NAME"
82-
echo "- gcp_environment: $GCP_ENVIRONMENT"
85+
echo "- gcp_environment_kebab: $GCP_ENVIRONMENT_KEBAB"
86+
echo "- gcp_environment_screaming: $GCP_ENVIRONMENT_SCREAMING"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "get-deployment-info"
3-
version = "0.2.3"
3+
version = "0.3.0"
44
description = "A Github Action that gets the information required to build and deploy an Octue service."
55
authors = ["Marcus Lugg <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)