Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logic to build image with custom gocql version #143

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.21

ARG version
ARG fork
ENV version=${version}
ENV fork=${fork:-scylladb/scylla-bench}

RUN apt-get update && apt-get -y install --no-install-recommends unzip curl && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -Lo sb.zip https://github.com/${fork}/archive/refs/${version}.zip && \
unzip sb.zip && \
cd ./scylla-bench-* && \
GO111MODULE=on go install . && \
cd .. && \
rm -f sb.zip
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Makefile

# Default variables
DOCKERFILE_PATH ?= Dockerfile
SCYLLA_BENCH_VERSION ?= tags/v0.1.22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it is good idea to have a default for the scylla-bench version.
It is easy to get unexpected s-b version in a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to get the latest easily?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no latest tag.
I made this statement assuming this workflow is going to be used with specific PRs.
So, if you are sure that specific PRs won't get problems having this default then ok, keep it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is going to be used with specific PRs, I just thought that in most cases we want to use the latest tag and it would be easier to update it in one place here than in every place that is going to use this Makefile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"master" branch should solve that need, if I understood everything correctly.

GOCQL_REPO ?= github.com/scylladb/gocql

build-image-with-custom-gocql-commit:
@echo "Replacing gocql with commit ID ${GOCQL_COMMIT_ID}"
go mod edit -replace github.com/gocql/gocql=${GOCQL_REPO}@${GOCQL_COMMIT_ID}
sylwiaszunejko marked this conversation as resolved.
Show resolved Hide resolved
go mod tidy

@echo "Building Docker image with tag ${IMAGE_TAG}"
docker build -f ${DOCKERFILE_PATH} . -t ${IMAGE_TAG} --build-arg version=${SCYLLA_BENCH_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use docker, run whole thing plain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCT uses scylla-bench as a docker image.
And the original idea, as I understand, is to run SCT longevities: https://github.com/scylladb/gocql/pull/260/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how
Don't I have to use docker build to then run docker push and actually push docker image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCT uses scylla-bench as a docker image. And the original idea, as I understand, is to run SCT longevities: https://github.com/scylladb/gocql/pull/260/files

exactly