Skip to content

Commit

Permalink
Add EE plugin compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
buger committed Oct 17, 2024
1 parent 914db86 commit e1cbaf6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/plugin-compiler-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- master
- release-**
tags:
- 'v*'
- "v*"

env:
GOLANG_CROSS: 1.22-bullseye
Expand Down Expand Up @@ -80,3 +80,35 @@ jobs:
BASE-IMAGE=tykio/golang-cross:${{ env.GOLANG_CROSS }}
GITHUB_SHA=${{ github.sha }}
GITHUB_TAG=${{ github.ref_name }}
- name: Set docker metadata EE
id: set-metadata
uses: docker/metadata-action@v4
with:
images: |
tykio/tyk-plugin-compiler-ee,enable=${{ startsWith(github.ref, 'refs/tags') }}
${{ steps.login-ecr.outputs.registry }}/tyk-plugin-compiler-ee
labels: |
org.opencontainers.image.title=tyk-plugin-compiler-ee
org.opencontainers.image.description=Plugin compiler for the Tyk API Gateway Enterprise Edition
tags: |
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern={{raw}}
type=sha,format=long
- name: Build and push to dockerhub/ECR EE
uses: docker/build-push-action@v4
with:
context: .
file: ci/images/plugin-compiler/Dockerfile
platforms: linux/amd64
push: true
labels: ${{ steps.set-metadata.outputs.labels }}
tags: ${{ steps.set-metadata.outputs.tags }}
build-args: |
BASE-IMAGE=tykio/golang-cross:${{ env.GOLANG_CROSS }}
GITHUB_SHA=${{ github.sha }}
GITHUB_TAG=${{ github.ref_name }}
BUILD_TAG=ee
3 changes: 3 additions & 0 deletions ci/images/plugin-compiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ ARG GITHUB_TAG
ENV GITHUB_SHA=${GITHUB_SHA}
ENV GITHUB_TAG=${GITHUB_TAG}

ARG BUILD_TAG
ENV BUILD_TAG=${BUILD_TAG}

COPY ci/images/plugin-compiler/data/build.sh /build.sh
RUN chmod +x /build.sh

Expand Down
8 changes: 6 additions & 2 deletions ci/images/plugin-compiler/data/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GATEWAY_VERSION=$(echo $GITHUB_TAG | perl -n -e'/v(\d+).(\d+).(\d+)/'' && print
#
# If GOOS and GOARCH are not set, it will build `{plugin_name}`.
#
# Example command: ./build.sh
# Example command: ./build.sh
# Example output: tyk-extras_5.0.0_linux_amd64.so

plugin_name=$1
Expand Down Expand Up @@ -145,7 +145,11 @@ if [[ "$DEBUG" == "1" ]] ; then
git diff --cached
fi

CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -o $plugin_name
if [ -n "$BUILD_TAG" ]; then
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -tags=$BUILD_TAG -o $plugin_name
else
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -o $plugin_name
fi

set +x

Expand Down

0 comments on commit e1cbaf6

Please sign in to comment.