Skip to content

Commit

Permalink
fix: adjust git-revision.txt generation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed May 2, 2021
1 parent 119d7b9 commit 6a8b0f2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Save Git revision
run: git rev-parse HEAD > packages/cosmic-swingset/lib/git-revision.txt
run: echo "GIT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Save SDK_VERSION
run: echo "SDK_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Save MODDABLE_COMMIT_HASH
Expand All @@ -23,7 +23,7 @@ jobs:
with:
name: agoric/agoric-sdk
dockerfile: packages/deployment/Dockerfile.sdk
buildargs: MODDABLE_COMMIT_HASH
buildargs: MODDABLE_COMMIT_HASH,GIT_REVISION
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
snapshot: true
Expand Down
1 change: 0 additions & 1 deletion golang/cosmos/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ typings/

# next.js build output
.next
lib/git-revision.txt
/binding.gyp
*-stamp
build/
3 changes: 0 additions & 3 deletions packages/cosmic-swingset/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,3 @@ typings/

# next.js build output
.next
lib/git-revision.txt
/binding.gyp
*-stamp
7 changes: 5 additions & 2 deletions packages/deployment/Dockerfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ RUN go mod download

COPY golang/cosmos ./

COPY packages/cosmic-swingset/lib/*.txt ./
RUN make MOD_READONLY= compile-go
ARG GIT_REVISION
RUN make GIT_REVISION="$GIT_REVISION" MOD_READONLY= compile-go

###############################
# The js build container
Expand Down Expand Up @@ -51,6 +51,9 @@ RUN ln -s /usr/src/agoric-sdk/packages/solo/bin/ag-solo /usr/local/bin/
RUN ln -s /usr/src/agoric-sdk/packages/agoric-cli/bin/agoric /usr/local/bin/
COPY . lib/ag-solo/

ARG GIT_REVISION=unknown
RUN echo "$GIT_REVISION" > /usr/src/agoric-sdk/packages/solo/public/git-revision.txt

# By default, run the daemon with specified arguments.
WORKDIR /root
EXPOSE 1317 9090 26657
Expand Down
7 changes: 4 additions & 3 deletions packages/deployment/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ VERSION := $(shell node -e 'console.log(require("../../package.json").version)'
TAG := $(if $(VERSION),$(VERSION),latest)
MODDABLE_COMMIT_HASH := $(shell git submodule status ../xsnap/moddable | \
sed -ne 's/^.\([^ ]*\).*/\1/p')
GIT_REVISION := $(shell hash=$$(git rev-parse --short HEAD); \
dirty=`git diff --quiet || echo -dirty`; \
echo "$$hash$$dirty")

# Don't push alpha tags as ":$(TAG)".
ifeq ($(TAG),latest)
Expand All @@ -22,10 +25,8 @@ docker-build: docker-build-sdk docker-build-solo \
docker-build-setup docker-build-deployment

docker-build-sdk:
hash=`git rev-parse --short HEAD`; \
dirty=`git diff --quiet || echo -dirty`; \
echo "$$hash$$dirty" > $(SS)lib/git-revision.txt
docker build --build-arg=MODDABLE_COMMIT_HASH=$(MODDABLE_COMMIT_HASH) \
--build-arg=GIT_REVISION=$(GIT_REVISION) \
-t $(REPOSITORY_SDK):$(TAG) --file=Dockerfile.sdk ../..
docker tag $(REPOSITORY_SDK):$(TAG) $(REPOSITORY_SDK):latest

Expand Down
5 changes: 4 additions & 1 deletion packages/solo/src/init-basedir.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export default function initBasedir(
fs.copyFileSync(path.join(`${here}/..`, pj), path.join(dstHtmldir, pj));
const gr = 'git-revision.txt';
try {
fs.copyFileSync(path.join(`${here}/..`, gr), path.join(dstHtmldir, gr));
fs.copyFileSync(
path.join(`${here}/../public`, gr),
path.join(dstHtmldir, gr),
);
} catch (e) {
let revision;
try {
Expand Down

0 comments on commit 6a8b0f2

Please sign in to comment.