Skip to content
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
34 changes: 34 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
version: 2.1

orbs:
cs: chainstack/platform@12.0.0

filters: &filters-tag
tags:
only: /.*/
branches:
ignore: /.*/

workflows:
storj-push:
unless: << pipeline.git.tag >>
jobs:
- cs/build-image:
context: "dev.chainstack | GCP"
tag: "'<< pipeline.number >>'"
Comment on lines +15 to +19
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Avoid quoting the evaluated tag; ensure non-tag workflow won’t run on tags.

  • tag: "'<< pipeline.number >>'" will produce literal quotes in the tag.
  • Relying on unless: << pipeline.git.tag >> for gating can be brittle.

Apply this diff:

-    unless: << pipeline.git.tag >>
+    unless: << pipeline.git.tag >>
     jobs:
-    - cs/build-image:
+    - cs/build-image:
         context: "dev.chainstack | GCP"
-        tag: "'<< pipeline.number >>'"
+        tag: << pipeline.number >>

Also add a branch-only filter to ensure this workflow never runs on tags:

   storj-push:
     unless: << pipeline.git.tag >>
     jobs:
     - cs/build-image:
+        filters:
+          tags:
+            ignore: /.*/
+          branches:
+            only: /.*/

🏁 Script executed:

#!/bin/bash
set -euo pipefail
file=".circleci/config.yml"
if [ ! -f "$file" ]; then
  echo "MISSING $file"
  exit 0
fi

echo "=== .circleci/config.yml (with line numbers) ==="
awk '{printf("%4d: %s\n", NR, $0)}' "$file"
echo

echo "=== Relevant lines (pipeline.git.tag, << pipeline.number >>, cs/build-image, tag:, unless:, filters:) ==="
awk '{
  if ($0 ~ /pipeline\.git\.tag/ || $0 ~ /<<\s*pipeline\.number\s*>>/ || $0 ~ /cs\/build-image/ || $0 ~ /\btag:/ || $0 ~ /\bunless:/ || $0 ~ /filters:/) {
    printf("%4d: %s\n", NR, $0)
  }
}' "$file"
echo

echo "=== Search repo for those patterns ==="
if command -v rg >/dev/null 2>&1; then
  rg -n --hidden --no-ignore "pipeline\.git\.tag|<< pipeline\.number >>|cs/build-image|filters:|unless:" || true
else
  grep -RIn --exclude-dir=.git -E "pipeline\.git\.tag|<< pipeline\.number >>|cs/build-image|filters:|unless:" . || true
fi

Length of output: 2170


.circleci/config.yml — unquote << pipeline.number >> and prevent storj-push from running on tags

  • Replace tag: "'<< pipeline.number >>'" with tag: << pipeline.number >> (the current quotes become literal in the tag). Add job-level filters so storj-push won't run on tags (relying only on unless: << pipeline.git.tag >> is brittle).

Apply this diff:

-    unless: << pipeline.git.tag >>
+    unless: << pipeline.git.tag >>
     jobs:
-    - cs/build-image:
+    - cs/build-image:
         context: "dev.chainstack | GCP"
-        tag: "'<< pipeline.number >>'"
+        tag: << pipeline.number >>

Also add a branch-only filter to ensure this workflow never runs on tags:

   storj-push:
     unless: << pipeline.git.tag >>
     jobs:
     - cs/build-image:
+        filters:
+          tags:
+            ignore: /.*/
+          branches:
+            only: /.*/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
unless: << pipeline.git.tag >>
jobs:
- cs/build-image:
context: "dev.chainstack | GCP"
tag: "'<< pipeline.number >>'"
unless: << pipeline.git.tag >>
jobs:
- cs/build-image:
context: "dev.chainstack | GCP"
tag: << pipeline.number >>
🤖 Prompt for AI Agents
In .circleci/config.yml around lines 15-19, the tag value is currently quoted
literally and the workflow lacks robust tag filtering; replace tag: "'<<
pipeline.number >>'" with an unquoted tag: << pipeline.number >>, and add
job-level filters for the storj-push job to exclude tag pipelines (so storj-push
will not run on tags), plus add a workflow-level branch-only filter to ensure
this workflow never runs for tag refs (e.g., configure filters on the workflow
to only run for branches or explicitly ignore tag pipelines).

