Skip to content

Update Go version to 1.23.1 (#8073) #228

Update Go version to 1.23.1 (#8073)

Update Go version to 1.23.1 (#8073) #228

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Container trafficserver-alpine
env:
CONTAINER: ghcr.io/${{ github.repository }}/ci/trafficserver-alpine
on:
workflow_dispatch: # run manually
push:
paths:
- .env
- .github/containers/trafficserver-alpine/**
- .github/workflows/container-trafficserver-alpine.yml
pull_request:
paths:
- .env
- .github/containers/trafficserver-alpine/**
- .github/workflows/container-trafficserver-alpine.yml
types: [ opened, reopened, ready_for_review, synchronize ]
jobs:
build:
strategy:
matrix:
platform: [ 'amd64', 'arm64' ]
if: ${{ github.repository_owner == 'apache' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@master
with:
fetch-depth: 5
- name: Check if ATS_VERSION was changed within the last 4 commits
run: |2
set -o errexit -o nounset -o xtrace
ats_line="$(git grep -hn ^ATS_VERSION= .env | cut -d: -f1)"
if [[ -z "$ats_line" ]]; then
echo "No line containing ATS_VERSION in .env was found"
exit 1
fi
if [[ "$(git log HEAD~4..HEAD -L${ats_line},${ats_line}:.env)" != '' ||
"$(git log HEAD~4..HEAD .github/containers/trafficserver-alpine .github/workflows/container-trafficserver-alpine.yml)" != '' ||
${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo SHOULD_RUN=1 >> ${{ github.env }}
fi
- name: Load environment
if: ${{ env.SHOULD_RUN == '1' }}
run: cp .env '${{ github.env }}'
- name: Set image name
run: echo 'IMAGE_NAME=${{ env.CONTAINER }}:${{ env.ATS_VERSION }}-${{ matrix.platform }}' >> '${{ github.env }}'
- name: Install aarch64 emulator
if: ${{ env.SHOULD_RUN == '1' && matrix.platform == 'arm64' }}
run: docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0 --install arm64
- name: Make a Docker Buildx builder
if: ${{ env.SHOULD_RUN == '1' && matrix.platform == 'arm64' }}
run: docker buildx create --name arm64-builder --use
# The push can be split into a separate command once docker can store
# multi-architecture images (docker/roadmap#371).
- name: Build ${{ env.IMAGE_NAME }}
if: ${{ env.SHOULD_RUN == '1' }}
working-directory: .github/containers/trafficserver-alpine
run: docker buildx build --build-arg ATS_VERSION=${{ env.ATS_VERSION }} --tag ${{ env.IMAGE_NAME }} --platform linux/${{ matrix.platform }} --load .
- name: docker login ghcr.io
if: ${{ env.SHOULD_RUN == '1' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push ${{ env.IMAGE_NAME }}
if: ${{ env.SHOULD_RUN == '1' && github.event_name != 'pull_request' }}
run: docker push ${{ env.IMAGE_NAME }}
combine-platforms:
if: ${{ (github.repository_owner == 'apache' && github.event_name != 'pull_request') || github.event_name == 'workflow_dispatch' }}
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@master
with:
fetch-depth: 5
- name: Load environment
run: cp .env '${{ github.env }}'
- name: Set image name
run: |2
echo 'IMAGE_NAME=${{ env.CONTAINER }}' >> '${{ github.env }}' &&
echo 'FULL_IMAGE_NAME=${{ env.CONTAINER }}:${{ env.ATS_VERSION }}' >> '${{ github.env }}'
- name: Create ${{ env.FULL_IMAGE_NAME }} manifest
run: |2
set -o errexit -o xtrace
docker manifest create \
${{ env.FULL_IMAGE_NAME }} \
--amend ${{ env.FULL_IMAGE_NAME }}-amd64 \
--amend ${{ env.FULL_IMAGE_NAME }}-arm64
docker manifest create \
${{ env.IMAGE_NAME }}:latest \
--amend ${{ env.FULL_IMAGE_NAME }}-amd64 \
--amend ${{ env.FULL_IMAGE_NAME }}-arm64
- name: docker login ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push ${{ env.FULL_IMAGE_NAME }}
run: |2
set -o errexit -o xtrace
docker manifest push --purge ${{ env.FULL_IMAGE_NAME }}
docker manifest push --purge ${{ env.IMAGE_NAME }}:latest