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

Consume nightly built Samba RPMs #50

Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/nightly-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Nightly CI

on:
schedule:
- cron: '0 2 * * *'

jobs:

build-nightly-server:
runs-on: ubuntu-latest
env:
BUILDAH_FORMAT: oci
steps:
- uses: actions/checkout@v2
- name: Build the nightly server image
run: make build-nightly-server

test-nightly-server:
#needs: build-nightly-server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Test the nightly server image
run: make test-nightly-server

push:

# verify it passes build and test first
needs: test-nightly-server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: log in to quay.io
run: podman login -u "${{ secrets.QUAY_USER }}" -p "${{ secrets.QUAY_PASS }}" quay.io
- name: push nightly server image
# note: forcing use of podman here, since we did podman login above
run: make CONTAINER_CMD=podman push-nightly-server
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,49 @@ SERVER_DIR:=images/server
AD_SERVER_DIR:=images/ad-server
CLIENT_DIR:=images/client
SERVER_SRC_FILE:=$(SERVER_DIR)/Dockerfile.fedora
NIGHTLY_SERVER_SRC_FILE:=$(SERVER_DIR)/Dockerfile.nightly
SERVER_SOURCES:=$(SERVER_DIR)/smb.conf
AD_SERVER_SRC_FILE:=$(AD_SERVER_DIR)/Containerfile
AD_SERVER_SOURCES:=$(AD_SERVER_DIR)/populate.sh $(AD_SERVER_DIR)/provision.sh $(AD_SERVER_DIR)/run.sh
CLIENT_SRC_FILE:=$(CLIENT_DIR)/Dockerfile

TAG?=latest
SERVER_NAME:=samba-container:$(TAG)
NIGHTLY_SERVER_NAME:=samba-container:nightly
AD_SERVER_NAME:=samba-ad-container:$(TAG)
CLIENT_NAME:=samba-client-container:$(TAG)

SERVER_REPO_NAME:=quay.io/samba.org/samba-server:$(TAG)
NIGHTLY_SERVER_REPO_NAME:=quay.io/samba.org/samba-server:nightly
AD_SERVER_REPO_NAME:=quay.io/samba.org/samba-ad-server:$(TAG)
CLIENT_REPO_NAME:=quay.io/samba.org/samba-client:$(TAG)

BUILDFILE_SERVER:=.build.server
BUILDFILE_NIGHTLY_SERVER:=.build.nightly-server
BUILDFILE_AD_SERVER:=.build.ad-server
BUILDFILE_CLIENT:=.build.client

build: build-server build-ad-server build-client
build: build-server build-nightly-server build-ad-server build-client
.PHONY: build

build-server: $(BUILDFILE_SERVER)
$(BUILDFILE_SERVER): Makefile $(SERVER_SRC_FILE) $(SERVER_SOURCES)
$(BUILD_CMD) --tag $(SERVER_NAME) --tag $(SERVER_REPO_NAME) -f $(SERVER_SRC_FILE) $(SERVER_DIR)
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(SERVER_NAME) > $(BUILDFILE_SERVER)

build-nightly-server: $(BUILDFILE_NIGHTLY_SERVER)
$(BUILDFILE_NIGHTLY_SERVER): Makefile $(NIGHTLY_SERVER_SRC_FILE) $(SERVER_SOURCES)
$(BUILD_CMD) --tag $(NIGHTLY_SERVER_NAME) --tag $(NIGHTLY_SERVER_REPO_NAME) -f $(NIGHTLY_SERVER_SRC_FILE) $(SERVER_DIR)
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(NIGHTLY_SERVER_NAME) > $(BUILDFILE_NIGHTLY_SERVER)

push-server: build-server
$(PUSH_CMD) $(SERVER_REPO_NAME)
.PHONY: push-server

push-nightly-server: build-nightly-server
$(PUSH_CMD) $(NIGHTLY_SERVER_REPO_NAME)
.PHONY: push-nightly-server

build-ad-server: $(BUILDFILE_AD_SERVER)
$(BUILDFILE_AD_SERVER): Makefile $(AD_SERVER_SRC_FILE) $(AD_SERVER_SOURCES)
$(BUILD_CMD) --tag $(AD_SERVER_NAME) --tag $(AD_SERVER_REPO_NAME) -f $(AD_SERVER_SRC_FILE) $(AD_SERVER_DIR)
Expand All @@ -61,9 +74,13 @@ push-client: build-client
$(PUSH_CMD) $(CLIENT_REPO_NAME)
.PHONY: push-client

test: test-server
test: test-server test-nightly-server
.PHONY: test

test-server: build-server
CONTAINER_CMD=$(CONTAINER_CMD) LOCAL_TAG=$(SERVER_NAME) tests/test-samba-container.sh
.PHONY: test-server

test-nightly-server: build-nightly-server
CONTAINER_CMD=$(CONTAINER_CMD) LOCAL_TAG=$(NIGHTLY_SERVER_NAME) tests/test-samba-container.sh
.PHONY: test-nightly-server
52 changes: 52 additions & 0 deletions images/server/Dockerfile.nightly
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM quay.io/samba.org/sambacc:latest AS builder
ARG SAMBACC_VER=f6480c5861a56ef9d1ebb965aebb14732ec2690c
ARG SAMBACC_REPO=https://github.com/samba-in-kubernetes/sambacc

# the changeset hash on the next line ensures we get a specifc
# version of sambacc. When sambacc actually gets tagged, it should
# be changed to use the tag.
RUN /usr/local/bin/build.sh ${SAMBACC_VER} ${SAMBACC_REPO}

FROM fedora

MAINTAINER John Mulligan <jmulligan@redhat.com>
ENV SAMBACC_VERSION="0.1"

COPY smb.conf /etc/samba/smb.conf
RUN curl http://artifacts.ci.centos.org/gluster/nightly-samba/master/fedora/samba-nightly-master.repo -o /etc/yum.repos.d/samba-nightly-master.repo
RUN dnf install --setopt=install_weak_deps=False -y \
findutils \
python-pip \
python3-jsonschema \
python3-samba \
samba \
samba-client \
samba-winbind \
samba-winbind-clients \
tdb-tools \
ctdb \
&& dnf clean all \
&& cp --preserve=all /etc/ctdb/functions /usr/share/ctdb/functions \
&& cp --preserve=all /etc/ctdb/notify.sh /usr/share/ctdb/notify.sh \
&& true

COPY --from=builder \
/var/tmp/build/sambacc/dist/sambacc-$SAMBACC_VERSION-py3-none-any.whl \
/tmp/sambacc-$SAMBACC_VERSION-py3-none-any.whl
RUN pip install /tmp/sambacc-$SAMBACC_VERSION-py3-none-any.whl \
&& rm -f /tmp/sambacc-$SAMBACC_VERSION-py3-none-any.whl \
&& ln -s /usr/local/share/sambacc/examples/minimal.json /etc/samba/container.json \
&& true


VOLUME ["/share"]

EXPOSE 445

ENV SAMBACC_CONFIG="/etc/samba/container.json:/etc/samba/users.json"
ENV SAMBA_CONTAINER_ID="demo"
ENV SAMBA_SPECIFICS="daemon_cli_debug_output"
ENTRYPOINT ["samba-container"]
CMD ["run", "smbd"]

# vim:set syntax=dockerfile: