Skip to content

Commit 8395d0a

Browse files
authored
Merge pull request #26 from strangiato/2.16
2.16 update with actions rewrite
2 parents 1977520 + 022a241 commit 8395d0a

File tree

6 files changed

+1129
-836
lines changed

6 files changed

+1129
-836
lines changed

.github/workflows/build-image-dev.yml

+18-51
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,24 @@ on:
88
- '!main'
99
paths:
1010
- 'mlflow-server/**'
11+
- '.github/**'
1112

1213
jobs:
13-
14-
build:
15-
name: Build Image
16-
runs-on: ubuntu-22.04
17-
env:
18-
BASE_IMAGE: 'registry.access.redhat.com/ubi9/python-311:latest'
19-
REGISTRY: quay.io/troyer
20-
IMAGE_NAME: mlflow-server
21-
MAIN_TAG: latest-dev
22-
23-
steps:
24-
25-
- name: Checkout
26-
uses: actions/checkout@v2
27-
28-
# Setup S2i and Build container image
29-
- name: Setup and Build
30-
id: build_image
31-
uses: redhat-actions/s2i-build@v2
32-
with:
33-
path_context: 'mlflow-server'
34-
builder_image: ${{ env.BASE_IMAGE }}
35-
image: ${{ env.IMAGE_NAME }}
36-
tags: ${{ env.MAIN_TAG }}
37-
- name: Retrieve version
38-
uses: addnab/docker-run-action@v3
39-
with:
40-
image: ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }}
41-
run: |
42-
FULL_VERSION=$(pip show mlflow | grep -i version | awk '{print $2}')
43-
major=`echo $FULL_VERSION | cut -d. -f1`
44-
minor=`echo $FULL_VERSION | cut -d. -f2`
45-
revision=`echo $FULL_VERSION | cut -d. -f3`
46-
MINOR_VERSION=$(echo "$major.$minor")
47-
echo "::set-output name=FULL_VERSION::${FULL_VERSION}"
48-
echo "::set-output name=MINOR_VERSION::${MINOR_VERSION}"
49-
id: version
14+
get-version:
15+
uses: ./.github/workflows/workflow-get-package-version.yaml
16+
with:
17+
context: "mlflow-server"
18+
package: mlflow
5019

51-
- name: Add tags
52-
run: |
53-
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.FULL_VERSION }}-dev
54-
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.MINOR_VERSION }}-dev
55-
56-
# Push Image to Quay registry
57-
- name: Push To Quay Action
58-
uses: redhat-actions/push-to-registry@v2.7
59-
with:
60-
image: ${{ steps.build_image.outputs.image }}
61-
tags: ${{ steps.build_image.outputs.tags }} ${{ steps.version.outputs.FULL_VERSION }}-dev ${{ steps.version.outputs.MINOR_VERSION }}-dev
62-
registry: ${{ env.REGISTRY }}
63-
username: ${{ secrets.QUAY_USERNAME }}
64-
password: ${{ secrets.QUAY_PASSWORD }}
20+
build:
21+
uses: ./.github/workflows/workflow-build-image.yaml
22+
needs: get-version
23+
with:
24+
registry: quay.io/troyer
25+
image-name: mlflow-server
26+
context: "mlflow-server"
27+
version-tag: ${{ needs.get-version.outputs.package-version }}
28+
tag-suffix: "-dev"
29+
secrets:
30+
registry-username: ${{ secrets.QUAY_USERNAME }}
31+
registry-password: ${{ secrets.QUAY_PASSWORD }}

.github/workflows/build-image.yml

+17-53
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,21 @@ on:
88
- 'mlflow-server/**'
99

