Skip to content
name: Build Docker Images and Push to Image Registry
on:
push:
tags:
- "v*.*.*"
workflow_dispatch: ~
jobs:
# build-controller-image:
# runs-on: ubuntu-latest
# environment:
# name: image-registry-controller
# env:
# CONTROLLER_IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
# CONTROLLER_IMAGE_NAME: ${{ vars.CONTROLLER_IMAGE_NAME || 'higress/higress' }}
# steps:
# - name: "Checkout ${{ github.ref }}"
# uses: actions/checkout@v3
# with:
# fetch-depth: 1
#
# - name: Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: false
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# swap-storage: true
#
# - name: "Setup Go"
# uses: actions/setup-go@v3
# with:
# go-version: 1.19
#
# - name: Setup Golang Caches
# uses: actions/cache@v3
# with:
# path: |-
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-go
#
# - name: Setup Submodule Caches
# uses: actions/cache@v3
# with:
# path: |-
# envoy
# istio
# .git/modules
# key: ${{ runner.os }}-submodules-new-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-submodules-new
#
# - name: Calculate Docker metadata
# id: docker-meta
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ env.CONTROLLER_IMAGE_REGISTRY }}/${{ env.CONTROLLER_IMAGE_NAME }}
# tags: |
# type=sha
# type=ref,event=tag
# type=semver,pattern={{version}}
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
#
# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: ${{ env.CONTROLLER_IMAGE_REGISTRY }}
# username: ${{ secrets.REGISTRY_USERNAME }}
# password: ${{ secrets.REGISTRY_PASSWORD }}
#
# - name: Build Docker Image and Push
# run: |
# GOPROXY="https://proxy.golang.org,direct" make docker-buildx-push
# BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/higress"
# readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
# for image in ${IMAGES[@]}; do
# echo "Image: $image"
# docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
# done
#
# build-pilot-image:
# runs-on: ubuntu-latest
# environment:
# name: image-registry-pilot
# env:
# PILOT_IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
# PILOT_IMAGE_NAME: ${{ vars.PILOT_IMAGE_NAME || 'higress/pilot' }}
# steps:
# - name: "Checkout ${{ github.ref }}"
# uses: actions/checkout@v3
# with:
# fetch-depth: 1
#
# - name: Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: false
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# swap-storage: true
#
# - name: "Setup Go"
# uses: actions/setup-go@v3
# with:
# go-version: 1.19
#
# - name: Setup Golang Caches
# uses: actions/cache@v3
# with:
# path: |-
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-go
#
# - name: Setup Submodule Caches
# uses: actions/cache@v3
# with:
# path: |-
# envoy
# istio
# .git/modules
# key: ${{ runner.os }}-submodules-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-submodules-new
#
# - name: Calculate Docker metadata
# id: docker-meta
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ env.PILOT_IMAGE_REGISTRY }}/${{ env.PILOT_IMAGE_NAME }}
# tags: |
# type=sha
# type=ref,event=tag
# type=semver,pattern={{version}}
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
#
# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: ${{ env.PILOT_IMAGE_REGISTRY }}
# username: ${{ secrets.REGISTRY_USERNAME }}
# password: ${{ secrets.REGISTRY_PASSWORD }}
#
# - name: Build Pilot-Discovery Image and Push
# run: |
# GOPROXY="https://proxy.golang.org,direct" make build-istio
# BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/pilot"
# readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
# for image in ${IMAGES[@]}; do
# echo "Image: $image"
# docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
# done
#
#
# build-gateway-image:
# runs-on: ubuntu-latest
# environment:
# name: image-registry-pilot
# env:
# GATEWAY_IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
# GATEWAY_IMAGE_NAME: ${{ vars.GATEWAY_IMAGE_NAME || 'higress/gateway' }}
# steps:
# - name: "Checkout ${{ github.ref }}"
# uses: actions/checkout@v3
# with:
# fetch-depth: 1
#
# - name: Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: false
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# swap-storage: true
#
# - name: "Setup Go"
# uses: actions/setup-go@v3
# with:
# go-version: 1.19
#
# - name: Setup Golang Caches
# uses: actions/cache@v3
# with:
# path: |-
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-go
#
# - name: Setup Submodule Caches
# uses: actions/cache@v3
# with:
# path: |-
# envoy
# istio
# .git/modules
# key: ${{ runner.os }}-submodules-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-submodules-new
#
# - name: Calculate Docker metadata
# id: docker-meta
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ env.GATEWAY_IMAGE_REGISTRY }}/${{ env.GATEWAY_IMAGE_NAME }}
# tags: |
# type=sha
# type=ref,event=tag
# type=semver,pattern={{version}}
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
#
# - name: Login to Docker Registry
# uses: docker/login-action@v2
# with:
# registry: ${{ env.GATEWAY_IMAGE_REGISTRY }}
# username: ${{ secrets.REGISTRY_USERNAME }}
# password: ${{ secrets.REGISTRY_PASSWORD }}
#
# - name: Build Gateway Image and Push
# run: |
# GOPROXY="https://proxy.golang.org,direct" make build-gateway
# BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/proxyv2"
# readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
# for image in ${IMAGES[@]}; do
# echo "Image: $image"
# docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
# done
build-gateway-image:
runs-on: ubuntu-latest
environment:
name: image-registry-wasm-go-plugins
env:
PLUGIN_IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
steps:
- name: "Checkout ${{ github.ref }}"
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{ env.PLUGIN_IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Plugin Image and Push
working-directory: plugins/wasm-go
run: |
PLUGIN_VERSION="${{ github.ref_name }}"
PLUGIN_DIRS=$(basename -a plugins/wasm-go/extensions/*)
for plugin in ${PLUGIN_DIRS[@]}; do
echo "Building and pushing image for plugin: ${plugin}"
GOPROXY="https://proxy.golang.org,direct" \
REGISTRY="${PLUGIN_IMAGE_REGISTRY}/plugins" \
PLUGIN_NAME="${plugin}" PLUGIN_VERSION="${PLUGIN_VERSION}" make build-image
done