Skip to content

Commit 308ecd4

Browse files
author
Sean Sundberg
committed
Overhauls image management process to use a single branch
Signed-off-by: Sean Sundberg <seansund@us.ibm.com>
1 parent f812187 commit 308ecd4

14 files changed

Lines changed: 138 additions & 287 deletions

.github/release-drafter-lite.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/release-drafter-v0.14.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/release-drafter-v0.15.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/release-drafter-v1.0.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/release-drafter-v1.1.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/release-drafter-v1.2.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/release-drafter-v13.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/release-drafter-v14.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/docker-build.yaml

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@ name: Docker build
33
# Controls when the workflow will run
44
on:
55
push:
6-
branches:
7-
- 'v*.*'
6+
branches: [ main ]
87
release:
98
types:
109
- published
1110
pull_request:
1211
branches:
13-
- 'v*.*'
12+
- main
1413

1514
jobs:
1615
build:
1716
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
base:
21+
- alpine
22+
- fedora
23+
terraform:
24+
- v1.0
25+
- v1.1
26+
- v1.2
27+
28+
env:
29+
TERRAFORM_LATEST: "v1.2"
30+
1831
steps:
1932
- name: Checkout
2033
uses: actions/checkout@v3
@@ -39,7 +52,62 @@ jobs:
3952
username: ${{ secrets.QUAY_CNTK_USERNAME }}
4053
password: ${{ secrets.QUAY_CNTK_TOKEN }}
4154

42-
- name: Docker CNTK meta
55+
- name: Setup variables ${{ matrix.base }}:${{ matrix.terraform }}
56+
id: variables
57+
shell: bash
58+
run: |
59+
SHORT_TERRAFORM=${{ matrix.terraform }}
60+
61+
SHORT_TAG_ENABLED="false"
62+
if [[ "${{ matrix.base }}" == "alpine" ]]; then
63+
SHORT_TAG_ENABLED="true"
64+
fi
65+
66+
BASE_ENABLED="false"
67+
LATEST_ENABLED="false"
68+
if [[ "${SHORT_TERRAFORM}" == "${TERRAFORM_LATEST}" ]]; then
69+
BASE_ENABLED="true"
70+
71+
if [[ "${{ matrix.base }}" == "alpine" ]]; then
72+
LATEST_ENABLED="true"
73+
fi
74+
fi
75+
76+
RELEASE_TAG=${GITHUB_REF#refs/tags/}
77+
RELEASE_TAG_ENABLED="false"
78+
RELEASE_TAG_SHORT_ENABLED="false"
79+
if [[ "${GITHUB_REF}" =~ refs/tags ]] && [[ "${RELEASE_TAG}" != "main" ]]; then
80+
RELEASE_TAG_ENABLED="true"
81+
82+
if [[ "${{ matrix.base }}" == "alpine" ]]; then
83+
RELEASE_TAG_SHORT_ENABLED="true"
84+
fi
85+
else
86+
RELEASE_TAG="main"
87+
fi
88+
89+
echo "Short terraform: ${SHORT_TERRAFORM}"
90+
echo "::set-output name=terraform::$SHORT_TERRAFORM"
91+
92+
echo "Short tag enabled: $SHORT_TAG_ENABLED"
93+
echo "::set-output name=short-enabled::$SHORT_TAG_ENABLED"
94+
95+
echo "Release tag: ${RELEASE_TAG}"
96+
echo "::set-output name=release-tag::$RELEASE_TAG"
97+
98+
echo "Release tag enabled: $RELEASE_TAG_ENABLED"
99+
echo "::set-output name=release-tag-enabled::$RELEASE_TAG_ENABLED"
100+
101+
echo "Release tag short enabled: $RELEASE_TAG_SHORT_ENABLED"
102+
echo "::set-output name=release-tag-short-enabled::$RELEASE_TAG_SHORT_ENABLED"
103+
104+
echo "Base enabled: $BASE_ENABLED"
105+
echo "::set-output name=base-enabled::$BASE_ENABLED"
106+
107+
echo "Latest enabled: $LATEST_ENABLED"
108+
echo "::set-output name=latest-enabled::$LATEST_ENABLED"
109+
110+
- name: Docker CNTK meta ${{ matrix.base }}:${{ matrix.terraform }}
43111
id: cntk-meta
44112
uses: docker/metadata-action@v4
45113
with:
@@ -48,14 +116,20 @@ jobs:
48116
quay.io/cloudnativetoolkit/cli-tools-core
49117
# Docker tags based on the following events/attributes
50118
tags: |
51-
type=ref,event=tag
52-
type=ref,event=branch
53-
type=raw,value=latest,enable={{is_default_branch}}
119+
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ matrix.base }}
120+
type=raw,value=${{ steps.variables.outputs.terraform }},enable=${{ steps.variables.outputs.short-enabled }}
121+
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ steps.variables.outputs.release-tag }}-${{ matrix.base }},enable=${{ steps.variables.outputs.release-tag-enabled }}
122+
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ steps.variables.outputs.release-tag }},enable=${{ steps.variables.outputs.release-tag-short-enabled }}
123+
type=raw,value=${{ matrix.base }},enable=${{ steps.variables.outputs.base-enabled }}
124+
type=raw,value=latest,enable=${{ steps.variables.outputs.latest-enabled }}
54125
55-
- name: Build and push
126+
- name: Build and push ${{ matrix.base }}:${{ matrix.terraform }}
56127
uses: docker/build-push-action@v3
57128
with:
58129
context: .
130+
file: Dockerfile-${{ matrix.base }}
131+
build-args: |
132+
TERRAFORM_VERSION=${{ matrix.terraform }}
59133
push: ${{ github.event_name != 'pull_request' }}
60134
platforms: linux/amd64,linux/arm64
61135
tags: ${{ steps.cntk-meta.outputs.tags }}

0 commit comments

Comments
 (0)