Skip to content

Commit

Permalink
Changed folder
Browse files Browse the repository at this point in the history
Test that definitely fails
  • Loading branch information
andrewpatto committed Nov 29, 2023
1 parent ff35c18 commit 4299262
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
uses: AnimMouse/setup-rclone@v1

- run: ./test-go-direct.sh
working-directory: packages/aws-copy-out-sharer/construct/rclone-go-batch-copy-docker-image
working-directory: packages/aws-copy-out-sharer/construct/rclone-batch-copy-docker-image
# - run: pnpm run build
# - run: pnpm run package
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
FROM golang:1.21-alpine as builder

# git is needed for go mod download to work
RUN apk add --no-cache git

WORKDIR /build

RUN go env -w GOPROXY=direct

ADD go.mod go.sum ./

RUN go mod download

ADD *.go ./

RUN env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build rclone-batch.go


FROM rclone/rclone:1.64.2

RUN apk add --no-cache aws-cli tini
# if we want signals to propogate through to the app we need a lightweight initd
RUN apk add --no-cache tini

# this is where rclone binary ends up by default so we will do our work there
WORKDIR /data

# a shell script that allows us to take more batch like input to rclone
COPY rclone-batch-copy.sh /app/
COPY --from=builder /build/rclone-batch ./

ENTRYPOINT ["/sbin/tini", "--", "/bin/sh", "/app/rclone-batch-copy.sh"]
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/rclone-batch"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# rclone-batch

`rclone-batch` is a Go wrapper around the invocation of `rclone`. Why do we need
a wrapper? Well we want to get the statistics output of `rclone` in a way
that we can standardise. Also, we want optionally to be able to send this info
back to the parent AWS ECS task. Furthermore, there are aspects of signal
handling that we want to support for AWS Spot that is not quite the same as
`rclone` out of the box.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ RCLONE_BINARY=$(which rclone)
set -e

# bring in some helpful bash assertions
. test-assert.sh
. test-assert.sh --invariant

# build our rclone batch executable
go build
# build our rclone-batch executable
go build rclone-batch.go

# make a temporary directory for the copy destination
# NOTE: we do not remove this on a EXIT trap as that interferes with the assert.sh exit codes
TEMPD=$(mktemp -d)
if [ ! -e "$TEMPD" ]; then
>&2 echo "Failed to create temp directory"
exit 1
fi

trap 'rm -rf "$TEMPD"' EXIT

#
# test 1 (main case of just copying files)
#
Expand Down Expand Up @@ -79,6 +78,8 @@ assert " cat $TEMPD/result.json | jq -r '.\"1\" | .lastError' " "Skipped due to

rm "$TEMPD/result.json"

assert "5" "10"

#
# end overall testing and set return code
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rclone/rclone:1.64.2

RUN apk add --no-cache aws-cli tini

# a shell script that allows us to take more batch like input to rclone
COPY rclone-batch-copy.sh /app/

ENTRYPOINT ["/sbin/tini", "--", "/bin/sh", "/app/rclone-batch-copy.sh"]

This file was deleted.

0 comments on commit 4299262

Please sign in to comment.