1010
jobs:
11-
12-
build:
13-
name: Build Image
14-
runs-on: ubuntu-latest
15-
env:
16-
BASE_IMAGE: 'registry.access.redhat.com/ubi9/python-311:latest'
17-
REGISTRY: quay.io/troyer
18-
IMAGE_NAME: mlflow-server
19-
MAIN_TAG: latest-dev
20-
21-
steps:
22-
23-
- name: Checkout
24-
uses: actions/checkout@v2
25-
26-
# Setup S2i and Build container image
27-
- name: Setup and Build
28-
id: build_image
29-
uses: redhat-actions/s2i-build@v2
30-
with:
31-
path_context: 'mlflow-server'
32-
builder_image: ${{ env.BASE_IMAGE }}
33-
image: ${{ env.IMAGE_NAME }}
34-
tags: ${{ env.MAIN_TAG }}
11+
get-version:
12+
uses: ./.github/workflows/workflow-get-package-version.yaml
13+
with:
14+
context: "mlflow-server"
15+
package: mlflow
3516

36-
- name: Retrieve version
37-
uses: addnab/docker-run-action@v3
38-
with:
39-
image: ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }}
40-
run: |
41-
FULL_VERSION=$(pip show mlflow | grep -i version | awk '{print $2}')
42-
major=`echo $FULL_VERSION | cut -d. -f1`
43-
minor=`echo $FULL_VERSION | cut -d. -f2`
44-
revision=`echo $FULL_VERSION | cut -d. -f3`
45-
MINOR_VERSION=$(echo "$major.$minor")
46-
echo "::set-output name=FULL_VERSION::${FULL_VERSION}"
47-
echo "::set-output name=MINOR_VERSION::${MINOR_VERSION}"
48-
id: version
49-
50-
- name: Add tags
51-
run: |
52-
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:latest
53-
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.FULL_VERSION }}
54-
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.MINOR_VERSION }}
55-
56-
# Push Image to Quay registry
57-
- name: Push To Quay Action
58-
uses: redhat-actions/push-to-registry@v2
59-
with:
60-
image: ${{ steps.build_image.outputs.image }}
61-
tags: ${{ steps.build_image.outputs.tags }} latest ${{ steps.version.outputs.FULL_VERSION }} ${{ steps.version.outputs.MINOR_VERSION }}
62-
registry: ${{ env.REGISTRY }}
63-
username: ${{ secrets.QUAY_USERNAME }}
64-
password: ${{ secrets.QUAY_PASSWORD }}
17+
build:
18+
uses: ./.github/workflows/workflow-build-image.yaml
19+
needs: get-version
20+
with:
21+
registry: quay.io/troyer
22+
image-name: mlflow-server
23+
context: "mlflow-server"
24+
version-tag: ${{ needs.get-version.outputs.package-version }}
25+
tag-suffix: ""
26+
secrets:
27+
registry-username: ${{ secrets.QUAY_USERNAME }}
28+
registry-password: ${{ secrets.QUAY_PASSWORD }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: build-image
2+
on:
3+
workflow_call:
4+
inputs:
5+
registry:
6+
required: true
7+
type: string
8+
image-name:
9+
required: true
10+
type: string
11+
context:
12+
required: true
13+
type: string
14+
version-tag:
15+
required: true
16+
type: string
17+
tag-suffix:
18+
required: true
19+
type: string
20+
base-image:
21+
required: false
22+
type: string
23+
default: 'registry.access.redhat.com/ubi9/python-311:latest'
24+
secrets:
25+
registry-username:
26+
required: true
27+
registry-password:
28+
required: true
29+
outputs:
30+
target_tag:
31+
value: ${{ jobs.build-image.outputs.target_tag }}
32+
33+
jobs:
34+
build-image:
35+
name: Build Image
36+
runs-on: ubuntu-latest
37+
outputs:
38+
target_tag: ${{ steps.tags.outputs.date_tag }}
39+
steps:
40+
41+
- name: Checkout Repository
42+
id: checkout
43+
uses: actions/checkout@v4
44+
45+
- name: downgrade docker
46+
run: |
47+
apt-cache madison docker.io
48+
sudo apt-get remove containerd.io
49+
sudo apt-get install docker.io=24.0.7-0ubuntu2~22.04.1
50+
51+
- name: Generate tags
52+
id: tags
53+
run: |
54+
LATEST_TAG="latest"${{ inputs.tag-suffix }}
55+
echo "latest_tag=$LATEST_TAG" | tee -a $GITHUB_OUTPUT
56+
57+
FULL_VERSION_TAG=${{ inputs.version-tag }}${{ inputs.tag-suffix }}
58+
echo "full_version_tag=$FULL_VERSION_TAG" | tee -a $GITHUB_OUTPUT
59+
60+
major=`echo ${{ inputs.version-tag }} | cut -d. -f1`
61+
minor=`echo ${{ inputs.version-tag }} | cut -d. -f2`
62+
revision=`echo ${{ inputs.version-tag }} | cut -d. -f3`
63+
MINOR_VERSION_TAG=$(echo "$major.$minor")${{ inputs.tag-suffix }}
64+
echo "minor_version_tag=$MINOR_VERSION_TAG" | tee -a $GITHUB_OUTPUT
65+
66+
DATE=$(date -u +'%Y%m%dt%H%Mz')
67+
echo "date=${DATE}" | tee -a $GITHUB_OUTPUT
68+
DATE_TAG=${{ inputs.version-tag }}-${DATE}${{ inputs.tag-suffix }}
69+
echo "date_tag=${DATE_TAG}" | tee -a $GITHUB_OUTPUT
70+
71+
- name: Setup and Build
72+
id: build_image
73+
uses: redhat-actions/s2i-build@v2
74+
with:
75+
path_context: ${{ inputs.context }}
76+
builder_image: ${{ inputs.base-image }}
77+
image: ${{ inputs.image-name }}
78+
tags: ${{ steps.tags.outputs.latest_tag }}
79+
80+
- name: Add tags
81+
run: |
82+
docker tag ${{ inputs.image-name }}:${{ steps.tags.outputs.latest_tag }} ${{ inputs.image-name }}:${{ steps.tags.outputs.full_version_tag }}
83+
docker tag ${{ inputs.image-name }}:${{ steps.tags.outputs.latest_tag }} ${{ inputs.image-name }}:${{ steps.tags.outputs.minor_version_tag }}
84+
docker tag ${{ inputs.image-name }}:${{ steps.tags.outputs.latest_tag }} ${{ inputs.image-name }}:${{ steps.tags.outputs.date_tag }}
85+
docker image ls
86+
87+
- name: Push-Image
88+
uses: redhat-actions/push-to-registry@v2
89+
with:
90+
image: ${{ steps.build_image.outputs.image }}
91+
tags: ${{ steps.tags.outputs.latest_tag }} ${{ steps.tags.outputs.full_version_tag }} ${{ steps.tags.outputs.minor_version_tag }} ${{ steps.tags.outputs.date_tag }}
92+
registry: ${{ inputs.registry }}
93+
username: ${{ secrets.registry-username }}
94+
password: ${{ secrets.registry-password }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: get-package-version
2+
on:
3+
workflow_call:
4+
inputs:
5+
context:
6+
required: true
7+
type: string
8+
package:
9+
required: true
10+
type: string
11+
default: mlflow
12+
outputs:
13+
package-version:
14+
value: ${{ jobs.get-version.outputs.package-version }}
15+
16+
jobs:
17+
get-version:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
package-version: ${{ steps.package-version.outputs.package_version }}
21+
steps:
22+
- name: Checkout Repository
23+
id: checkout
24+
uses: actions/checkout@v4
25+
- name: Setup Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
- name: Install pipenv
30+
run: pip install pipenv
31+
- name: Get package-version
32+
id: package-version
33+
run: |
34+
cd ${{ inputs.context }}
35+
PACKAGE_VERSION=$(pipenv requirements | grep -o -E "${{ inputs.package }}==([0-9]+\.[0-9]+\.[0-9]+)" | cut -d '=' -f 3)
36+
echo "package_version=$PACKAGE_VERSION" | tee -a $GITHUB_OUTPUT

mlflow-server/Pipfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
mlflow = "~=2.12.0"
7+
mlflow = "~=2.16.0"
88
boto3 = "*"
99
psycopg2-binary = "*"
1010
environ-config = "*"

0 commit comments

Comments
 (0)