Skip to content

Commit

Permalink
Update official publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstairs committed Oct 6, 2023
1 parent 04472d3 commit 23387e4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer-on-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ if [ -d "/home/.host/.azure/" ]; then
# logged in on the host.
cp -r /home/.host/.azure/ ~/.azure/
fi

make install-cli || true
13 changes: 13 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ jobs:
set -euo pipefail
make -s -j 8
- name: Publish official images
if: startsWith(github.ref, 'refs/tags/')
env:
TYGER_ENVIRONMENT_NAME: ${{ steps.set-variables.outputs.TYGER_ENVIRONMENT_NAME }}
run: |
source /opt/conda/etc/profile.d/conda.sh
conda activate /opt/conda/envs/tyger
set -euo pipefail
cd /workspaces/tyger
make publish-official-images
- name: Build Windows Binaries
run: |
set -euo pipefail
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ install-cli:
tag=$$(git describe --tags 2> /dev/null || echo "0.0.0")
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags="-s -w \
-X main.version=$${tag} \
-X github.com/microsoft/tyger/cli/internal/install.containerRegistry=$${official_container_registry}" \
-X github.com/microsoft/tyger/cli/internal/install.containerRegistry=$${official_container_registry} \
-X github.com/microsoft/tyger/cli/internal/install.containerImageTag=$${tag}" \
./cmd/tyger ./cmd/buffer-sidecar ./cmd/tyger-proxy

cli-ready: install-cli
Expand Down
3 changes: 2 additions & 1 deletion cli/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ builds:
- CGO_ENABLED=0
ldflags:
- -s -w
- -X main.version={{.Tag}}
- -X main.version={{ .Tag }}
- -X github.com/microsoft/tyger/cli/internal/install.containerRegistry={{ .Env.OFFICIAL_CONTAINER_REGISTRY }}
- -X github.com/microsoft/tyger/cli/internal/install.containerImageTag={{ .Tag }}
goos:
- linux
- windows
Expand Down
4 changes: 2 additions & 2 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

WORKDIR /go/src/app
COPY ./go.mod .
ARG COMMIT_HASH="a"
ARG TYGER_VERSION="a"
RUN --mount=type=cache,target=/go/pkg/mod/cache go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.commit=${COMMIT_HASH}" -v -o /go/bin/dist/linux/amd64/buffer-sidecar ./cmd/buffer-sidecar \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.version=${TYGER_VERSION}" -v -o /go/bin/dist/linux/amd64/buffer-sidecar ./cmd/buffer-sidecar \
&& upx /go/bin/dist/linux/amd64/buffer-sidecar

FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 as runtime-builder
Expand Down
4 changes: 3 additions & 1 deletion cli/internal/install/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
)

var (
// set during build but we provide defaults so that there is some value when debugging
// Set during build but we provide defaults so that there is some value when debugging.
// We will need to update these from time to time. Alternatively, you can set the registry
// values using the --set command-line arugment.
containerRegistry string = "tyger.azurecr.io"
containerImageTag string = "v0.1.0-49-g5526c35"
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ repo_root_dir="$(dirname "$0")/.."

function build_and_push() {
echo "Building image ${local_tag}..."
docker build -f "${dockerfile_path}" -t "${local_tag}" --target "${target}" $quiet "${build_context}" >/dev/null
docker build -f "${dockerfile_path}" -t "${local_tag}" --target "${target}" --build-arg TYGER_VERSION="${image_tag}" $quiet "${build_context}" >/dev/null

if [[ -z "${push:-}" ]]; then
return 0
Expand Down

0 comments on commit 23387e4

Please sign in to comment.