storj-tag:
when: << pipeline.git.tag >>
jobs:
- cs/build-image:
name: build-dev-image
context: "dev.chainstack | GCP"
tag: << pipeline.git.tag >>
filters: *filters-tag
extra_build_args: "--build-arg ENV=production"
- cs/build-image:
name: build-prod-image
context: "prod.chainstack | GCP"
tag: << pipeline.git.tag >>
filters: *filters-tag
extra_build_args: "--build-arg ENV=production"
35 changes: 33 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,39 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Prepare CockroachDB certificates
run: |
mkdir -p cockroach-certs
docker run --rm -v "$PWD/cockroach-certs":/certs cockroachdb/cockroach:latest-v21.2 cert create-ca --certs-dir=/certs --ca-key=/certs/ca.key
docker run --rm -v "$PWD/cockroach-certs":/certs cockroachdb/cockroach:latest-v21.2 cert create-node localhost 127.0.0.1 --certs-dir=/certs --ca-key=/certs/ca.key
docker run --rm -v "$PWD/cockroach-certs":/certs cockroachdb/cockroach:latest-v21.2 cert create-client root --certs-dir=/certs --ca-key=/certs/ca.key
chmod 600 cockroach-certs/client.root.key

- name: Start CockroachDB
run: docker run --rm -d -p 26257:26257 cockroachdb/cockroach:latest-v21.2 start-single-node --insecure
run: |
docker run --rm -d \
--name cockroach \
-e COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING=1 \
-p 127.0.0.1:26257:26257 \
-p 127.0.0.1:8080:8080 \
-v "$PWD/cockroach-certs":/cockroach/certs \
cockroachdb/cockroach:latest-v21.2 start-single-node \
--certs-dir=/cockroach/certs \
--store=type=mem,size=512MiB \
--listen-addr=0.0.0.0:26257 \
--advertise-addr=localhost \
--http-addr=0.0.0.0:8080

- name: Wait for CockroachDB
run: |
for attempt in {1..30}; do
if docker exec cockroach cockroach sql --certs-dir=/cockroach/certs --execute='SELECT 1'; then
exit 0
fi
sleep 2
done
echo "CockroachDB did not become ready in time" >&2
exit 1

- name: Set up Go
uses: actions/setup-go@v2
Expand All @@ -43,5 +74,5 @@ jobs:
run: go test -race -v ./...
env:
STORJ_TEST_POSTGRES: postgres://postgres:postgres@localhost/postgres?sslmode=disable
STORJ_TEST_COCKROACH: cockroach://root@localhost:26257/defaultdb?sslmode=disable
STORJ_TEST_COCKROACH: cockroach://root@localhost:26257/defaultdb?sslmode=verify-full&sslrootcert=${{ github.workspace }}/cockroach-certs/ca.crt&sslcert=${{ github.workspace }}/cockroach-certs/client.root.crt&sslkey=${{ github.workspace }}/cockroach-certs/client.root.key
GOLOG_LOG_LEVEL: storjds=debug
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN go mod edit -replace storj.io/ipfs-go-ds-storj=./ipfs-go-ds-storj && \

# Target image

FROM ipfs/kubo:v0.36.0
FROM ipfs/kubo:v0.37.0

# Copy the ipfs from the build container.
ENV SRC_DIR /kubo
Expand All @@ -39,3 +39,18 @@ COPY --from=build $SRC_DIR/ipfs-go-ds-storj/docker/container_daemon /usr/local/b

# Fix permissions on start_ipfs (ignore the build machine's permissions)
RUN chmod 0755 /usr/local/bin/start_ipfs

# Create dedicated runtime user to avoid running the daemon as root.
RUN if command -v addgroup >/dev/null 2>&1; then \
addgroup --system storj 2>/dev/null || addgroup -S storj; \
adduser --system --ingroup storj --home /data/storj --disabled-password --gecos "" storj 2>/dev/null || \
adduser -S -G storj -h /data/storj storj; \
else \
groupadd --system storj && useradd --system --gid storj --home /data/storj storj; \
fi && \
mkdir -p /data/storj && \
chown -R storj:storj /data/storj

ENV IPFS_PATH=/data/storj

USER storj
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The datastore plugin must be compiled and bundled together with go-ipfs. The plu
> cd go-ipfs

# Checkout the desired release tag of go-ipfs.
> git checkout v0.19.2
> git checkout v0.37.0

# Pull in the datastore plugin (you can specify a version other than latest if you'd like).
> go get storj.io/ipfs-go-ds-storj/plugin@latest
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/ipfs/go-ipfs-ds-help v1.1.0
github.com/ipfs/go-log v1.0.5
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/kubo v0.19.2
github.com/ipfs/kubo v0.37.0
github.com/jackc/pgx/v5 v5.4.1
github.com/multiformats/go-multihash v0.2.1
github.com/spacemonkeygo/monkit/v3 v3.0.20-0.20230419135619-fb89f20752cb
Expand Down