Skip to content

Commit

Permalink
Change submodule rather than whole new checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource committed Dec 6, 2022
1 parent 9f4e454 commit d2ce63b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/docker-build-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,22 @@ jobs:
submodules: "true"

- name: Checkout temporal server repository
uses: actions/checkout@v3
with:
repository: ${{ inputs.temporal-server-repo-path }}
path: temporal-server-checkedout
ref: ${{ inputs.temporal-server-repo-ref }}
# I have no idea why all this hullabaloo with explicitly fetching the other repo's branch
# is necessary, you should be able to just `git submodule update --init` and have it work,
# but possibly something about the barebones nature of the checkout action makes that not
# work.
run: |
git submodule set-url temporal ${{ format('https://github.com/{0}', inputs.temporal-server-repo-path) }}
git submodule set-branch --branch ${{ inputs.temporal-server-repo-ref }} -- temporal
git submodule sync
cat .gitmodules
echo "Updating temporal submodule"
cd temporal
git remote show origin
git fetch --depth 1 origin ${{ inputs.temporal-server-repo-ref }}:refs/remotes/origin/${{ inputs.temporal-server-repo-ref }}
git checkout origin/${{ inputs.temporal-server-repo-ref }}
cd ..
git submodule status temporal
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -53,9 +64,6 @@ jobs:
with:
context: .
file: server.Dockerfile
build-args: |
TEMPORAL_REPO_PATH=temporal-server-checkedout
GOFLAGS=-buildvcs=false
tags: localhost:5000/temporal-server:latest
push: true

Expand All @@ -65,9 +73,7 @@ jobs:
context: .
file: admin-tools.Dockerfile
build-args: |
TEMPORAL_REPO_PATH=temporal-server-checkedout
SERVER_IMAGE=localhost:5000/temporal-server:latest
GOFLAGS=-buildvcs=false
tags: localhost:5000/temporal-admin-tools:latest
push: true

Expand All @@ -85,7 +91,7 @@ jobs:
# Upload-artifact has no good way to flatten paths, so we need to move the compose file
# to avoid some disgustingly long inner path inside the artifact zip.
- name: Copy compose file
run: cp ./temporal-server-checkedout/develop/docker-compose/docker-compose.yml /tmp/docker-compose.yml
run: cp ./temporal/develop/docker-compose/docker-compose.yml /tmp/docker-compose.yml

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
10 changes: 5 additions & 5 deletions admin-tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ ARG GOPROXY

##### Temporal Admin Tools builder #####
FROM ${BASE_BUILDER_IMAGE} AS admin-tools-builder
ARG TEMPORAL_REPO_PATH=temporal
ARG GOFLAGS
ENV GOFLAGS ${GOFLAGS}

WORKDIR /home/builder

# cache Temporal packages as a docker layer
COPY ./${TEMPORAL_REPO_PATH}/go.mod ./${TEMPORAL_REPO_PATH}/go.sum ./temporal/
COPY ./temporal/go.mod ./temporal/go.sum ./temporal/
RUN (cd ./temporal && go mod download all)

# build
COPY ./${TEMPORAL_REPO_PATH} ./temporal
COPY ./temporal ./temporal
# Git info is needed for Go build to attach VCS information properly
COPY ./.git ./.git
COPY ./.gitmodules ./.gitmodules
RUN (cd ./temporal && make temporal-cassandra-tool temporal-sql-tool tdbg)


Expand Down
10 changes: 5 additions & 5 deletions server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ ARG BASE_SERVER_IMAGE=temporalio/base-server:1.12.0

##### Builder #####
FROM ${BASE_BUILDER_IMAGE} AS temporal-builder
ARG TEMPORAL_REPO_PATH=temporal
ARG GOFLAGS
ENV GOFLAGS ${GOFLAGS}

WORKDIR /home/builder

# cache Temporal packages as a docker layer
COPY ./${TEMPORAL_REPO_PATH}/go.mod ./${TEMPORAL_REPO_PATH}/go.sum ./temporal/
COPY ./temporal/go.mod ./temporal/go.sum ./temporal/
RUN (cd ./temporal && go mod download all)

# cache tctl packages as a docker layer
Expand All @@ -19,7 +16,10 @@ RUN (cd ./tctl && go mod download all)

# build
COPY ./tctl ./tctl
COPY ./${TEMPORAL_REPO_PATH} ./temporal
COPY ./temporal ./temporal
# Git info is needed for Go build to attach VCS information properly
COPY ./.git ./.git
COPY ./.gitmodules ./.gitmodules
RUN (cd ./temporal && make temporal-server)
RUN (cd ./tctl && make build)

Expand Down

0 comments on commit d2ce63b

Please sign in to comment.