Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 17e95bc

Browse files
committed
Fixing workflow, making checkout ref configurable from the workflow call
1 parent b2c6b44 commit 17e95bc

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

.github/workflows/go-e2e.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
docker_image_prefix:
2323
required: true
2424
type: string
25+
ref:
26+
required: false
27+
type: string
28+
default: ${{ github.ref }}
2529

2630
env:
2731
golang-version: 1.18.1
@@ -39,6 +43,7 @@ jobs:
3943
uses: actions/checkout@v3
4044
with:
4145
repository: timescale/promscale
46+
ref: ${{ inputs.ref }}
4247

4348
- name: Login to GitHub Container Registry
4449
uses: docker/login-action@v2
@@ -50,22 +55,22 @@ jobs:
5055
- name: Figure out database container image from branch name
5156
id: metadata
5257
run: |
53-
if [[ "${{ github.event_name }}" =~ 'workflow_dispatch' ]]; then \
54-
docker_image_12=$(echo ${{github.event.inputs.docker_image_prefix}}-pg12) \
55-
docker_image_13=$(echo ${{github.event.inputs.docker_image_prefix}}-pg13) \
56-
docker_image_14=$(echo ${{github.event.inputs.docker_image_prefix}}-pg14) \
57-
elif [[ "${{ github.event_name }}" =~ 'workflow_call' ]]; then \
58-
docker_image_12=$(echo ${{inputs.docker_image_prefix}}-pg12) \
59-
docker_image_13=$(echo ${{inputs.docker_image_prefix}}-pg13) \
60-
docker_image_14=$(echo ${{inputs.docker_image_prefix}}-pg14) \
61-
else \
62-
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#') \
63-
possible_branch_tag=$(echo ${branch_name}-ts2) \
64-
master_branch_tag=$(echo master-ts2) \
65-
image_base="ghcr.io/timescale/dev_promscale_extension" \
66-
docker_image_12=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg12 ${image_base}:${master_branch_tag}-pg12) \
67-
docker_image_13=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg13 ${image_base}:${master_branch_tag}-pg13) \
68-
docker_image_14=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg14 ${image_base}:${master_branch_tag}-pg14) \
58+
if [[ "${{ github.event_name }}" =~ 'workflow_dispatch' ]]; then
59+
docker_image_12=$(echo ${{github.event.inputs.docker_image_prefix}}-pg12)
60+
docker_image_13=$(echo ${{github.event.inputs.docker_image_prefix}}-pg13)
61+
docker_image_14=$(echo ${{github.event.inputs.docker_image_prefix}}-pg14)
62+
elif [[ "${{ github.event_name }}" =~ 'workflow_call' ]]; then
63+
docker_image_12=$(echo ${{inputs.docker_image_prefix}}-pg12)
64+
docker_image_13=$(echo ${{inputs.docker_image_prefix}}-pg13)
65+
docker_image_14=$(echo ${{inputs.docker_image_prefix}}-pg14)
66+
else
67+
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#')
68+
possible_branch_tag=$(echo ${branch_name}-ts2)
69+
master_branch_tag=$(echo master-ts2)
70+
image_base="ghcr.io/timescale/dev_promscale_extension"
71+
docker_image_12=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg12 ${image_base}:${master_branch_tag}-pg12)
72+
docker_image_13=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg13 ${image_base}:${master_branch_tag}-pg13)
73+
docker_image_14=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg14 ${image_base}:${master_branch_tag}-pg14)
6974
fi;
7075
echo "::set-output name=docker_image_12::${docker_image_12}"
7176
echo "::set-output name=docker_image_13::${docker_image_13}"
@@ -89,6 +94,7 @@ jobs:
8994
uses: actions/checkout@v3
9095
with:
9196
repository: timescale/promscale
97+
ref: ${{ inputs.ref }}
9298

9399
- name: Checkout test data files
94100
run: wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O pkg/tests/testdata/traces-dataset.sz
@@ -129,6 +135,9 @@ jobs:
129135
steps:
130136
- name: Check out code into the Go module directory
131137
uses: actions/checkout@v3
138+
with:
139+
repository: timescale/promscale
140+
ref: ${{ inputs.ref }}
132141

133142
- name: Set up Go ${{ env.golang-version }}
134143
uses: actions/[email protected]

0 commit comments

Comments
 (0)