diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..dfa31ee --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.idea/** + +.DS_Store +.env + +build + +# iRODS environment files should always be mounted into a container +irods_environment.json +.irodsA diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 9c6b088..620beb4 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -12,113 +12,57 @@ jobs: run: shell: bash -l -e -o pipefail {0} - env: - WSI_CONDA_CHANNEL: "https://dnap.cog.sanger.ac.uk/npg/conda/devel/generic" - CONDA_TEST_ENVIRONMENT: "testenv" - - strategy: - matrix: - include: - # iRODS 4.2.11 clients vs 4.2.11 server - - go: "1.17" - irods: "4.2.11" - server_image: "ghcr.io/wtsi-npg/ub-18.04-irods-4.2.11:latest" - baton: "4.0.0" - - services: - irods: - image: ${{ matrix.server_image }} - ports: - - 1247:1247 - steps: - uses: actions/checkout@v4 - - name: "Set up Go ${{ matrix.go }}" - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - - name: "Initialize Miniconda" - run: | - echo 'source $CONDA/etc/profile.d/conda.sh' >> "$HOME/.bash_profile" - - - name: "Configure Miniconda" - run: | - conda config --prepend pkgs_dirs "$HOME/conda/pkgs" - conda config --prepend envs_dirs "$HOME/conda/envs" - - conda config --set auto_update_conda False - conda config --prepend channels "$WSI_CONDA_CHANNEL" - conda info - - - name: "Install iRODS clients" - run: | - conda create -y -n "$CONDA_TEST_ENVIRONMENT" - conda install -y -n "$CONDA_TEST_ENVIRONMENT" "irods-icommands=${{ matrix.irods }}" - conda install -y -n "$CONDA_TEST_ENVIRONMENT" "baton=${{ matrix.baton }}" - - - name: "Configure iRODS clients" - run: | - conda activate "$CONDA_TEST_ENVIRONMENT" - - mkdir -p "$HOME/.irods" - cat <<'EOF' > "$HOME/.irods/irods_environment.json" - { - "irods_host": "localhost", - "irods_port": 1247, - "irods_user_name": "irods", - "irods_zone_name": "testZone", - "irods_home": "/testZone/home/irods", - "irods_default_resource": "replResc", - "irods_default_hash_scheme": "MD5" - } - EOF - - echo "irods" | script -q -c "iinit" /dev/null - ienv - ils + - name: "Fetch Tags" + # Workaround for https://github.com/actions/checkout/issues/290 + run: git fetch --tags --force - baton-do --version - - - name: "Cache Go modules" - uses: actions/cache@v4 + - name: "Set up Go" + uses: actions/setup-go@v5 with: - path: | - "$HOME/go/pkg/mod" - "$HOME/.cache/go-build" - key: ${{ runner.os }}-key1-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-key1-go- + go-version-file: "go.mod" - - name: "Install test runner" + - name: "Get release variables" run: | - go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo - go get github.com/onsi/gomega/... + echo 'RELEASE_VERSION='$(git describe --always --tags --dirty) >> $GITHUB_ENV + echo 'MASTER_SHA='$(git rev-parse origin/master) >> $GITHUB_ENV + + echo 'GIT_URL='$(git remote get-url origin) >> $GITHUB_ENV + echo 'GIT_COMMIT='$(git log --pretty=format:'%H' -n 1) >> $GITHUB_ENV - - name: "Build distribution" + - name: "Build executables" run: | - conda activate "$CONDA_TEST_ENVIRONMENT" make dist - - name: "Get release version" - run: | - git status - version=$(git describe --always --tags --dirty) - echo "$version" | grep dirty && git diff - - echo VALET_VERSION="version" >> $GITHUB_ENV - - - name: "Get master shasum" - run: | - echo MASTER_SHA=$(git rev-parse origin/master) >> $GITHUB_ENV - - - name: "Create release" + - name: "Create Release" uses: ncipollo/release-action@v1.14.0 with: - name: ${{ env.VALET_VERSION }} + name: ${{ env.RELEASE_VERSION }} prerelease: ${{ !(github.sha == env.MASTER_SHA) }} - artifacts: "*.tar.bz2,*.tar.bz2.sha256" + artifacts: "build/*.tar.bz2,build/*.tar.bz2.sha256" removeArtifacts: true artifactErrorsFailBuild: true generateReleaseNotes: true + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v3 + with: + install: true + + - name: "Login to Docker registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "Build Docker image" + run: | + make docker GITHUB_ACTIONS=${GITHUB_ACTIONS} GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }} + + - name: "Push Docker image" + run: | + docker images + make push GITHUB_ACTIONS=${GITHUB_ACTIONS} GITHUB_REPOSITORY_OWNER=${{ github.repository_owner }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 51eeb02..12e1a06 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -33,9 +33,9 @@ jobs: client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3.1:latest" server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3.1:latest" experimental: false - - irods: "4.3.0" - client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3-nightly:latest" - server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3-nightly:latest" + - irods: "4.3.2" + client_image: "ghcr.io/wtsi-npg/ub-22.04-irods-clients-4.3.2:latest" + server_image: "ghcr.io/wtsi-npg/ub-22.04-irods-4.3.2:latest" experimental: true services: diff --git a/.gitignore b/.gitignore index f65519e..62b33a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -build/** +.DS_store + +# Local environment +.env + +# IntelliJ / GoLand +.idea/ + +# Local outputs +build + +# Local iRODS auth files +.irodsA diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5293d70 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.22.4 AS builder + +WORKDIR /app + +COPY go.mod go.sum /app/ + +RUN go mod download && go mod verify + +COPY . /app + +# Build the binary with CGO disabled because the builder image has a newer GLIBC +# than the iRODS client image. +RUN make build CGO_ENABLED=0 && \ + make install CGO_ENABLED=0 GOBIN=/usr/local/bin/ + +FROM ghcr.io/wtsi-npg/ub-18.04-baton-irods-4.2.11:latest + +COPY --from=builder /usr/local/bin/ /usr/local/bin/ + +USER appuser + +ENTRYPOINT ["/usr/local/bin/valet"] + +CMD ["--version"] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..00e8ccf --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,60 @@ +FROM ghcr.io/wtsi-npg/ub-18.04-baton-irods-4.2.11:latest + +ARG GO_VERSION=1.22.4 + +USER root + +RUN apt-get update && \ + apt-get install -q -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + build-essential \ + ca-certificates \ + curl \ + gcc \ + git \ + make + +# Install the iRODS icommands package because it's useful for interactions with \ +# the server during development +RUN echo "deb [arch=amd64] https://packages.irods.org/apt/ $(lsb_release -sc) main" |\ + tee /etc/apt/sources.list.d/renci-irods.list && \ + apt-get update && \ + apt-get install -q -y --no-install-recommends \ + irods-icommands="4.2.11-1~$(lsb_release -sc)" + +# For development we want to be able to compile and run tests in the presence of iRODS +# clients, it's more practical to use an iRODS client image and install recent Go than +# to build from a recent Go image and install iRODS clients. +# +# For production we can use a standard Go image as a build stage and copy the compiled +# binary into an iRODS client image. +RUN curl -sSL -O "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" + +RUN tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" && \ + rm "go${GO_VERSION}.linux-amd64.tar.gz" + +ENV GOPATH="/home/appuser/go" +ENV PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" + +RUN mkdir -p "$GOPATH" + +WORKDIR /app + +COPY go.mod go.sum /app/ + +RUN go mod download && go mod verify + +COPY . /app + +RUN go install github.com/onsi/ginkgo/v2/ginkgo && \ + go get github.com/onsi/gomega/... && \ + ginkgo version + +RUN chown -R appuser:appuser /app /home/appuser + +USER appuser + +ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"] + +CMD ["/bin/bash", "-c", "sleep infinity"] diff --git a/Makefile b/Makefile index 2760191..ac3bdde 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,43 @@ VERSION := $(shell git describe --always --tags --dirty) ldflags := "-X github.com/wtsi-npg/valet/valet.Version=${VERSION}" +build_args := -a -v -ldflags ${ldflags} build_path = "build/valet-${VERSION}" -.PHONY: build coverage dist install lint test check clean +CGO_ENABLED := 1 +GOARCH := amd64 +GOOS := linux -all: build +ifeq ($(GITHUB_ACTIONS),true) +DOCKER_REGISTRY?=ghcr.io +DOCKER_USER?=$(GITHUB_REPOSITORY_OWNER) +else +DOCKER_REGISTRY?=docker.io +DOCKER_USER?=wsinpg +endif +TAG=${VERSION} -install: - go install -ldflags ${ldflags} +NOW=$(shell date --utc --iso-8601=seconds) + +DOCKER_PREFIX?=$(DOCKER_REGISTRY)/$(DOCKER_USER) +DOCKER_ARGS?=--platform linux/amd64 --progress=plain --rm + +image_names := valet +images := $(addsuffix .$(TAG), $(image_names)) +remote := $(addsuffix .$(TAG).pushed, $(image_names)) + +git_url=$(shell git remote get-url origin) +git_commit=$(shell git log --pretty=format:'%H' -n 1) + +.PHONY: build check clean coverage dist docker install lint push test + +all: build build: mkdir -p ${build_path} - go build -v -ldflags ${ldflags} -o ${build_path}/valet github.com/wtsi-npg/valet + go build ${build_args} -o ${build_path}/valet-${GOARCH} ./main.go + +install: + go install ${build_args} lint: golangci-lint run ./... @@ -24,13 +50,35 @@ test: coverage: ginkgo -r --cover -coverprofile=coverage.out -dist: build test +dist: build cp README.md COPYING ${build_path} - mkdir ${build_path}/scripts + mkdir -p ${build_path}/scripts cp scripts/valet_archive_create.sh ${build_path}/scripts/ - tar -C ./build -cvj -f valet-${VERSION}.tar.bz2 valet-${VERSION} - shasum -a 256 valet-${VERSION}.tar.bz2 > valet-${VERSION}.tar.bz2.sha256 + tar -C ./build -cvj -f ./build/valet-${VERSION}.tar.bz2 valet-${VERSION} + shasum -a 256 ./build/valet-${VERSION}.tar.bz2 > ./build/valet-${VERSION}.tar.bz2.sha256 + +docker: $(images) + +valet.$(TAG): Dockerfile + docker buildx build ${DOCKER_ARGS} \ + --label org.opencontainers.image.title="valet ${VERSION} Linux ${GOARCH}" \ + --label org.opencontainers.image.source=$(git_url) \ + --label org.opencontainers.image.revision=$(git_commit) \ + --label org.opencontainers.image.version=$(TAG) \ + --label org.opencontainers.image.created=$(NOW) \ + --tag $(DOCKER_PREFIX)/valet:$(VERSION) \ + --tag $(DOCKER_PREFIX)/valet:latest \ + --file $< . + touch $@ + +push: $(remote) + +%.$(TAG).pushed: %.$(TAG) + echo docker push $(DOCKER_PREFIX)/$*:$(TAG) + echo docker push $(DOCKER_PREFIX)/$*:latest + touch $@ clean: go clean - rm -rf build/* + $(RM) -r ./build + rm -f $(foreach image_name,$(image_names), $(image_name).*) diff --git a/config/valet.service b/config/valet.service index cd76826..a944acb 100644 --- a/config/valet.service +++ b/config/valet.service @@ -1,11 +1,10 @@ [Unit] Description=The valet data manager service -Documentation=https://github.com/kjsanger/valet +Documentation=https://github.com/wtsi-npg/valet StartLimitBurst=3 [Service] Environment=PATH=/home/{{ valet_user }}/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin -Environment=CONDA_ENV={{ valet_conda_env }} Environment=INSTRUMENT_MODEL={{ valet_instrument }} Environment=INTERVAL={{ valet_interval }} Environment=MAX_PROC={{ valet_max_proc }} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2b0ac9d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +services: + irods-server: + container_name: irods-server + image: "ghcr.io/wtsi-npg/ub-16.04-irods-4.2.7:latest" + ports: + - "127.0.0.1:1247:1247" + - "127.0.0.1:20000-20199:20000-20199" + restart: always + healthcheck: + test: ["CMD", "nc", "-z", "-v", "127.0.0.1", "1247"] + start_period: 30s + interval: 5s + timeout: 10s + retries: 12 + + valet-dev: + build: + context: . + dockerfile: Dockerfile.dev + restart: always + volumes: + - "./tests/.irods:/home/appuser/.irods/" + environment: + IRODS_ENVIRONMENT_FILE: "/home/appuser/.irods/irods_environment.json" + IRODS_PASSWORD: "irods" + depends_on: + irods-server: + condition: service_healthy diff --git a/go.mod b/go.mod index 55d2157..90668df 100644 --- a/go.mod +++ b/go.mod @@ -1,40 +1,40 @@ module github.com/wtsi-npg/valet -go 1.22 +go 1.23 require ( github.com/klauspost/pgzip v1.2.6 - github.com/onsi/ginkgo/v2 v2.17.2 - github.com/onsi/gomega v1.33.1 + github.com/onsi/ginkgo/v2 v2.22.0 + github.com/onsi/gomega v1.36.0 github.com/pkg/errors v0.9.1 - github.com/rs/zerolog v1.32.0 - github.com/spf13/cobra v1.8.0 - github.com/stretchr/testify v1.9.0 - github.com/wtsi-npg/extendo/v2 v2.6.1 + github.com/rs/zerolog v1.33.0 + github.com/spf13/cobra v1.8.1 + github.com/stretchr/testify v1.10.0 + github.com/wtsi-npg/extendo/v2 v2.7.0 github.com/wtsi-npg/fsnotify v1.4.8-0.20190705153444-45ca73e9793a github.com/wtsi-npg/logshim v1.4.0 github.com/wtsi-npg/logshim-zerolog v1.4.0 - golang.org/x/crypto v0.22.0 + golang.org/x/crypto v0.31.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect + github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.15.4 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index cf139c4..e6e2935 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,18 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.15.4 h1:1kn4/7MepF/CHmYub99/nNX8az0IJjfSOU/jbnTVfqQ= @@ -24,50 +24,50 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= -github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= +github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/wtsi-npg/extendo/v2 v2.6.1 h1:mZpw9642jUvNgq6JoEswcJUGLqwAyK2QH2e0eJLR7Dk= -github.com/wtsi-npg/extendo/v2 v2.6.1/go.mod h1:OZNlmNA3evflX9UGQnYMGwV/nQ9MBNMMrG2IAQRtRy8= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/wtsi-npg/extendo/v2 v2.7.0 h1:LGb9QpViRDsfkaKG2h11Q2raUvyU85TlwXCtqhDLBNM= +github.com/wtsi-npg/extendo/v2 v2.7.0/go.mod h1:vcwcCviiA7Jx3jjriV9IkdS6YGzOPReAMxW/Go7kOtI= github.com/wtsi-npg/fsnotify v1.4.8-0.20190705153444-45ca73e9793a h1:LmzJGJXUS8U69eZ08MjwKwii8mos8630pV3aSZRdmc0= github.com/wtsi-npg/fsnotify v1.4.8-0.20190705153444-45ca73e9793a/go.mod h1:/ux2ROeuYmj0JshWH6r5f+gvLIJP2ZbMutVFrW6/8Pg= github.com/wtsi-npg/logshim v1.4.0 h1:5O4urpYxyGbAutS6wci0VSvCCpteVtP9PTIBt0fA0+8= github.com/wtsi-npg/logshim v1.4.0/go.mod h1:VnMVDZWHLrWeEXztdKog4ruSy0RIoaj3tuED9kw+cHc= github.com/wtsi-npg/logshim-zerolog v1.4.0 h1:y5Gz5KuKM4jrUyB5fr+pgtw1B1eEKBAiSB6JzE23PYM= github.com/wtsi-npg/logshim-zerolog v1.4.0/go.mod h1:UvSMVsS8F3amYbWwnf1QNOly2A9/joMREuLPZar1zl0= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh new file mode 100755 index 0000000..4127410 --- /dev/null +++ b/scripts/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +if type "iinit" > /dev/null 2>&1 ; then + if [ -n "$IRODS_PASSWORD" ]; then + echo "Running iinit with the password provided in IRODS_PASSWORD environment variable" + echo "$IRODS_PASSWORD" | iinit + else + echo "No password provided in the IRODS_PASSWORD environment variable. Expecting an iRODS auth file in a mounted volume" + fi +else + echo "iinit not found. Skipping iRODS authentication" +fi + +echo "Running with arguments:" "$@" + +exec "$@" diff --git a/scripts/valet_archive_create.sh b/scripts/valet_archive_create.sh index 41dfe3d..f96c340 100755 --- a/scripts/valet_archive_create.sh +++ b/scripts/valet_archive_create.sh @@ -5,10 +5,7 @@ # https://github.com/wtsi-npg/baton). # # The systemd unit may set the following environment variable to affect valet's -# behaviour. Defaults are specified in the ENVRIRONMENT block below: -# -# CONDA_ROOT : the root of a Miniconda installation -# CONDA_ENV : the name of a Conda environment +# behaviour. Defaults are specified in the ENVIRONMENT block below: # # HOSTNAME : the sequencing instrument hostname # INSTRUMENT_MODEL : the sequencing instrument model (lower case) @@ -44,7 +41,7 @@ TMPDIR=${TMPDIR:-"$SAFE_ROOT/tmp"} set -x -TMPDIR="$TMPDIR" nice valet archive create \ +TMPDIR="$TMPDIR" nice valet-amd64 archive create \ --root "$DATA_ROOT" \ --archive-root "$ARCHIVE_ROOT" \ --exclude "$SAFE_ROOT" \ @@ -53,4 +50,3 @@ TMPDIR="$TMPDIR" nice valet archive create \ --interval "$INTERVAL" \ --delete-on-archive \ --verbose >> "$LOG_FILE" 2>&1 - diff --git a/tests/.irods/irods_environment.json b/tests/.irods/irods_environment.json new file mode 100644 index 0000000..ce1799d --- /dev/null +++ b/tests/.irods/irods_environment.json @@ -0,0 +1,9 @@ +{ + "irods_host": "irods-server", + "irods_port": 1247, + "irods_user_name": "irods", + "irods_zone_name": "testZone", + "irods_home": "/testZone/home/irods", + "irods_default_resource": "replResc", + "irods_default_hash_scheme": "MD5" +} diff --git a/valet/valet_suite_test.go b/valet/valet_suite_test.go index eb6abf5..f44b196 100644 --- a/valet/valet_suite_test.go +++ b/valet/valet_suite_test.go @@ -37,7 +37,7 @@ import ( "github.com/wtsi-npg/valet/valet" ) -var _ = Describe("Find directories)", func() { +var _ = Describe("Find directories", func() { var ( foundDirs []valet.FilePath pathTransform localPathTransform @@ -83,7 +83,7 @@ var _ = Describe("Find directories)", func() { }) }) -var _ = Describe("Find regular files)", func() { +var _ = Describe("Find regular files", func() { var ( foundFiles []valet.FilePath pathTransform localPathTransform