-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MRG: Merge pull request #15 from octue/fix-branch-tag-truncation
Fix branch tag truncation
- Loading branch information
Showing
7 changed files
with
280 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,58 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
test-action: | ||
get-package-version: | ||
if: "!contains(github.event.head_commit.message, 'skipci')" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
permissions: | ||
contents: read | ||
outputs: | ||
version: ${{ steps.get-package-version.outputs.version }} | ||
version_slug: ${{ steps.get-package-version.outputs.version_slug }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Install poetry | ||
uses: snok/[email protected] | ||
|
||
- name: Get package version | ||
id: get-package-version | ||
run: | | ||
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT | ||
echo "version_slug=$(poetry version -s | tr . -)" >> $GITHUB_OUTPUT | ||
docker: | ||
runs-on: ubuntu-latest | ||
needs: get-package-version | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: octue/get-deployment-info:${{ needs.get-package-version.outputs.version }} | ||
|
||
test-action: | ||
runs-on: ubuntu-latest | ||
needs: [get-package-version, docker] | ||
timeout-minutes: 5 | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Get deployment info | ||
id: get-deployment-info | ||
uses: ./ | ||
|
@@ -29,12 +68,6 @@ jobs: | |
gcp_service_name: my-test-service | ||
gcp_environment: main | ||
|
||
- name: Get package version | ||
id: get-package-version | ||
run: | | ||
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT | ||
echo "version_slug=$(poetry version -s | tr . -)" >> $GITHUB_OUTPUT | ||
- name: Get short SHA | ||
id: get-short-sha | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
|
@@ -51,25 +84,25 @@ jobs: | |
- 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:pull-${{ github.event.number }}-latest | ||
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:refs-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: pull-${{ github.event.number }}-latest | ||
expected: refs-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:pull-${{ github.event.number }} | ||
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:refs-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: pull-${{ github.event.number }} | ||
expected: refs-pull-${{ github.event.number }} | ||
actual: ${{ steps.get-deployment-info.outputs.image_version_tag }} | ||
|
||
- name: Check `short_sha` | ||
|
@@ -81,23 +114,23 @@ jobs: | |
- name: Check `version` | ||
uses: nick-fields/assert-action@v1 | ||
with: | ||
expected: ${{ steps.get-package-version.outputs.version }} | ||
expected: ${{ needs.get-package-version.outputs.version }} | ||
actual: ${{ steps.get-deployment-info.outputs.version }} | ||
|
||
- name: Check `version_slug` | ||
uses: nick-fields/assert-action@v1 | ||
with: | ||
expected: ${{ steps.get-package-version.outputs.version_slug }} | ||
expected: ${{ needs.get-package-version.outputs.version_slug }} | ||
actual: ${{ steps.get-deployment-info.outputs.version_slug }} | ||
|
||
- name: Check `revision_tag` | ||
uses: nick-fields/assert-action@v1 | ||
with: | ||
expected: pull-${{ github.event.number }} | ||
expected: refs-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: pull-${{ github.event.number }} | ||
expected: refs-pull-${{ github.event.number }} | ||
actual: ${{ steps.get-deployment-info.outputs.revision_tag_slug }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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].2 | ||
RUN pip3 install git+https://github.com/octue/[email protected].3 | ||
|
||
COPY get_deployment_info/entrypoint.sh /entrypoint.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ steps: | |
|
||
- name: Get deployment info | ||
id: get-deployment-info | ||
uses: octue/[email protected].2 | ||
uses: octue/[email protected].3 | ||
with: | ||
gcp_project_name: test-project | ||
gcp_project_number: 1234 | ||
|
@@ -77,6 +77,6 @@ Some of the outputs' values depend on whether the action is run on the `main` br | |
The truncated branch name (first 12 characters) is used to ensure service names are short enough to be accepted by e.g. | ||
Cloud Run without having to restrict the length of branch names. | ||
|
||
- `revision_tag` is `pull-<truncated branch_tag_kebab>` | ||
- `image_version_tag` is `pull-<truncated branch_tag_kebab>` | ||
- `image_latest_tag` is `pull-<truncated branch_tag_kebab>-latest` | ||
- `revision_tag` is `<truncated branch_tag_kebab>` | ||
- `image_version_tag` is `<truncated branch_tag_kebab>` | ||
- `image_latest_tag` is `<truncated branch_tag_kebab>-latest` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.