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

build: Add LOCAL_{ADDONS,HARVESTER}_SRC arguments #763

Merged
merged 2 commits into from
Jul 10, 2024
Merged
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
7 changes: 6 additions & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ RUN mkdir /usr/tmp && \
curl ${HELM_URL} | tar xvzf - --strip-components=1 -C /usr/tmp/ && \
mv /usr/tmp/helm /usr/bin/helm

ARG LOCAL_HARVESTER_SRC
ENV HARVESTER_SRC_MOUNT="${LOCAL_HARVESTER_SRC:+-v $LOCAL_HARVESTER_SRC:/go/src/github.com/harvester/harvester}"
ARG LOCAL_ADDONS_SRC
ENV ADDONS_SRC_MOUNT="${LOCAL_ADDONS_SRC:+-v $LOCAL_ADDONS_SRC:/go/src/github.com/harvester/addons}"

# You cloud defined your own rke2 url by setup `RKE2_IMAGE_REPO`
ENV DAPPER_ENV REPO TAG DRONE_TAG DRONE_BRANCH CROSS RKE2_IMAGE_REPO USE_LOCAL_IMAGES BUILD_QCOW DRONE_BUILD_EVENT REMOTE_DEBUG
ENV DAPPER_SOURCE /go/src/github.com/harvester/harvester-installer/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_RUN_ARGS "-v /run/containerd/containerd.sock:/run/containerd/containerd.sock -v harvester-installer-go:/root/go -v harvester-installer-cache:/root/.cache --privileged"
ENV DAPPER_RUN_ARGS "-v /run/containerd/containerd.sock:/run/containerd/containerd.sock -v harvester-installer-go:/root/go -v harvester-installer-cache:/root/.cache ${HARVESTER_SRC_MOUNT} ${ADDONS_SRC_MOUNT} --privileged"

ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ This will:

The built ISO image is written to the `dist/artifacts` directory.

During the build, the harvester source and addons will be pulled
automatically from https://github.com/harvester/harvester.git and
https://github.com/harvester/addons.git resectively. If you would
like to use an exiting local copy of either or both repositories
instead, for example to pick up some development work in progress,
you can do so as follows:

```sh
$ export LOCAL_HARVESTER_SRC=/path/to/local/harvester/repo
$ export LOCAL_ADDONS_SRC=/path/to/local/addons/repo
$ make
```

## Harvester Installation Process

Harvester can be installed by either [booting the Harvester ISO](https://docs.harvesterhci.io/v1.2/install/index/),
Expand Down
4 changes: 2 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cd ${TOP_DIR}
# Pull harvester source and determine harvester version
harvester_path=../harvester
if [ ! -d ${harvester_path} ];then
echo "No existed harvester source. Pulling..."
echo "No existing harvester source. Pulling..."
git clone --branch master --single-branch --depth 1 https://github.com/harvester/harvester.git ../harvester
else
# When building against locally modified harvester source with
Expand All @@ -29,7 +29,7 @@ fi

addons_path=../addons
if [ ! -d ${addons_path} ];then
echo "No existed addons source. Pulling..."
echo "No existing addons source. Pulling..."
git clone --branch main --single-branch --depth 1 https://github.com/harvester/addons.git ../addons
fi

Expand Down
11 changes: 5 additions & 6 deletions scripts/build-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd ${TOP_DIR}

addons_path=../addons
if [ ! -d ${addons_path} ];then
echo "No existed harvester source. Pulling..."
echo "No existing addons source. Pulling..."
git clone --branch main --single-branch --depth 1 https://github.com/harvester/addons.git ../addons
fi

Expand Down Expand Up @@ -39,9 +39,8 @@ mkdir -p ${RANCHERD_IMAGES_DIR}
# Prepare Harvester chart
harvester_path=../harvester
if [ ! -d ${harvester_path} ];then
echo "No existed harvester source. Pulling into /tmp/harvester"
git clone --branch master --single-branch --depth 1 https://github.com/harvester/harvester.git /tmp/harvester
harvester_path=/tmp/harvester
echo "No existing harvester source. Pulling..."
git clone --branch master --single-branch --depth 1 https://github.com/harvester/harvester.git ../harvester
fi

# Revert harvester chart version patch to clean dirty git status
Expand All @@ -52,10 +51,10 @@ reset_charts() {
}

# This must be placed after cloning `harvester/harvester`` in case `make build-bundle` is run directly.
source ${SCRIPTS_DIR}/version-harvester ${TOP_DIR}/../harvester
source ${SCRIPTS_DIR}/version-harvester ${harvester_path}

# Replace harvester chart version
${SCRIPTS_DIR}/patch-harvester ${TOP_DIR}/../harvester
${SCRIPTS_DIR}/patch-harvester ${harvester_path}
# Package harvester chart
harvester_chart_path=${harvester_path}/deploy/charts/harvester
harvester_crd_chart_path=${harvester_path}/deploy/charts/harvester-crd
Expand Down
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd $(dirname $0)/..
# duplicated from scripts/build, so that we can run `make test` standalone
addons_path=../addons
if [ ! -d ${addons_path} ];then
echo "No existed addons source. Pulling..."
echo "No existing addons source. Pulling..."
git clone --branch main --single-branch --depth 1 https://github.com/harvester/addons.git ../addons
fi
cp ${addons_path}/pkg/templates/*.yaml ./pkg/config/templates
Expand Down
Loading