Skip to content

Commit 597e3a5

Browse files
authored
TIKA-4660 Add automated Tika Docker image version bump workflow and upgrade all GitHub Actions (apache#28)
1 parent 48b0b50 commit 597e3a5

File tree

6 files changed

+769
-34
lines changed

6 files changed

+769
-34
lines changed

.github/workflows/helm_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4.1.5
30+
uses: actions/checkout@v6
3131
with:
3232
fetch-depth: 0
3333
- name: Setup Helm Docs

.github/workflows/lint-test.yaml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,13 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4.1.5
30+
uses: actions/checkout@v6
3131
with:
3232
fetch-depth: 0
3333
- name: Set up Helm
34-
uses: azure/setup-helm@v4.2.0
35-
- uses: actions/setup-python@v5.1.0
36-
with:
37-
python-version: '3.x'
38-
check-latest: true
34+
uses: azure/setup-helm@v4
3935
- name: Set up chart-testing
40-
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b
36+
uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0
4137
- name: Run chart-testing (list-changed)
4238
id: list-changed
4339
run: |
@@ -50,32 +46,15 @@ jobs:
5046
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --charts .
5147
shell: bash
5248
- name: Create kind cluster
53-
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde
49+
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
5450
if: steps.list-changed.outputs.changed == 'true'
55-
- name: Uninstall helm-unittest if present
56-
run: |
57-
helm plugin uninstall unittest >/dev/null 2>/dev/null \
58-
|| echo "Failed to uninstall plugin, assuming it's not present."
59-
shell: bash
60-
- name: Install latest helm-unittest
61-
run: |
62-
echo "Installing latest version of helm-unittest"
63-
helm plugin install https://github.com/helm-unittest/helm-unittest >/dev/null 2>/dev/null
64-
shell: bash
65-
- name: Assemble list of chart directories to test
66-
run: |
67-
tr ' ' '\n' <<< . | grep -v '^$' > charts-to-test || true
68-
find . -type f -name 'Chart.yaml' -exec dirname {} \; > all-charts
69-
[ -z . ] && mv all-charts charts-to-test || true
70-
shell: bash
71-
- name: Fetch chart dependencies
51+
- name: Install helm-unittest
7252
run: |
73-
for chart in $(cat charts-to-test); do
74-
helm dependency update "$chart" >/dev/null
75-
done
53+
helm plugin uninstall unittest 2>/dev/null || true
54+
helm plugin install --verify=false https://github.com/helm-unittest/helm-unittest
7655
shell: bash
7756
- name: Run unit tests
78-
run: helm unittest --color $(cat charts-to-test)
57+
run: helm unittest .
7958
shell: bash
8059
- name: Run chart-testing (install)
8160
if: steps.list-changed.outputs.changed == 'true'

.github/workflows/pluto.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,25 @@ jobs:
2626
pluto_detect:
2727
runs-on: ubuntu-latest
2828
env:
29-
PLUTO_VERSION: 5.19.1
29+
PLUTO_VERSION: 5.22.7
3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v4.1.5
32+
uses: actions/checkout@v6
33+
- name: Cache Pluto
34+
id: cache-pluto
35+
uses: actions/cache@v5
36+
with:
37+
path: /usr/local/bin/pluto
38+
key: pluto-${{ env.PLUTO_VERSION }}-linux-amd64
3339
- name: Download Pluto
40+
if: steps.cache-pluto.outputs.cache-hit != 'true'
3441
run: |
3542
wget https://github.com/FairwindsOps/pluto/releases/download/v${{ env.PLUTO_VERSION }}/pluto_${{ env.PLUTO_VERSION }}_linux_amd64.tar.gz -O - | tar -xz
3643
mv pluto /usr/local/bin/pluto
3744
chmod +x /usr/local/bin/pluto
3845
shell: bash
3946
- name: Set up Helm
40-
uses: azure/setup-helm@v4.2.0
47+
uses: azure/setup-helm@v4
4148
- name: verify helm chart
4249
run: |
4350
helm template . | pluto detect -omarkdown - >> $GITHUB_STEP_SUMMARY
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: Update Tika Docker Image Version
17+
18+
on:
19+
schedule:
20+
- cron: '0 6 * * *' # daily at 06:00 UTC
21+
workflow_dispatch:
22+
inputs:
23+
tag:
24+
description: 'Tika Docker image tag (e.g. 3.3.0.0-full)'
25+
required: false
26+
27+
permissions:
28+
contents: write
29+
pull-requests: write
30+
31+
jobs:
32+
update-tika-version:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v6
37+
38+
- name: Determine new tag
39+
id: new-tag
40+
run: |
41+
if [ -n "${{ github.event.inputs.tag }}" ]; then
42+
NEW_TAG="${{ github.event.inputs.tag }}"
43+
else
44+
NEW_TAG=$(curl -s "https://hub.docker.com/v2/repositories/apache/tika/tags?page_size=10&ordering=-last_updated" \
45+
| jq -r '.results[].name' \
46+
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-full$' \
47+
| sort -V \
48+
| tail -1)
49+
fi
50+
51+
if [ -z "$NEW_TAG" ]; then
52+
echo "::error::Could not determine the latest Tika Docker image tag"
53+
exit 1
54+
fi
55+
56+
echo "tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
57+
shell: bash
58+
59+
- name: Read current appVersion
60+
id: current
61+
run: |
62+
CURRENT=$(grep '^appVersion:' Chart.yaml | sed 's/appVersion: *"\(.*\)"/\1/')
63+
echo "tag=$CURRENT" >> "$GITHUB_OUTPUT"
64+
shell: bash
65+
66+
- name: Compare versions
67+
id: compare
68+
run: |
69+
if [ "${{ steps.new-tag.outputs.tag }}" = "${{ steps.current.outputs.tag }}" ]; then
70+
echo "No update needed. Current version (${{ steps.current.outputs.tag }}) is already the latest."
71+
echo "updated=false" >> "$GITHUB_OUTPUT"
72+
else
73+
echo "Update available: ${{ steps.current.outputs.tag }} -> ${{ steps.new-tag.outputs.tag }}"
74+
echo "updated=true" >> "$GITHUB_OUTPUT"
75+
fi
76+
shell: bash
77+
78+
- name: Derive chart version
79+
if: steps.compare.outputs.updated == 'true'
80+
id: chart-version
81+
run: |
82+
CHART_VERSION=$(echo "${{ steps.new-tag.outputs.tag }}" | sed 's/-full$//' | sed 's/\.[0-9]*$//')
83+
echo "version=$CHART_VERSION" >> "$GITHUB_OUTPUT"
84+
shell: bash
85+
86+
- name: Update version files
87+
if: steps.compare.outputs.updated == 'true'
88+
run: |
89+
NEW_TAG="${{ steps.new-tag.outputs.tag }}"
90+
CHART_VERSION="${{ steps.chart-version.outputs.version }}"
91+
OLD_TAG="${{ steps.current.outputs.tag }}"
92+
93+
sed -i "s/^appVersion: \".*\"/appVersion: \"${NEW_TAG}\"/" Chart.yaml
94+
sed -i "s/^version: \".*\"/version: \"${CHART_VERSION}\"/" Chart.yaml
95+
96+
sed -i "s/tag: '.*'/tag: '${NEW_TAG}'/" values.yaml
97+
98+
sed -i "s/\"default\": \"${OLD_TAG}\"/\"default\": \"${NEW_TAG}\"/" values.schema.json
99+
shell: bash
100+
101+
- name: Create Pull Request
102+
if: steps.compare.outputs.updated == 'true'
103+
uses: peter-evans/create-pull-request@v8
104+
with:
105+
token: ${{ secrets.GITHUB_TOKEN }}
106+
branch: auto-update/tika-${{ steps.new-tag.outputs.tag }}
107+
commit-message: "Bump Apache Tika Docker image to ${{ steps.new-tag.outputs.tag }}"
108+
title: "Bump Apache Tika Docker image to ${{ steps.new-tag.outputs.tag }}"
109+
body: |
110+
Automated version bump of the Apache Tika Docker image.
111+
112+
**Old version:** `${{ steps.current.outputs.tag }}`
113+
**New version:** `${{ steps.new-tag.outputs.tag }}`
114+
**Chart version:** `${{ steps.chart-version.outputs.version }}`
115+
116+
[View available tags on Docker Hub](https://hub.docker.com/r/apache/tika/tags)
117+
labels: |
118+
dependencies
119+
automated

tests/ingress_test.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ templates:
2020
- ingress.yaml
2121
tests:
2222
- it: should pass
23+
capabilities:
24+
majorVersion: 1
25+
minorVersion: 20
2326
set:
2427
image.tag: latest
2528
ingress.enabled: true
26-
Capabilities.KubeVersion.GitVersion: 1.20
2729
ingress.tls:
2830
- secretName: chart-example-tls
2931
hosts:

0 commit comments

Comments
 (0)