Skip to content
Closed
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
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- uses: actions/cache@v4
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- uses: actions/cache@v4
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- uses: actions/cache@v4
Expand All @@ -76,7 +76,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- uses: actions/cache@v4
Expand Down
173 changes: 173 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write

jobs:
validate:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify tag is from main branch
run: |
git fetch origin main
if ! git merge-base --is-ancestor ${{ github.sha }} origin/main; then
echo "Error: Tag must be created from main branch"
exit 1
fi
test:
runs-on: ubuntu-24.04
needs: validate
strategy:
matrix:
test-type: [unit, pact, integration]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install pact
if: matrix.test-type == 'pact'
uses: replicatedhq/action-install-pact@v1
- name: Run tests
run: make test-${{ matrix.test-type }}

release:
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: v2.10.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker:
runs-on: ubuntu-24.04
needs: release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "minor=$(echo $VERSION | cut -d. -f1,2)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
replicated/vendor-cli:latest
replicated/vendor-cli:${{ steps.version.outputs.major }}
replicated/vendor-cli:${{ steps.version.outputs.minor }}
replicated/vendor-cli:${{ steps.version.outputs.version }}
labels: |
com.replicated.vendor_cli=true
platforms: linux/amd64

docs:
runs-on: ubuntu-24.04
needs: release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '^1.24'
- name: Generate CLI docs
run: go run ./docs/gen.go
- name: Checkout replicated-docs
uses: actions/checkout@v4
with:
repository: replicatedhq/replicated-docs
path: replicated-docs
token: ${{ secrets.DOCS_REPO_TOKEN }}
- name: Update docs
run: |
set -euo pipefail
VERSION=${GITHUB_REF#refs/tags/}
BRANCH_NAME="update-cli-docs-${VERSION}-$(date +%Y-%m-%d-%H%M%S)"
WORKSPACE_ROOT=$(pwd)
cd replicated-docs
git config user.name "Replicated Release Pipeline"
git config user.email "release@replicated.com"
git checkout -b "$BRANCH_NAME"
# Configure git to use token from environment variable for authentication
# This avoids exposing the token in command strings or git config history
# The credential helper reads from GITHUB_TOKEN environment variable
git config credential.helper "!f() { echo \"username=x-access-token\"; echo \"password=${GITHUB_TOKEN}\"; }; f"
git remote set-url origin https://github.com/replicatedhq/replicated-docs.git
# Remove existing CLI docs (except installing doc)
find docs/reference -name "replicated-cli-*.mdx" ! -name "replicated-cli-installing.mdx" -delete
rm -f docs/reference/replicated.mdx
# Copy new docs
for file in "${WORKSPACE_ROOT}/gen/docs"/*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file" .md)
newname=$(echo "$filename" | sed 's/replicated_/replicated-cli-/g' | sed 's/_/-/g')
# Fix header level and internal links
sed 's/^## /# /' "$file" | \
sed 's/\.md//' | \
sed 's/replicated_/replicated-cli-/g' | \
sed 's/_/-/g' > "docs/reference/${newname}.mdx"
fi
done
# Update sidebar - this is a simplified version, may need manual adjustment
git add .
git commit -m "Update Replicated CLI docs for ${VERSION}"
git push origin "$BRANCH_NAME"
# Create PR using GitHub CLI
gh pr create \
--repo replicatedhq/replicated-docs \
--base main \
--head "$BRANCH_NAME" \
--title "Update Replicated CLI docs for ${VERSION}" \
--body "Automated update of CLI documentation for release ${VERSION}"
Copy link

Choose a reason for hiding this comment

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

Bug: Docs workflow omits sidebar updates

The docs job deletes existing replicated-cli-*.mdx files and writes new ones, but it doesn’t update sidebars.js (the previous pipeline did). If the docs repo sidebar references the removed pages, the generated docs PR can break navigation or fail the docs build.

Fix in Cursor Fix in Web

env:
GITHUB_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }}
GH_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }}
35 changes: 29 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
FROM golang:1.24
# Build stage
FROM golang:1.24-alpine AS builder

ENV PROJECTPATH=/go/src/github.com/replicatedhq/replicated
WORKDIR /build

RUN go get github.com/go-swagger/go-swagger/cmd/swagger
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download

WORKDIR $PROJECTPATH
# Copy source code
COPY . .

ENV GO111MODULE=on
# Build the binary
RUN CGO_ENABLED=0 go build \
-tags "containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp" \
-o bin/replicated \
cli/main.go

CMD ["/bin/bash"]
# Final stage
FROM alpine:latest

RUN apk add --no-cache ca-certificates curl git && \
update-ca-certificates

ENV IN_CONTAINER=1

WORKDIR /out

# Copy binary from builder stage
COPY --from=builder /build/bin/replicated /replicated

LABEL com.replicated.vendor_cli=true

ENTRYPOINT ["/replicated"]
Copy link

Choose a reason for hiding this comment

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

Bug: Docker image no longer supports local spec generation

The rebuilt Dockerfile no longer includes /bin/bash or the swagger CLI, but Makefile target get-spec-local still runs docker run ... /bin/bash -c and calls swagger generate spec. This makes local spec/model generation fail when using the repository’s Docker image.

Additional Locations (1)

Fix in Cursor Fix in Web

25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,15 @@ build:

.PHONY: release
release:
dagger call release \
--one-password-service-account-production env:OP_SERVICE_ACCOUNT_PRODUCTION \
--version $(version) \
--github-token env:GITHUB_TOKEN \
--progress plain
@echo "Releases are now automated via GitHub Actions"
@echo "To create a release:"
@echo " 1. Ensure you are on the main branch with a clean working tree"
@echo " 2. Create and push a tag: git tag v1.2.3 && git push origin v1.2.3"
@echo " 3. GitHub Actions will automatically build, test, and release"
@echo ""
@echo "✓ Release completed successfully"
@echo "Generating documentation PR..."
@$(MAKE) docs

.PHONY: docs
docs:
dagger --progress plain call generate-docs \
--github-token env:GITHUB_TOKEN \
--progress plain
@echo "The workflow will:"
@echo " - Run all tests"
@echo " - Build multi-platform binaries with GoReleaser"
@echo " - Create a GitHub release with artifacts"
@echo " - Build and push Docker images"
@echo " - Generate and submit CLI documentation PR"
20 changes: 0 additions & 20 deletions dagger.json

This file was deleted.

4 changes: 0 additions & 4 deletions dagger/.gitattributes

This file was deleted.

4 changes: 0 additions & 4 deletions dagger/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions dagger/compatibility.go

This file was deleted.

Loading
Loading