diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f61c5da5..c1a9dc8af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,37 +8,64 @@ name: Release # - docker hub # - devenv ECR # - Cloudsmith -#concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ github.event_name == 'pull_request' }} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} on: # Trigger release every monday at midnight for master CI images - #schedule: - # - - # cron: "0 0 * * 1" - # pull_request: + schedule: + - cron: "0 0 * * 1" + pull_request: push: - # branches: - # - master - # - release-** + branches: + - master + - release-** tags: - - "v*" - -defaults: - run: - working-directory: midsommar - + - 'v*' env: GOPRIVATE: github.com/TykTechnologies - VARIATION: inverted + VARIATION: prod-variation DOCKER_BUILD_SUMMARY: false DOCKER_BUILD_RECORD_UPLOAD: false # startsWith covers pull_request_target too BASE_REF: ${{startsWith(github.event_name, 'pull_request') && github.base_ref || github.ref_name}} jobs: - goreleaser: - name: "${{ matrix.golang_cross }}" + ai-studio-frontend-build: + if: github.event.pull_request.draft == false runs-on: ubuntu-latest + outputs: + frontend_built: ${{ steps.build.outputs.frontend_built }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + cache-dependency-path: 'ui/admin-frontend/package-lock.json' + - name: Build frontend + id: build + env: + CI: false + run: | + cd ui/admin-frontend + npm ci + npm run build + echo "frontend_built=true" >> $GITHUB_OUTPUT + - name: Upload frontend build artifacts + uses: actions/upload-artifact@v4 + with: + name: frontend-build + path: ui/admin-frontend/build + retention-days: 1 + goreleaser: + needs: ai-studio-frontend-build + if: github.event.pull_request.draft == false + name: '${{ matrix.golang_cross }}' + runs-on: ubuntu-latest-m permissions: id-token: write # AWS OIDC JWT contents: read # actions/checkout @@ -48,33 +75,31 @@ jobs: golang_cross: - 1.24-bullseye include: - - - golang_cross: 1.24-bullseye - goreleaser: "ci/goreleaser/goreleaser.yml" + - golang_cross: 1.24-bullseye + goreleaser: 'ci/goreleaser/goreleaser.yml' cgo: 1 - rpmvers: "el/7 el/8 el/9 amazon/2 amazon/2023" - debvers: "ubuntu/xenial ubuntu/bionic ubuntu/focal ubuntu/jammy ubuntu/noble debian/jessie debian/buster debian/bullseye debian/bookworm" + rpmvers: 'el/7 el/8 el/9 amazon/2 amazon/2023' + debvers: 'ubuntu/xenial ubuntu/bionic ubuntu/focal ubuntu/jammy ubuntu/noble debian/jessie debian/buster debian/bullseye debian/bookworm debian/trixie' outputs: - tags: ${{ steps.tag_metadata.outputs.tags }} + microgateway_tags: ${{ steps.ci_metadata_microgateway.outputs.tags }} + std_tags: ${{ steps.ci_metadata_std.outputs.tags }} commit_author: ${{ steps.set_outputs.outputs.commit_author}} steps: - - - name: Checkout of midsommar + - name: Checkout of ai-studio uses: actions/checkout@v4 with: fetch-depth: 1 - path: midsommar - - - - name: Checkout langchaingo repository - uses: actions/checkout@v3 + - name: Download frontend build artifacts + uses: actions/download-artifact@v4 with: - repository: lonelycode/langchaingo - path: langchaingo - fetch-depth: 2 - - - - name: Set some outputs for later + name: frontend-build + path: ui/admin-frontend/build + - name: Verify frontend artifacts + run: | + echo "Checking frontend build artifacts..." + ls -la ui/admin-frontend/build || echo "Build directory not found" + find ui/admin-frontend/build -type f | head -20 || echo "No files found" + - name: Set some outputs for later id: set_outputs shell: bash env: @@ -82,19 +107,22 @@ jobs: run: | echo "commit_author=$(git show -s --format='%ae' HEAD)" >> $GITHUB_OUTPUT echo "branch=${HEAD_REF##*/}" >> $GITHUB_OUTPUT - - - uses: docker/setup-qemu-action@v3 - - - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub if: startsWith(github.ref, 'refs/tags') uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - uses: actions/cache@v4 + - name: Login to Cloudsmith + if: startsWith(github.ref, 'refs/tags') + uses: docker/login-action@v3 + with: + registry: docker.tyk.io + username: ${{ secrets.CLOUDSMITH_USERNAME }} + password: ${{ secrets.CLOUDSMITH_API_KEY }} + - uses: actions/cache@v4 with: path: | ~/.cache/go-build @@ -102,49 +130,18 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: "npm" - cache-dependency-path: "**/package-lock.json" - - - - name: Build UI - run: | - cd ui/admin-frontend - echo "Installing dependencies..." - npm ci - echo "Building UI..." - PUBLIC_URL="/" REACT_APP_API_URL="" CI=false npm run build - echo "Checking build output..." - ls -la build - echo "Checking static directory..." - ls -la build/static - echo "Checking index.html..." - cat build/index.html | head -n 5 - echo "Verifying static files..." - find build -type f - cd ../.. - - - - name: Build + - name: Build env: NFPM_PASSPHRASE: ${{ secrets.SIGNING_KEY_PASSPHRASE }} PKG_SIGNING_KEY: ${{ secrets.SIGNING_KEY }} PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} run: | - pwd - ls echo '#!/bin/sh ci/bin/unlock-agent.sh git config --global url."https://${{ secrets.ORG_GH_TOKEN }}@github.com".insteadOf "https://github.com" - git config --global --add safe.directory /go/src/github.com/TykTechnologies/midsommar - goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign' || '' }}' | tee /tmp/build.sh + git config --global --add safe.directory /go/src/github.com/TykTechnologies/ai-studio + goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign,docker' || '--skip=docker' }}' | tee /tmp/build.sh chmod +x /tmp/build.sh - pwd docker run --rm --privileged -e GITHUB_TOKEN=${{ github.token }} \ -e GOPRIVATE=github.com/TykTechnologies \ -e DEBVERS='${{ matrix.debvers }}' \ @@ -154,7 +151,7 @@ jobs: -e GPG_FINGERPRINT=12B5D62C28F57592D1575BD51ED14C59E37DAC20 \ -e PKG_SIGNING_KEY="$PKG_SIGNING_KEY" \ -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN \ - -v ${{github.workspace}}/midsommar:/go/src/github.com/TykTechnologies/midsommar \ + -v ${{github.workspace}}:/go/src/github.com/TykTechnologies/ai-studio \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/.docker/config.json:/root/.docker/config.json \ -e GOCACHE=/cache/go-build \ @@ -162,11 +159,139 @@ jobs: -v ~/go/pkg/mod:/go/pkg/mod \ -v ~/.cache/go-build:/cache/go-build \ -v /tmp/build.sh:/tmp/build.sh \ - -w /go/src/github.com/TykTechnologies/midsommar \ + -w /go/src/github.com/TykTechnologies/ai-studio \ tykio/golang-cross:${{ matrix.golang_cross }} /tmp/build.sh - - - name: Docker metadata for tag push - id: tag_metadata + - name: Verify GoReleaser output + id: verify_dist + run: | + echo "Checking if dist directory was created..." + if [ ! -d "dist" ]; then + echo "ERROR: dist directory not found!" + echo "GoReleaser failed to create dist directory" + echo "Listing workspace contents:" + ls -la + exit 1 + fi + echo "Dist directory exists, checking contents:" + ls -la dist/ + echo "Package files:" + find dist -type f -name "*.deb" -o -name "*.rpm" | head -20 + if [ -z "$(find dist -type f -name "*.deb" -o -name "*.rpm")" ]; then + echo "ERROR: No packages found in dist directory!" + exit 1 + fi + echo "dist_ready=true" >> $GITHUB_OUTPUT + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk + role-session-name: cipush + aws-region: eu-central-1 + # Don't mask to pass it across job boundaries + mask-aws-account-id: false + - uses: aws-actions/amazon-ecr-login@v2 + id: ecr + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + with: + mask-password: 'true' + - name: Docker metadata for microgateway CI + id: ci_metadata_microgateway + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + uses: docker/metadata-action@v5 + with: + images: | + ${{ steps.ecr.outputs.registry }}/ai-studio + flavor: | + latest=false + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha,format=long + type=semver,pattern={{major}},prefix=v + type=semver,pattern={{major}}.{{minor}},prefix=v + type=semver,pattern={{version}},prefix=v + - name: push microgateway image to CI + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + uses: docker/build-push-action@v6 + with: + context: "." + platforms: linux/amd64,linux/arm64,linux/s390x + file: ci/Dockerfile.std + provenance: mode=max + sbom: true + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.ci_metadata_microgateway.outputs.tags }} + labels: ${{ steps.ci_metadata_microgateway.outputs.labels }} + build-args: | + BUILD_PACKAGE_NAME=tyk-ai-microgateway + - name: Docker metadata for microgateway tag push + id: tag_metadata_microgateway + uses: docker/metadata-action@v5 + with: + images: | + tykio/tyk-ai-microgateway + flavor: | + latest=false + prefix=v + tags: | + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}} + labels: | + org.opencontainers.image.title=Tyk AI Microgateway + org.opencontainers.image.description=Tyk AI Microgateway + org.opencontainers.image.vendor=tyk.io + org.opencontainers.image.version=${{ github.ref_name }} + - name: push microgateway image to prod + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + uses: docker/build-push-action@v6 + with: + context: "." + platforms: linux/amd64,linux/arm64,linux/s390x + file: ci/Dockerfile.std + provenance: mode=max + sbom: true + cache-from: type=gha + cache-to: type=gha,mode=max + push: ${{ startsWith(github.ref, 'refs/tags') }} + tags: ${{ steps.tag_metadata_microgateway.outputs.tags }} + labels: ${{ steps.tag_metadata_microgateway.outputs.labels }} + build-args: | + BUILD_PACKAGE_NAME=tyk-ai-microgateway + - name: Docker metadata for std CI + id: ci_metadata_std + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + uses: docker/metadata-action@v5 + with: + images: | + ${{ steps.ecr.outputs.registry }}/ai-studio + flavor: | + latest=false + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha,format=long + type=semver,pattern={{major}},prefix=v + type=semver,pattern={{major}}.{{minor}},prefix=v + type=semver,pattern={{version}},prefix=v + - name: push std image to CI + if: ${{ matrix.golang_cross == '1.24-bullseye' }} + uses: docker/build-push-action@v6 + with: + context: "." + platforms: linux/amd64,linux/arm64,linux/s390x + file: ci/Dockerfile.std + provenance: mode=max + sbom: true + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.ci_metadata_std.outputs.tags }} + labels: ${{ steps.ci_metadata_std.outputs.labels }} + build-args: | + BUILD_PACKAGE_NAME=tyk-ai-studio + - name: Docker metadata for std tag push + id: tag_metadata_std uses: docker/metadata-action@v5 with: images: | @@ -177,24 +302,28 @@ jobs: tags: | type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} - labels: "org.opencontainers.image.title=tyk-ai-studio (distroless) \norg.opencontainers.image.description=Tyk AI Studio\norg.opencontainers.image.vendor=tyk.io\norg.opencontainers.image.version=${{ github.ref_name }}\n" - - - name: push image to prod + labels: | + org.opencontainers.image.title=Tyk AI Studio + org.opencontainers.image.description=Tyk AI Studio + org.opencontainers.image.vendor=tyk.io + org.opencontainers.image.version=${{ github.ref_name }} + - name: push std image to prod if: ${{ matrix.golang_cross == '1.24-bullseye' }} uses: docker/build-push-action@v6 with: - context: "midsommar/dist" - platforms: linux/amd64,linux/arm64 - file: midsommar/ci/Dockerfile.distroless + context: "." + platforms: linux/amd64,linux/arm64,linux/s390x + file: ci/Dockerfile.std provenance: mode=max sbom: true cache-from: type=gha cache-to: type=gha,mode=max push: ${{ startsWith(github.ref, 'refs/tags') }} - tags: ${{ steps.tag_metadata.outputs.tags }} - labels: ${{ steps.tag_metadata.outputs.labels }} - - - name: save deb + tags: ${{ steps.tag_metadata_std.outputs.tags }} + labels: ${{ steps.tag_metadata_std.outputs.labels }} + build-args: | + BUILD_PACKAGE_NAME=tyk-ai-studio + - name: save deb uses: actions/upload-artifact@v4 if: ${{ matrix.golang_cross == '1.24-bullseye' }} with: @@ -204,8 +333,7 @@ jobs: dist/*.deb !dist/*PAYG*.deb !dist/*fips*.deb - - - name: save rpm + - name: save rpm uses: actions/upload-artifact@v4 if: ${{ matrix.golang_cross == '1.24-bullseye' }} with: @@ -215,6 +343,117 @@ jobs: dist/*.rpm !dist/*PAYG*.rpm !dist/*fips*.rpm + test-controller-distros: + if: github.event.pull_request.draft == false + needs: + - goreleaser + runs-on: ubuntu-latest + outputs: + deb: ${{ steps.params.outputs.deb }} + rpm: ${{ steps.params.outputs.rpm }} + steps: + - name: set params + id: params + shell: bash + run: | + # Using default distros (TUI service bypassed) + echo "deb=[\"ubuntu:jammy\", \"ubuntu:focal\", \"debian:bullseye\"]" >> $GITHUB_OUTPUT + echo "rpm=[\"amazonlinux:2\", \"rockylinux:8\", \"rockylinux:9\"]" >> $GITHUB_OUTPUT + upgrade-deb: + services: + httpbin.org: + image: kennethreitz/httpbin + runs-on: ubuntu-latest + needs: + - test-controller-distros + strategy: + fail-fast: true + matrix: + arch: + - amd64 + - arm64 + distro: ${{ fromJson(needs.test-controller-distros.outputs.deb) }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + sparse-checkout: ci + - uses: actions/download-artifact@v4 + with: + name: deb + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: generate dockerfile + run: | + echo 'FROM ${{ matrix.distro }} + ARG TARGETARCH + COPY tyk-ai-studio*_${TARGETARCH}.deb /tyk-ai-studio.deb + RUN apt-get update && apt-get install -y curl + RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-ai-studio/script.deb.sh | bash || echo "Repository setup failed, but continuing" + RUN apt-get install -y tyk-ai-studio=1.0.1 || echo "Previous version not found, testing fresh install" + RUN dpkg -i /tyk-ai-studio.deb + + ' | tee Dockerfile + - name: install on ${{ matrix.distro }} + uses: docker/build-push-action@v6 + with: + context: "." + platforms: linux/${{ matrix.arch }} + build-args: | + RHELARCH=${{ startsWith(matrix.arch, 'arm64') && 'aarch64' || 'x86_64' }} + cache-from: type=gha + cache-to: type=gha,mode=max + file: Dockerfile + push: false + upgrade-rpm: + services: + httpbin.org: + image: kennethreitz/httpbin + runs-on: ubuntu-latest + needs: + - test-controller-distros + strategy: + fail-fast: true + matrix: + arch: + - amd64 + - arm64 + distro: ${{ fromJson(needs.test-controller-distros.outputs.rpm) }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + sparse-checkout: ci + - uses: actions/download-artifact@v4 + with: + name: rpm + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: generate dockerfile + run: | + echo 'FROM ${{ matrix.distro }} + ARG RHELARCH + COPY tyk-ai-studio*.${RHELARCH}.rpm /tyk-ai-studio.rpm + RUN command -v curl || yum install -y curl + RUN command -v useradd || yum install -y shadow-utils + RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-ai-studio/script.rpm.sh | bash || echo "Repository setup failed, but continuing" + RUN yum install -y tyk-ai-studio-1.0.1-1 || echo "Previous version not found, testing fresh install" + RUN curl https://keyserver.tyk.io/tyk.io.rpm.signing.key.2020 -o tyk-ai-studio.key && rpm --import tyk-ai-studio.key + RUN rpm --checksig /tyk-ai-studio.rpm + RUN rpm -Uvh --force /tyk-ai-studio.rpm + + ' | tee Dockerfile + - name: install on ${{ matrix.distro }} + uses: docker/build-push-action@v6 + with: + context: "." + platforms: linux/${{ matrix.arch }} + build-args: | + RHELARCH=${{ startsWith(matrix.arch, 'arm64') && 'aarch64' || 'x86_64' }} + cache-from: type=gha + cache-to: type=gha,mode=max + file: Dockerfile + push: false sbom: needs: goreleaser uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@main diff --git a/ci/Dockerfile.std b/ci/Dockerfile.std index 3d2c21fb0..855d06450 100644 --- a/ci/Dockerfile.std +++ b/ci/Dockerfile.std @@ -1,7 +1,8 @@ # Generated by: gromit policy -FROM debian:bookworm-slim +FROM debian:trixie-slim ARG TARGETARCH +ARG BUILD_PACKAGE_NAME ENV DEBIAN_FRONTEND=noninteractive @@ -12,17 +13,17 @@ RUN apt-get update \ RUN dpkg --purge --force-remove-essential curl ncurses-base || true RUN rm -fv /usr/bin/passwd /usr/sbin/adduser || true +# Comment this to test in dev +COPY dist/${BUILD_PACKAGE_NAME}_*_${TARGETARCH}.deb / +RUN dpkg -i /${BUILD_PACKAGE_NAME}_*_${TARGETARCH}.deb && find / -maxdepth 1 -name "*.deb" -delete + # Clean up caches, unwanted .a and .o files RUN rm -rf /root/.cache \ && apt-get -y autoremove \ && apt-get clean \ - && rm -rf /usr/include/* /var/cache/apt/archives /var/lib/{apt,dpkg,cache,log} \ + && rm -rf /usr/include/* /var/cache/apt/archives /var/lib/apt /var/lib/cache /var/log/* \ && find /usr/lib -type f -name '*.a' -o -name '*.o' -delete -# Comment this to test in dev -COPY *${TARGETARCH}.deb / -RUN rm -f /*fips*.deb && dpkg -i /tyk-ai-studio*${TARGETARCH}.deb && rm /*.deb - ARG PORTS EXPOSE $PORTS @@ -30,6 +31,6 @@ EXPOSE $PORTS WORKDIR /opt/tyk-ai-studio/ # Uncomment this to test in dev -# COPY midsommar . -ENTRYPOINT ["/opt/tyk-ai-studio/tyk-ai-studio" ] +# COPY tyk-ai-studio . +ENTRYPOINT ["/opt/tyk-ai-studio/ai-studio" ] CMD [ "--conf=/opt/tyk-ai-studio/tyk-ai-studio.conf" ] diff --git a/ci/goreleaser/goreleaser.yml b/ci/goreleaser/goreleaser.yml index d9f63db18..f06e1b8aa 100644 --- a/ci/goreleaser/goreleaser.yml +++ b/ci/goreleaser/goreleaser.yml @@ -6,66 +6,108 @@ # - amd64 version: 2 builds: - - id: std-amd64 + - id: microgateway-amd64 # Build from a specific subdirectory (e.g., for multi-module repos like ai-studio's microgateway) + dir: microgateway # Specify the main package path (e.g., ./cmd/microgateway for non-standard entry points) + main: ./cmd/microgateway + env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates + - CC=gcc ldflags: - - -X github.com/TykTechnologies/tyk-ai-studio/main.Version={{.Version}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.Commit={{.FullCommit}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuildDate={{.Date}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuiltBy=goreleaser + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser goos: - linux goarch: - amd64 - binary: tyk-ai-studio - - id: std-arm64 + binary: tyk-ai-microgateway + - id: microgateway-arm64 # Build from a specific subdirectory (e.g., for multi-module repos like ai-studio's microgateway) + dir: microgateway # Specify the main package path (e.g., ./cmd/microgateway for non-standard entry points) + main: ./cmd/microgateway env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates - CC=aarch64-linux-gnu-gcc ldflags: - - -X github.com/TykTechnologies/tyk-ai-studio/main.Version={{.Version}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.Commit={{.FullCommit}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuildDate={{.Date}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuiltBy=goreleaser + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser goos: - linux goarch: - arm64 - binary: tyk-ai-studio - - id: std-s390x + binary: tyk-ai-microgateway + - id: microgateway-s390x # Build from a specific subdirectory (e.g., for multi-module repos like ai-studio's microgateway) + dir: microgateway # Specify the main package path (e.g., ./cmd/microgateway for non-standard entry points) + main: ./cmd/microgateway env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates - CC=s390x-linux-gnu-gcc ldflags: - - -X github.com/TykTechnologies/tyk-ai-studio/main.Version={{.Version}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.Commit={{.FullCommit}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuildDate={{.Date}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuiltBy=goreleaser + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser goos: - linux goarch: - s390x - binary: tyk-ai-studio - - id: fips + binary: tyk-ai-microgateway + - id: std-amd64 + env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates + - CC=gcc ldflags: - - -X github.com/TykTechnologies/tyk-ai-studio/main.Version={{.Version}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.Commit={{.FullCommit}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuildDate={{.Date}} - - -X github.com/TykTechnologies/tyk-ai-studio/main.BuiltBy=goreleaser + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser goos: - linux goarch: - amd64 binary: tyk-ai-studio + - id: std-arm64 + env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates + - CC=aarch64-linux-gnu-gcc + ldflags: + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser + goos: + - linux + goarch: + - arm64 + binary: tyk-ai-studio + - id: std-s390x + env: + - NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates + - CC=s390x-linux-gnu-gcc + ldflags: + - -X main.Version={{.Version}} + - -X main.Commit={{.FullCommit}} + - -X main.BuildDate={{.Date}} + - -X main.BuiltBy=goreleaser + goos: + - linux + goarch: + - s390x + binary: tyk-ai-studio nfpms: - - id: std + - id: microgateway vendor: "Tyk Technologies Ltd" homepage: "https://tyk.io" maintainer: "Tyk " - description: Tyk AI Studio - package_name: tyk-ai-studio + description: Tyk AI Microgateway + package_name: tyk-ai-microgateway file_name_template: "{{ .ConventionalFileName }}" - builds: - - std-amd64 - - std-arm64 - - std-s390x + ids: + - microgateway-amd64 + - microgateway-arm64 + - microgateway-s390x formats: - deb - rpm @@ -78,12 +120,6 @@ nfpms: dst: /lib/systemd/system/tyk-ai-studio.service - src: ci/install/inits/sysv/init.d/tyk-ai-studio dst: /etc/init.d/tyk-ai-studio - - src: ci/install/inits/systemd/default/tyk-ai-studio - dst: /etc/default/tyk-ai-studio - - src: ci/install/data/tyk-ai-studio.conf.example - dst: /opt/tyk-ai-studio/tyk-ai-studio.conf.example - - src: "templates/*" - dst: "/opt/tyk-ai-studio/templates" scripts: preinstall: "ci/install/before_install.sh" postinstall: "ci/install/post_install.sh" @@ -98,15 +134,17 @@ nfpms: signature: key_file: tyk.io.signing.key type: origin - - id: fips + - id: std vendor: "Tyk Technologies Ltd" homepage: "https://tyk.io" maintainer: "Tyk " - description: Tyk AI Portal - package_name: tyk-ai-studio-fips + description: Tyk AI Studio + package_name: tyk-ai-studio file_name_template: "{{ .ConventionalFileName }}" - builds: - - fips + ids: + - std-amd64 + - std-arm64 + - std-s390x formats: - deb - rpm @@ -119,12 +157,6 @@ nfpms: dst: /lib/systemd/system/tyk-ai-studio.service - src: ci/install/inits/sysv/init.d/tyk-ai-studio dst: /etc/init.d/tyk-ai-studio - - src: ci/install/inits/systemd/default/tyk-ai-studio - dst: /etc/default/tyk-ai-studio - - src: ci/install/data/tyk-ai-studio.conf.example - dst: /opt/tyk-ai-studio/tyk-ai-studio.conf.example - - src: "templates/*" - dst: "/opt/tyk-ai-studio/templates" scripts: preinstall: "ci/install/before_install.sh" postinstall: "ci/install/post_install.sh" @@ -140,13 +172,21 @@ nfpms: key_file: tyk.io.signing.key type: origin publishers: - - name: tyk-ee-unstable + - name: microgateway + ids: + - microgateway + env: + - PACKAGECLOUD_TOKEN={{ .Env.PACKAGECLOUD_TOKEN }} + cmd: packagecloud publish --debvers "{{ .Env.DEBVERS }}" --rpmvers "{{ .Env.RPMVERS }}" tyk/tyk-ai-microgateway {{ .ArtifactPath }} + - name: std + ids: + - std env: - PACKAGECLOUD_TOKEN={{ .Env.PACKAGECLOUD_TOKEN }} - cmd: packagecloud publish --debvers "{{ .Env.DEBVERS }}" --rpmvers "{{ .Env.RPMVERS }}" tyk/tyk-ee-unstable {{ .ArtifactPath }} + cmd: packagecloud publish --debvers "{{ .Env.DEBVERS }}" --rpmvers "{{ .Env.RPMVERS }}" tyk/tyk-ai-studio {{ .ArtifactPath }} # This disables archives archives: - - format: binary + - formats: ['binary'] allow_different_binary_count: true checksum: disable: true @@ -154,7 +194,7 @@ release: disable: true github: owner: TykTechnologies - name: tyk-ai-studio + name: ai-studio prerelease: auto draft: true name_template: "{{.ProjectName}}-v{{.Version}}" diff --git a/ci/install/post_install.sh b/ci/install/post_install.sh index 2c153804a..a83b06201 100755 --- a/ci/install/post_install.sh +++ b/ci/install/post_install.sh @@ -112,4 +112,4 @@ esac # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/ it appears that cleanup is not # needed to support systemd and sysv -cleanup +#cleanup