Skip to content

Commit

Permalink
Merge v1.5 into main (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
maia-iyer authored Mar 22, 2024
2 parents 8ebb14c + 8f20744 commit 96a3a3b
Show file tree
Hide file tree
Showing 133 changed files with 3,998 additions and 5,046 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,31 @@ jobs:
EOF
- name: Check out repository code
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.2

- name: Install Golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5.0.0
with:
go-version-file: go.mod
check-latest: true
cache: true

- uses: actions/setup-node@v3.7.0
- uses: actions/setup-node@v4.0.2
with:
node-version: '18'

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Download modules
run: go mod download

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
uses: golangci/golangci-lint-action@v4.0.0
with:
version: v1.53
args: --timeout 7m
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/master-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
- v1.4
- v1.5
jobs:
tornjak-build:
runs-on: ubuntu-latest
Expand All @@ -19,10 +19,10 @@ jobs:
EOF
- name: Check out repository code
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.2

- name: Install Golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5.0.0
with:
go-version-file: go.mod
check-latest: true
Expand All @@ -31,21 +31,28 @@ jobs:
- name: Download modules
run: go mod download

- uses: actions/setup-node@v3.7.0
- uses: actions/setup-node@v4.0.2
with:
node-version: '18'

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Download modules
run: go mod download

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
uses: golangci/golangci-lint-action@v4.0.0
with:
version: v1.53
args: --timeout 7m

- name: Log in to GHCR.io
uses: docker/login-action@v2.2.0
uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -58,18 +65,20 @@ jobs:
- name: Set release repo
run: echo "REPO=ghcr.io/${{ github.repository_owner }}" >> $GITHUB_ENV

# build and push images tagged with GITHUB_SHA, version, and latest
- name: Build and push tornjak backend image
run: make release-tornjak-backend

- name: Build and push tornjak frontend image
run: make release-tornjak-frontend
# build and push images tagged with GITHUB_SHA, version
- name: Build and push tornjak images
run: make release-images

- name: Build and push tornjak image (frontend+backend)
run: make release-tornjak
# build and push UBI images
- name: Add ubi prefix
run: echo "IMAGE_TAG_PREFIX=ubi-" >> $GITHUB_ENV
- name: Set frontend Dockerfile
run: echo "DOCKERFILE_FRONTEND=frontend/Dockerfile.frontend-container.ubi" >> $GITHUB_ENV
- name: Set backend Dockerfile
run: echo "DOCKERFILE_BACKEND=Dockerfile.backend-container.ubi" >> $GITHUB_ENV

- name: Build and push tornjak manager image
run: make release-tornjak-manager
- name: Build and push UBI images
run: make release-images

- name: Print job result
run: |
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
vendor

# dependencies
tornjak-frontend/node_modules
tornjak-frontend/.pnp
tornjak-frontend/.pnp.js
frontend/node_modules
frontend/.pnp
frontend/.pnp.js

# testing
tornjak-frontend/coverage
frontend/coverage

# production
tornjak-frontend/build
frontend/build

# misc
.DS_Store
Expand Down
46 changes: 41 additions & 5 deletions Dockerfile.backend-container
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
FROM alpine
# xx is helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.3.0 AS xx

FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.18 AS builder
RUN apk add build-base
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
COPY --link --from=xx / /
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=1

RUN apk add clang lld
RUN make vendor
RUN xx-go --wrap
RUN xx-apk add musl-dev gcc
RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-alpine-linux-musl; fi && \
go build --tags 'sqlite_json' -mod=vendor -ldflags '-s -w -linkmode external -extldflags "-static"' -o bin/tornjak-backend ./cmd/agent/main.go

FROM alpine AS runtime
RUN mkdir -p /opt/spire

WORKDIR /opt/spire
ENTRYPOINT ["/opt/spire/run_backend.sh"]

# Add init
COPY run_backend.sh run_backend.sh
COPY bin/tornjak-backend tornjak-backend
COPY scripts/run_backend.sh run_backend.sh
COPY --from=builder /usr/src/myapp/bin/tornjak-backend tornjak-backend

# add a version link to the image description
ARG version
ARG github_sha
LABEL org.opencontainers.image.description="Tornjak backend ($version): https://github.com/spiffe/tornjak/releases/tag/$version" \
LABEL org.opencontainers.image.description="Tornjak backend ($version) Alpine based image: https://github.com/spiffe/tornjak/releases/tag/$version" \
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"

# Additional labels
LABEL architecture="amd64" \
build-date="" \
description="Tornjak Backend" \
io.k8s.description="Tornjak Backend" \
io.k8s.display-name="tornjak-backend" \
maintainer="" \
name="spiffe/tornjak-backend" \
release="$version" \
summary="Tornjak backend image" \
url="" \
vcs-ref="" \
vcs-type="" \
vendor="" \
version="$version"

# create env. variables with the build details
ENV VERSION=$version
ENV GITHUB_SHA=$github_sha
54 changes: 54 additions & 0 deletions Dockerfile.backend-container.ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# xx is helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.3.0 AS xx

FROM --platform=$BUILDPLATFORM golang:1.20-alpine3.18 AS builder
RUN apk add build-base
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
COPY --link --from=xx / /
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=1

RUN apk add clang lld
RUN make vendor
RUN xx-go --wrap
RUN xx-apk add musl-dev gcc
RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-alpine-linux-musl; fi && \
go build --tags 'sqlite_json' -mod=vendor -ldflags '-s -w -linkmode external -extldflags "-static"' -o bin/tornjak-backend ./cmd/agent/main.go

FROM registry.access.redhat.com/ubi8-micro:latest AS runtime
RUN mkdir -p /opt/spire

WORKDIR /opt/spire
ENTRYPOINT ["/opt/spire/run_backend.sh"]

# Add init
COPY scripts/run_backend.sh run_backend.sh
COPY --from=builder /usr/src/myapp/bin/tornjak-backend tornjak-backend

# add a version link to the image description
ARG version
ARG github_sha
LABEL org.opencontainers.image.description="Tornjak backend ($version) UBI based image: https://github.com/spiffe/tornjak/releases/tag/$version" \
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"
# replace UBI labels
LABEL architecture="amd64" \
build-date="" \
description="Tornjak Backend" \
io.k8s.description="Tornjak Backend" \
io.k8s.display-name="tornjak-backend" \
maintainer="" \
name="spiffe/tornjak-backend" \
release="$version" \
summary="Tornjak backend UBI image" \
url="" \
vcs-ref="" \
vcs-type="" \
vendor="" \
version="$version"

# create env. variables with the build details
ENV VERSION=$version
ENV GITHUB_SHA=$github_sha
35 changes: 0 additions & 35 deletions Dockerfile.tornjak-container

This file was deleted.

Loading

0 comments on commit 96a3a3b

Please sign in to comment.