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 hack/Dockerfile, drop COREOS_ASSEMBLER_GIT #3087

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# kola_temp can include socket files that the build process does not like
/mantle/_kola_temp
/bin
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else ifeq ($(GOARCH),aarch64)
endif

bin/coreos-assembler:
cd cmd && go build -mod vendor -o ../$@
cd cmd && go build $(GOFLAGS) -mod vendor -o ../$@
.PHONY: bin/coreos-assembler

.%.shellchecked: %
Expand Down
4 changes: 0 additions & 4 deletions docs/building-fcos.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ cosa() {
-v ${PWD}:/srv/ --device /dev/kvm --device /dev/fuse \
--tmpfs /tmp -v /var/tmp:/var/tmp --name cosa \
${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/src/config/:ro} \
${COREOS_ASSEMBLER_GIT:+-v $COREOS_ASSEMBLER_GIT/src/:/usr/lib/coreos-assembler/:ro} \
${COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS} \
${COREOS_ASSEMBLER_CONTAINER:-$COREOS_ASSEMBLER_CONTAINER_LATEST} "$@"
rc=$?; set +x; return $rc
Expand All @@ -127,9 +126,6 @@ The environment variables are special purpose:

- `COREOS_ASSEMBLER_CONFIG_GIT`: Allows you to specifiy a local directory that
contains the configs for the ostree you are trying to compose.
- `COREOS_ASSEMBLER_GIT`: Allows you to specify a local directory that contains
the CoreOS Assembler scripts. This allows for quick hacking on the assembler
itself.
- `COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS`: Allows for adding arbitrary mounts
or args to the container runtime.
- `COREOS_ASSEMBLER_CONTAINER`: Allows for overriding the default assembler
Expand Down
20 changes: 10 additions & 10 deletions docs/devel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ guides if you are looking for how to use the CoreOS Assembler.
1. TOC
{:toc}

## Hacking on CoreOS Assembler Scripts
## Hacking on CoreOS Assembler

If you find yourself wanting to hack on CoreOS Assembler itself then you can
easily mount the scripts into the container and prevent rebuilding the
container to test every change. This can be done using the
`COREOS_ASSEMBLER_GIT` env var.
You could rerun `podman build -t localhost/cosa` every time you make
a change, but it'd be very expensive to do so.

```
$ export COREOS_ASSEMBLER_GIT=/path/to/github.com/coreos/coreos-assembler/
$ cosa init https://github.com/coreos/fedora-coreos-config.git
$ cosa fetch && cosa build
```
Instead, you can use [hack/Dockerfile]. There are instructions in that
file. This avoids redownloading and reinstalling all of the
dependency RPMs.

For even faster workflow, you can just bind mount in binaries from
your host or from another container by adding additional bind mounts,
and then copy files into your coreos-assembler container more manually.

## Installing cosa inside an existing container

Expand Down
8 changes: 8 additions & 0 deletions hack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use this for quicker iteration on coros-assembler; from the toplevel run e.g.:
Copy link
Member

Choose a reason for hiding this comment

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

coros-assembler --> coreos-assembler

# podman build -t localhost/cosa -f hack/Dockerfile .
FROM quay.io/coreos-assembler/coreos-assembler:latest
WORKDIR /src
COPY . .
USER root
RUN env GOFLAGS="-buildvcs=false" make && make install
USER builder
4 changes: 2 additions & 2 deletions mantle/build
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ldflags="-X ${REPO_PATH}/version.Version=${version}"
host_build() {
local cmd=$1; shift
echo "Building $cmd"
go build \
go build ${GOFLAGS:-} \
-ldflags "${ldflags}" \
-mod vendor \
-o "bin/$cmd" \
Expand All @@ -41,7 +41,7 @@ cross_static_build() {
mkdir -p "bin/$a"
echo "Building $a/$cmd (static)"
CGO_ENABLED=0 GOARCH=${BASEARCH_TO_GOARCH[$a]} \
go build \
go build ${GOFLAGS:-} \
-ldflags "${ldflags} -extldflags=-static" \
-mod vendor \
-o "bin/$a/$cmd" \
Expand Down