Skip to content

Commit

Permalink
MRG: Merge pull request #13 from octue/fix-shorten-revision-tag-for-p…
Browse files Browse the repository at this point in the history
…ull-requests

Shorten revision tag for pull requests
  • Loading branch information
cortadocodes authored Dec 4, 2023
2 parents d9b573d + 4f872c5 commit f83ccd4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
name: test-deployment-info

on:
push:
branches-ignore:
- main
pull_request:

jobs:
test-action:
Expand Down Expand Up @@ -47,31 +45,31 @@ jobs:
- name: Check `branch_tag_kebab`
uses: nick-fields/assert-action@v1
with:
expected: ${{ env.GITHUB_REF_SLUG }}
expected: refs-pull-${{ github.event.number }}-merge
actual: ${{ steps.get-deployment-info.outputs.branch_tag_kebab }}

- name: Check `image_latest_artifact`
uses: nick-fields/assert-action@v1
with:
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:branch-${{ env.GITHUB_REF_SLUG }}-latest
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:pull-${{ github.event.number }}-latest
actual: ${{ steps.get-deployment-info.outputs.image_latest_artifact }}

- name: Check `image_latest_tag`
uses: nick-fields/assert-action@v1
with:
expected: branch-${{ env.GITHUB_REF_SLUG }}-latest
expected: pull-${{ github.event.number }}-latest
actual: ${{ steps.get-deployment-info.outputs.image_latest_tag }}

- name: Check `image_version_artifact`
uses: nick-fields/assert-action@v1
with:
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:branch-${{ env.GITHUB_REF_SLUG }}
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:pull-${{ github.event.number }}
actual: ${{ steps.get-deployment-info.outputs.image_version_artifact }}

- name: Check `image_version_tag`
uses: nick-fields/assert-action@v1
with:
expected: branch-${{ env.GITHUB_REF_SLUG }}
expected: pull-${{ github.event.number }}
actual: ${{ steps.get-deployment-info.outputs.image_version_tag }}

- name: Check `short_sha`
Expand All @@ -95,11 +93,11 @@ jobs:
- name: Check `revision_tag`
uses: nick-fields/assert-action@v1
with:
expected: branch-${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
expected: pull-${{ github.event.number }}
actual: ${{ steps.get-deployment-info.outputs.revision_tag }}

- name: Check `revision_tag_slug`
uses: nick-fields/assert-action@v1
with:
expected: branch-${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
expected: pull-${{ github.event.number }}
actual: ${{ steps.get-deployment-info.outputs.revision_tag_slug }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM python:3.10.7-slim

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

RUN pip3 install git+https://github.com/octue/[email protected].0
RUN pip3 install git+https://github.com/octue/[email protected].1

COPY get_deployment_info/entrypoint.sh /entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:

- name: Get deployment info
id: get-deployment-info
uses: octue/[email protected].0
uses: octue/[email protected].1
with:
gcp_project_name: test-project
gcp_project_number: 1234
Expand Down
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ outputs:

runs:
using: "docker"
image: "docker://octue/get-deployment-info:0.2.0"
image: "docker://octue/get-deployment-info:0.2.1"
args:
- ${{ inputs.gcp_project_name }}
- ${{ inputs.gcp_project_number }}
Expand Down
2 changes: 1 addition & 1 deletion get_deployment_info/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ "$BRANCH_TAG_KEBAB" = "main" ]; then
IMAGE_VERSION_TAG="$BRANCH_TAG_KEBAB-$REVISION_TAG"
IMAGE_LATEST_TAG="$BRANCH_TAG_KEBAB-latest"
else
REVISION_TAG="branch-$BRANCH_TAG_KEBAB"
REVISION_TAG=pull-$(echo $BRANCH_TAG_KEBAB | tr -d -c 0-9)
IMAGE_VERSION_TAG="$REVISION_TAG"
IMAGE_LATEST_TAG="$REVISION_TAG-latest"
fi
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "get-deployment-info"
version = "0.2.0"
version = "0.2.1"
description = "A Github Action that gets the information required to build and deploy an Octue service."
authors = ["Marcus Lugg <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit f83ccd4

Please sign in to comment.