From 384d451410bb8303e81a286fec7875d41bcb8f90 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Thu, 13 Jul 2023 23:13:04 +0200 Subject: [PATCH] Add gitea actions and earthly --- .dockerignore | 1 - .earthlyignore | 1 + .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 27 --------------------------- Earthfile | 23 +++++++++++++++++++++++ csi-spec | 2 +- 6 files changed, 61 insertions(+), 29 deletions(-) delete mode 100644 .dockerignore create mode 100644 .earthlyignore create mode 100644 .github/workflows/ci.yml delete mode 100644 Dockerfile create mode 100644 Earthfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 9f97022..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -target/ \ No newline at end of file diff --git a/.earthlyignore b/.earthlyignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.earthlyignore @@ -0,0 +1 @@ +target/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e893d73 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +# .github/workflows/ci.yml + +name: CI + +on: + push: + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + env: + MY_DOCKER_USERNAME: ${{ secrets.MY_DOCKER_USERNAME }} + MY_DOCKER_PASSWORD: ${{ secrets.MY_DOCKER_PASSWORD }} + FORCE_COLOR: 1 + steps: + - uses: https://github.com/earthly/actions-setup@v1 + with: + version: v0.7.0 + - uses: actions/checkout@v2 + - name: Put back the git branch into git (Earthly uses it for tagging) + run: | + branch="" + if [ -n "$GITHUB_HEAD_REF" ]; then + branch="$GITHUB_HEAD_REF" + else + branch="${GITHUB_REF##*/}" + fi + git checkout -b "$branch" || true + - name: Docker Login + run: docker login git.hibas.dev --username "$MY_DOCKER_USERNAME" --password "$MY_DOCKER_PASSWORD" + - name: Earthly version + run: earthly --version + - name: Run build + run: earthly --push +docker-multi diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index fb9aaf5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM docker.io/rust:1.67.0-slim-bullseye as builder - -RUN apt-get update -yq && \ - apt install -y --no-install-recommends \ - build-essential \ - libssl-dev \ - pkg-config \ - protobuf-compiler \ - libprotobuf-dev - - -WORKDIR /src -COPY . . - -RUN cargo build --release - -FROM docker.io/debian:bullseye-slim - -RUN apt-get update -yq && \ - apt-get install -y --no-install-recommends glusterfs-client htop - -COPY --from=builder /src/target/release/gluster-dir-csi /usr/local/bin/gluster-dir-csi - -ENTRYPOINT ["/usr/local/bin/gluster-dir-csi"] - - - diff --git a/Earthfile b/Earthfile new file mode 100644 index 0000000..f480480 --- /dev/null +++ b/Earthfile @@ -0,0 +1,23 @@ +VERSION 0.7 +FROM rust:1.68 +WORKDIR /rustbuild + +prepare-env: + RUN apt update && apt install -y protobuf-compiler + +docker-multi: + BUILD --platform linux/amd64 --platform linux/arm64 +docker + +build: + FROM +prepare-env + COPY . . + RUN cargo build --release + SAVE ARTIFACT target/release/gluster-dir-csi gluster-dir-csi + +docker: + FROM debian:bullseye-slim + COPY +build/gluster-dir-csi gluster-dir-csi + ENTRYPOINT ["./gluster-dir-csi"] + ARG EARTHLY_TARGET_TAG_DOCKER + ARG TAG=$EARTHLY_TARGET_TAG_DOCKER + SAVE IMAGE --push git.hibas.dev/ops/gluster-dir-csi:$TAG diff --git a/csi-spec b/csi-spec index 1de425b..c7ab2f3 160000 --- a/csi-spec +++ b/csi-spec @@ -1 +1 @@ -Subproject commit 1de425b860085fa0e987d8ece6fe36ed47cdebb3 +Subproject commit c7ab2f379311a9ae234ae42bdfbfebfa9c15e538