mirror of
https://codeberg.org/crowci/crow.git
synced 2025-04-18 04:44:01 +03:00
ci: get checks passing with just
(#3)
This commit is contained in:
parent
14c09f4214
commit
1ff8cd9d47
18
.cspell.json
18
.cspell.json
@ -9,11 +9,26 @@
|
||||
"node"
|
||||
],
|
||||
"words": [
|
||||
"crowci",
|
||||
"mkdocs",
|
||||
"dockerconfigjson",
|
||||
"crio",
|
||||
"NONROOT",
|
||||
"SECCTX",
|
||||
"PKGS",
|
||||
"podmonitor",
|
||||
"certresolver",
|
||||
"redirectscheme",
|
||||
"glightbox",
|
||||
"FOSS",
|
||||
"abool",
|
||||
"addgroup",
|
||||
"adduser",
|
||||
"anbraten",
|
||||
"antfu",
|
||||
"dbname",
|
||||
"trunc",
|
||||
"Justfile",
|
||||
"apimachinery",
|
||||
"appleboy",
|
||||
"Archlinux",
|
||||
@ -260,7 +275,8 @@
|
||||
"renovate.json",
|
||||
// TODO: remove the following
|
||||
"docs/**/*.js",
|
||||
"docs/**/*.ts"
|
||||
"docs/**/*.ts",
|
||||
"docs_old/**/*"
|
||||
],
|
||||
// Exclude imports, because they are also strings.
|
||||
"ignoreRegExpList": [
|
||||
|
3
.ecrc
3
.ecrc
@ -11,6 +11,7 @@
|
||||
"server/store/datastore/feed.go",
|
||||
"cmd/server/openapi/docs.go",
|
||||
"_test.go",
|
||||
"Makefile"
|
||||
"Makefile",
|
||||
"Justfile"
|
||||
]
|
||||
}
|
||||
|
@ -6,3 +6,5 @@ CHANGELOG.md
|
||||
# to prevent conflicts with different prettier version
|
||||
web/
|
||||
docs/
|
||||
docs_old/
|
||||
venv/
|
||||
|
@ -10,8 +10,8 @@ build:
|
||||
tools:
|
||||
python: '3'
|
||||
jobs:
|
||||
pre_install:
|
||||
- pip install mkdocs-material
|
||||
pre_install:
|
||||
- pip install -r docs/requirements.txt
|
||||
|
||||
# Build documentation with Mkdocs
|
||||
mkdocs:
|
||||
@ -22,4 +22,3 @@ mkdocs:
|
||||
# python:
|
||||
# install:
|
||||
# - requirements: docs/requirements.txt
|
||||
|
||||
|
@ -35,8 +35,10 @@ steps:
|
||||
pull: true
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y tree
|
||||
- make cross-compile-server
|
||||
- apt install -y -q tree
|
||||
# install just FIXME: 'apt install -y just' from Debian >= 13
|
||||
- curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/bin/
|
||||
- just cross-compile-server
|
||||
environment:
|
||||
PLATFORMS: linux|arm64/v8;linux|amd64;windows|amd64
|
||||
TAGS: bindata sqlite sqlite_unlock_notify netgo
|
||||
@ -57,7 +59,9 @@ steps:
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y zip
|
||||
- make release-agent
|
||||
# install just FIXME: 'apt install -y just' from Debian >= 13
|
||||
- curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/bin/
|
||||
- just release-agent
|
||||
|
||||
build-cli:
|
||||
depends_on:
|
||||
@ -68,21 +72,11 @@ steps:
|
||||
- apt install -y zip
|
||||
- make release-cli
|
||||
|
||||
build-deb-rpm:
|
||||
depends_on:
|
||||
- cross-compile-server
|
||||
- build-agent
|
||||
- build-cli
|
||||
image: *golang_image
|
||||
commands:
|
||||
- make bundle
|
||||
|
||||
checksums:
|
||||
depends_on:
|
||||
- cross-compile-server
|
||||
- build-agent
|
||||
- build-cli
|
||||
- build-deb-rpm
|
||||
- build-tarball
|
||||
image: *golang_image
|
||||
commands:
|
||||
@ -102,12 +96,10 @@ steps:
|
||||
image: woodpeckerci/plugin-release:0.2.2
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: github_token
|
||||
from_secret: GITHUB_PKGS_TOKEN
|
||||
files:
|
||||
- dist/*.tar.gz
|
||||
- dist/*.zip
|
||||
- dist/*.deb
|
||||
- dist/*.rpm
|
||||
- dist/checksums.txt
|
||||
title: ${CI_COMMIT_TAG##v}
|
||||
when:
|
||||
|
@ -13,18 +13,13 @@ variables:
|
||||
|
||||
# vars used on push / tag events only
|
||||
- publish_logins: &publish_logins # Default DockerHub login
|
||||
- registry: https://index.docker.io/v1/
|
||||
username: woodpeckerbot
|
||||
- registry: https://ghcr.io/v2/
|
||||
username: crowci-bot
|
||||
password:
|
||||
from_secret: docker_password
|
||||
# Additional Quay.IO login
|
||||
- registry: https://quay.io
|
||||
username: 'woodpeckerci+wp_ci'
|
||||
password:
|
||||
from_secret: QUAY_IO_TOKEN
|
||||
- &publish_repos_server 'woodpeckerci/woodpecker-server,quay.io/woodpeckerci/woodpecker-server'
|
||||
- &publish_repos_agent 'woodpeckerci/woodpecker-agent,quay.io/woodpeckerci/woodpecker-agent'
|
||||
- &publish_repos_cli 'woodpeckerci/woodpecker-cli,quay.io/woodpeckerci/woodpecker-cli'
|
||||
from_secret: GITHUB_PKGS_TOKEN
|
||||
- &publish_repos_server 'crowci/crow-server,quay.io/crowci/crow-server'
|
||||
- &publish_repos_agent 'crowci/crow-agent,quay.io/crowci/crow-agent'
|
||||
- &publish_repos_cli 'crowci/crow-cli,quay.io/crowci/crow-cli'
|
||||
- path: &when_path # web source code
|
||||
- 'web/**'
|
||||
# api source code
|
||||
@ -90,7 +85,9 @@ steps:
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y tree
|
||||
- make cross-compile-server
|
||||
# install just FIXME: 'apt install -y just' from Debian >= 13
|
||||
- curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/bin/
|
||||
- just cross-compile-server
|
||||
environment:
|
||||
PLATFORMS: linux|amd64
|
||||
TAGS: sqlite sqlite_unlock_notify netgo
|
||||
@ -109,7 +106,7 @@ steps:
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y tree
|
||||
- make cross-compile-server
|
||||
- just cross-compile-server
|
||||
environment:
|
||||
PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le;linux|riscv64
|
||||
TAGS: sqlite sqlite_unlock_notify netgo
|
||||
@ -124,7 +121,7 @@ steps:
|
||||
- cross-compile-server-preview
|
||||
image: *buildx_plugin
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-server
|
||||
repo: crowci/crow-server
|
||||
dockerfile: docker/Dockerfile.server.alpine.multiarch.rootless
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
|
||||
@ -141,7 +138,7 @@ steps:
|
||||
image: *buildx_plugin
|
||||
settings:
|
||||
dry_run: true
|
||||
repo: woodpeckerci/woodpecker-server
|
||||
repo: crowci/crow-server
|
||||
dockerfile: docker/Dockerfile.server.multiarch.rootless
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
@ -211,7 +208,7 @@ steps:
|
||||
- vendor
|
||||
image: *buildx_plugin
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-agent
|
||||
repo: crowci/crow-agent
|
||||
dockerfile: docker/Dockerfile.agent.alpine.multiarch
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
|
||||
@ -225,7 +222,7 @@ steps:
|
||||
image: *buildx_plugin
|
||||
settings:
|
||||
dry_run: true
|
||||
repo: woodpeckerci/woodpecker-agent
|
||||
repo: crowci/crow-agent
|
||||
dockerfile: docker/Dockerfile.agent.multiarch
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
@ -309,7 +306,7 @@ steps:
|
||||
image: *buildx_plugin
|
||||
settings:
|
||||
dry_run: true
|
||||
repo: woodpeckerci/woodpecker-cli
|
||||
repo: crowci/crow-cli
|
||||
dockerfile: docker/Dockerfile.cli.multiarch.rootless
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
|
@ -1,163 +0,0 @@
|
||||
variables:
|
||||
- &golang_image 'docker.io/golang:1.23'
|
||||
- &node_image 'docker.io/node:23-alpine'
|
||||
- &alpine_image 'docker.io/alpine:3.21'
|
||||
- path: &when_path
|
||||
- 'docs/**'
|
||||
- '.woodpecker/docs.yaml'
|
||||
# since we generate docs for cli tool we have to watch this too
|
||||
- 'cli/**'
|
||||
- 'cmd/cli/**'
|
||||
# api docs
|
||||
- 'server/api/**'
|
||||
- path: &docker_path # web source code
|
||||
- 'web/**'
|
||||
# api source code
|
||||
- 'server/api/**'
|
||||
# go source code
|
||||
- '**/*.go'
|
||||
- 'go.*'
|
||||
# schema changes
|
||||
- 'pipeline/schema/**'
|
||||
# Dockerfile changes
|
||||
- 'docker/**'
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
- event: pull_request
|
||||
- event: push
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: pull_request_closed
|
||||
path: *when_path
|
||||
- event: manual
|
||||
evaluate: 'TASK == "docs"'
|
||||
|
||||
steps:
|
||||
prettier:
|
||||
image: docker.io/woodpeckerci/plugin-prettier:next
|
||||
settings:
|
||||
version: 3.3.3
|
||||
plugins:
|
||||
- 'prettier-plugin-tailwindcss'
|
||||
- '@ianvs/prettier-plugin-sort-imports'
|
||||
when:
|
||||
- event: pull_request
|
||||
|
||||
build-cli:
|
||||
image: *golang_image
|
||||
commands:
|
||||
- make generate-docs
|
||||
when:
|
||||
- path: *when_path
|
||||
event: [tag, pull_request, push]
|
||||
- event: manual
|
||||
|
||||
build:
|
||||
image: *node_image
|
||||
directory: docs/
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm install --frozen-lockfile
|
||||
- pnpm build
|
||||
when:
|
||||
- path: *when_path
|
||||
event: [tag, pull_request, push]
|
||||
- event: manual
|
||||
|
||||
deploy-preview:
|
||||
image: docker.io/woodpeckerci/plugin-surge-preview:1.3.3
|
||||
settings:
|
||||
path: 'docs/build/'
|
||||
surge_token:
|
||||
from_secret: SURGE_TOKEN
|
||||
forge_repo_token:
|
||||
from_secret: GITHUB_TOKEN_SURGE
|
||||
failure: ignore
|
||||
when:
|
||||
- event: [pull_request, pull_request_closed]
|
||||
path: *when_path
|
||||
|
||||
deploy-prepare:
|
||||
image: *alpine_image
|
||||
environment:
|
||||
BOT_PRIVATE_KEY:
|
||||
from_secret: BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client git
|
||||
- mkdir -p $HOME/.ssh
|
||||
- ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
||||
- echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
|
||||
- chmod 0600 $HOME/.ssh/id_rsa
|
||||
- git clone --depth 1 --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git ./docs_repo
|
||||
when:
|
||||
- event: push
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: [manual, tag]
|
||||
|
||||
# update latest and next version
|
||||
version-next:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add jq
|
||||
- jq '.next = "next-${CI_COMMIT_SHA:0:10}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp
|
||||
- mv ./docs_repo/version.json.tmp ./docs_repo/version.json
|
||||
when:
|
||||
- event: push
|
||||
path: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
version-release:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add jq
|
||||
- if [[ "${CI_COMMIT_TAG}" != *"rc"* ]] ; then jq '.latest = "${CI_COMMIT_TAG}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp && mv ./docs_repo/version.json.tmp ./docs_repo/version.json ; fi
|
||||
- jq '.rc = "${CI_COMMIT_TAG}"' ./docs_repo/version.json > ./docs_repo/version.json.tmp
|
||||
- mv ./docs_repo/version.json.tmp ./docs_repo/version.json
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
copy-files:
|
||||
image: *alpine_image
|
||||
commands:
|
||||
- apk add rsync
|
||||
# copy all docs files and delete all old ones, but leave CNAME, index.yaml and version.json untouched
|
||||
- rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --exclude version.json --delete docs/build/ ./docs_repo
|
||||
when:
|
||||
- event: push
|
||||
path: *when_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
|
||||
deploy:
|
||||
image: *alpine_image
|
||||
environment:
|
||||
BOT_PRIVATE_KEY:
|
||||
from_secret: BOT_PRIVATE_KEY
|
||||
commands:
|
||||
- apk add openssh-client rsync git
|
||||
- mkdir -p $HOME/.ssh
|
||||
- ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
||||
- echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
|
||||
- chmod 0600 $HOME/.ssh/id_rsa
|
||||
- git config --global user.email "woodpecker-bot@obermui.de"
|
||||
- git config --global user.name "woodpecker-bot"
|
||||
- cd ./docs_repo
|
||||
- git add .
|
||||
# exit successfully if nothing changed
|
||||
- test -n "$(git status --porcelain)" || exit 0
|
||||
- git commit -m "Deploy website - based on ${CI_COMMIT_SHA}"
|
||||
- git push
|
||||
when:
|
||||
- event: push
|
||||
path:
|
||||
- <<: *when_path
|
||||
- <<: *docker_path
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: [manual, tag]
|
@ -1,31 +0,0 @@
|
||||
when:
|
||||
- event: cron
|
||||
cron: links
|
||||
|
||||
steps:
|
||||
- name: links
|
||||
image: docker.io/lycheeverse/lychee:0.15.1
|
||||
failure: ignore
|
||||
depends_on: []
|
||||
commands:
|
||||
- lychee pipeline/frontend/yaml/linter/schema/schema.json > links.md
|
||||
- lychee --exclude localhost docs/docs/ >> links.md
|
||||
- lychee --exclude localhost docs/src/pages/ >> links.md
|
||||
- echo -e "\nLast checked:$(date)" >> links.md
|
||||
|
||||
- name: Update issue
|
||||
image: docker.io/alpine:3.21
|
||||
depends_on: links
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: github_token
|
||||
commands:
|
||||
- apk add -q --no-cache jq curl
|
||||
- export ISSUE_NUMBER=4514
|
||||
- export DESCRIPTION=$(cat links.md)
|
||||
- |
|
||||
curl -X PATCH \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
https://api.github.com/repos/${CI_REPO}/issues/$ISSUE_NUMBER \
|
||||
-d "$(jq -n --arg body "$DESCRIPTION" '{body: $body}')"
|
@ -1,15 +0,0 @@
|
||||
when:
|
||||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
- release/*
|
||||
|
||||
steps:
|
||||
- name: release-helper
|
||||
image: docker.io/woodpeckerci/plugin-ready-release-go:3.1.1
|
||||
settings:
|
||||
release_branch: ${CI_COMMIT_BRANCH}
|
||||
forge_type: github
|
||||
git_email: woodpecker-bot@obermui.de
|
||||
github_token:
|
||||
from_secret: GITHUB_TOKEN
|
@ -1,26 +0,0 @@
|
||||
depends_on:
|
||||
- docker
|
||||
- binaries
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
steps:
|
||||
- name: mastodon-toot
|
||||
image: docker.io/woodpeckerci/plugin-mastodon-post
|
||||
settings:
|
||||
server_url: https://floss.social
|
||||
access_token:
|
||||
from_secret: mastodon_token
|
||||
visibility: public
|
||||
ai_token:
|
||||
from_secret: openai_token
|
||||
ai_prompt: |
|
||||
We want to present the next version of our app on Mastodon.
|
||||
Therefore we want to post a catching text, so users will know why they should
|
||||
update to the newest version. Highlight the most special features. If there is no special feature
|
||||
included just summarize the changes in a few sentences. The whole text should not be longer than 240
|
||||
characters. Avoid naming contributors from. Use #WoodpeckerCI, #release and
|
||||
additional fitting hashtags and emojis to make the post more appealing
|
||||
|
||||
The changelog entry: {{ changelog }}
|
@ -120,25 +120,6 @@ steps:
|
||||
- make test-server-datastore
|
||||
when: *when
|
||||
|
||||
codecov:
|
||||
depends_on:
|
||||
- test
|
||||
- sqlite
|
||||
pull: true
|
||||
image: docker.io/woodpeckerci/plugin-codecov:2.1.6
|
||||
settings:
|
||||
files:
|
||||
- agent-coverage.out
|
||||
- cli-coverage.out
|
||||
- coverage.out
|
||||
- server-coverage.out
|
||||
- datastore-coverage.out
|
||||
token:
|
||||
from_secret: codecov_token
|
||||
when:
|
||||
- path: *when_path
|
||||
failure: ignore
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: docker.io/postgres:17
|
||||
|
69
Justfile
69
Justfile
@ -1,34 +1,29 @@
|
||||
### Variables
|
||||
GO_PACKAGES := `go list ./... | grep -v /vendor/`
|
||||
|
||||
GO_PACKAGES := `go list ./... | grep -v /vendor/`
|
||||
TARGETOS := `go env GOOS`
|
||||
TARGETARCH := `go env GOARCH`
|
||||
|
||||
BIN_SUFFIX := if TARGETOS == "windows" { ".exe" } else { "" }
|
||||
|
||||
DIST_DIR := "dist"
|
||||
|
||||
VERSION := "dev"
|
||||
VERSION_NUMBER := "0.0.0"
|
||||
CI_COMMIT_SHA := `git rev-parse HEAD`
|
||||
|
||||
TAGS := ""
|
||||
STATIC_BUILD := "true"
|
||||
|
||||
# Conditional assignment for LDFLAGS if STATIC_BUILD is true
|
||||
# FIXME: https://github.com/casey/just/issues/11
|
||||
|
||||
LDFLAGS := if STATIC_BUILD == "true" { "-s -w -extldflags '-static'" } else { "" }
|
||||
|
||||
# only used to compile server
|
||||
|
||||
CGO_ENABLED := "1"
|
||||
|
||||
HAS_GO := `hash go > /dev/null 2>&1 && echo "GO" || echo "NOGO"`
|
||||
|
||||
XGO_VERSION := if HAS_GO == "GO" { "go-1.23.x" } else { "" }
|
||||
CGO_CFLAGS := if HAS_GO == "GO" { `go env CGO_CFLAGS` } else { "" }
|
||||
|
||||
### Recipes
|
||||
|
||||
## docs
|
||||
|
||||
docs-venv-fish:
|
||||
@ -51,18 +46,19 @@ cherry-pick COMMIT:
|
||||
|
||||
## build
|
||||
|
||||
[working-directory: 'web']
|
||||
[working-directory('web')]
|
||||
build-ui:
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build
|
||||
|
||||
build-agent:
|
||||
CGO_ENABLED=0 GOOS={{TARGETOS}} GOARCH={{TARGETARCH}} go build -tags '{{TAGS}}' -ldflags '{{LDFLAGS}}' -o {{DIST_DIR}}/crow-agent{{BIN_SUFFIX}} go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
CGO_ENABLED=0 GOOS={{ TARGETOS }} GOARCH={{ TARGETARCH }} go build -tags '{{ TAGS }}' -ldflags '{{ LDFLAGS }}' -o {{ DIST_DIR }}/crow-agent{{ BIN_SUFFIX }} go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
|
||||
build-cli: ## Build cli
|
||||
CGO_ENABLED=0 GOOS={{TARGETOS}} GOARCH={{TARGETARCH}} go build -tags '{{TAGS}}' -ldflags '{{LDFLAGS}}' -o {{DIST_DIR}}/crow-cli{BIN_SUFFIX} go.woodpecker-ci.org/woodpecker/v3/cmd/cli
|
||||
build-cli:
|
||||
CGO_ENABLED=0 GOOS={{ TARGETOS }} GOARCH={{ TARGETARCH }} go build -tags '{{ TAGS }}' -ldflags '{{ LDFLAGS }}' -o {{ DIST_DIR }}/crow-cli{BIN_SUFFIX} go.woodpecker-ci.org/woodpecker/v3/cmd/cli
|
||||
|
||||
# build-server
|
||||
|
||||
# env PLATFORMS=linux/amd64 just build-server
|
||||
build-server: build-ui vendor
|
||||
just cross-compile-server
|
||||
@ -71,16 +67,17 @@ vendor:
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
|
||||
# build for specific platform: env PLATFORMS='linux/amd64' just cross-compile-server
|
||||
# build for specific platform: env PLATFORMS='linux|arm64/v8' just cross-compile-server
|
||||
|
||||
# build for local platform: just cross-compile-server
|
||||
cross-compile-server:
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
PLATFORMS="${PLATFORMS:-{{TARGETOS}}/{{TARGETARCH}}}"
|
||||
IFS=',' read -ra PLATFORMS_ARRAY <<< "${PLATFORMS}"
|
||||
PLATFORMS="${PLATFORMS:-{{ TARGETOS }}/{{ TARGETARCH }}}"
|
||||
IFS=';' read -ra PLATFORMS_ARRAY <<< "${PLATFORMS}"
|
||||
for platform in "${PLATFORMS_ARRAY[@]}"; do
|
||||
IFS='/' read -ra PLATFORM_PARTS <<< "$platform"
|
||||
IFS='|' read -ra PLATFORM_PARTS <<< "$platform"
|
||||
TARGETOS="${PLATFORM_PARTS[0]}"
|
||||
if [ -n "${PLATFORM_PARTS[1]:-}" ]; then
|
||||
TARGETARCH_XGO="${PLATFORM_PARTS[1]//arm64\/v8/arm64}"
|
||||
@ -93,8 +90,7 @@ cross-compile-server:
|
||||
fi
|
||||
env TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH TARGETARCH_XGO=$TARGETARCH_XGO just release-server-xgo || exit 1
|
||||
done
|
||||
tree "{{DIST_DIR}}"
|
||||
|
||||
tree "{{ DIST_DIR }}"
|
||||
|
||||
check-xgo:
|
||||
hash xgo > /dev/null 2>&1 || go install src.techknowlogick.com/xgo@latest
|
||||
@ -107,32 +103,51 @@ release-server-xgo: check-xgo
|
||||
@echo "arch orgi: ${TARGETARCH}"
|
||||
@echo "arch (xgo): ${TARGETARCH}"
|
||||
@echo "------------------"
|
||||
# build via xgo
|
||||
CGO_CFLAGS="{{CGO_CFLAGS}}" xgo -go {{XGO_VERSION}} -dest {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH} -tags 'netgo osusergo grpcnotrace {{TAGS}}' -ldflags '-linkmode external {{LDFLAGS}} -X go.woodpecker-ci.org/woodpecker/v3/version.Version={{VERSION}}' -targets ${TARGETOS}/${TARGETARCH} -out crow-server -pkg cmd/server .
|
||||
CGO_CFLAGS="{{ CGO_CFLAGS }}" xgo -go {{ XGO_VERSION }} -dest {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH} -tags 'netgo osusergo grpcnotrace {{ TAGS }}' -ldflags '-linkmode external {{ LDFLAGS }} -X go.woodpecker-ci.org/woodpecker/v3/version.Version={{ VERSION }}' -targets ${TARGETOS}/${TARGETARCH} -out crow-server -pkg cmd/server .
|
||||
# move binary into subfolder depending on target os and arch
|
||||
if [ "${XGO_IN_XGO:-0}" -eq "1" ]; then \
|
||||
echo "inside xgo image"; \
|
||||
mkdir -p {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}; \
|
||||
mv -vf /build/crow-server* {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}/crow-server{{BIN_SUFFIX}}; \
|
||||
mkdir -p {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}; \
|
||||
mv -vf /build/crow-server* {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}/crow-server{{ BIN_SUFFIX }}; \
|
||||
else \
|
||||
echo "outside xgo image"; \
|
||||
[ -f "{{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}/crow-server{{BIN_SUFFIX}}" ] && rm -v {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}/crow-server{{BIN_SUFFIX}}; \
|
||||
mv -v {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}/crow-server* {{DIST_DIR}}/server/${TARGETOS}_${TARGETARCH}/crow-server{{BIN_SUFFIX}}; \
|
||||
[ -f "{{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}/crow-server{{ BIN_SUFFIX }}" ] && rm -v {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}/crow-server{{ BIN_SUFFIX }}; \
|
||||
mv -v {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}/crow-server* {{ DIST_DIR }}/server/${TARGETOS}_${TARGETARCH}/crow-server{{ BIN_SUFFIX }}; \
|
||||
fi
|
||||
|
||||
## agent
|
||||
|
||||
release-agent:
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/linux_amd64/crow-agent go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/linux_arm64/crow-agent go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/linux_arm/crow-agent go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/windows_amd64/crow-agent.exe go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/darwin_amd64/crow-agent go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '{{ LDFLAGS }}' -tags 'grpcnotrace {{ TAGS }}' -o {{ DIST_DIR }}/agent/darwin_arm64/crow-agent go.woodpecker-ci.org/woodpecker/v3/cmd/agent
|
||||
# tar binary files
|
||||
tar -cvzf {{ DIST_DIR }}/crow-agent_linux_amd64.tar.gz -C {{ DIST_DIR }}/agent/linux_amd64 crow-agent
|
||||
tar -cvzf {{ DIST_DIR }}/crow-agent_linux_arm64.tar.gz -C {{ DIST_DIR }}/agent/linux_arm64 crow-agent
|
||||
tar -cvzf {{ DIST_DIR }}/crow-agent_linux_arm.tar.gz -C {{ DIST_DIR }}/agent/linux_arm crow-agent
|
||||
tar -cvzf {{ DIST_DIR }}/crow-agent_darwin_amd64.tar.gz -C {{ DIST_DIR }}/agent/darwin_amd64 crow-agent
|
||||
tar -cvzf {{ DIST_DIR }}/crow-agent_darwin_arm64.tar.gz -C {{ DIST_DIR }}/agent/darwin_arm64 crow-agent
|
||||
# zip binary files
|
||||
rm -f {{ DIST_DIR }}/crow-agent_windows_amd64.zip
|
||||
zip -j {{ DIST_DIR }}/crow-agent_windows_amd64.zip {{ DIST_DIR }}/agent/windows_amd64/crow-agent.exe
|
||||
|
||||
## images
|
||||
|
||||
# env PLATFORMS='linux/amd64,linux/arm64' just image-server
|
||||
# platforms must be handed over via this syntax for the underlying cross-compile-server step which applies some string splitting on a list of items
|
||||
# env PLATFORMS='linux|amd64;linux|arm64' just image-server
|
||||
image-server:
|
||||
just cross-compile-server
|
||||
echo $GITHUB_PKGS_TOKEN | docker login ghcr.io -u crowci-bot --password-stdin
|
||||
docker buildx build --platform $PLATFORMS -t ghcr.io/crowci/crow-server:dev -f docker/Dockerfile.server.multiarch.rootless --push .
|
||||
FIXED_PLATFORMS=$(echo $PLATFORMS | sed "s/|/\//g; s/;/,/g") && docker buildx build --platform $FIXED_PLATFORMS -t ghcr.io/crowci/crow-server:dev -f docker/Dockerfile.server.multiarch.rootless --push .
|
||||
|
||||
# env PLATFORMS='linux/amd64,linux/arm64' just image-server-alpine
|
||||
image-server-alpine:
|
||||
just cross-compile-server
|
||||
echo $GITHUB_PKGS_TOKEN | docker login ghcr.io -u crowci-bot --password-stdin
|
||||
docker buildx build --platform $PLATFORMS -t ghcr.io/crowci/crow-server:dev-alpine -f docker/Dockerfile.server.alpine.multiarch.rootless --push .
|
||||
FIXED_PLATFORMS=$(echo $PLATFORMS | sed "s/|/\//g; s/;/,/g") && docker buildx build --platform $PLATFORMS -t ghcr.io/crowci/crow-server:dev-alpine -f docker/Dockerfile.server.alpine.multiarch.rootless --push .
|
||||
|
||||
# env PLATFORMS='linux/amd64,linux/arm64' just image-agent
|
||||
image-agent:
|
||||
|
26
mkdocs.yaml
26
mkdocs.yaml
@ -11,13 +11,13 @@ theme:
|
||||
view: material/eye
|
||||
palette:
|
||||
# Palette toggle for automatic mode
|
||||
- media: "(prefers-color-scheme)"
|
||||
- media: '(prefers-color-scheme)'
|
||||
toggle:
|
||||
icon: material/brightness-auto
|
||||
name: Switch to light mode
|
||||
|
||||
# Palette toggle for light mode
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
- media: '(prefers-color-scheme: light)'
|
||||
scheme: custom-light
|
||||
# accent: yellow
|
||||
toggle:
|
||||
@ -25,7 +25,7 @@ theme:
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
- media: '(prefers-color-scheme: dark)'
|
||||
scheme: slate
|
||||
# https://github.com/squidfunk/mkdocs-material/issues/5537
|
||||
primary: custom
|
||||
@ -110,13 +110,15 @@ markdown_extensions:
|
||||
nav:
|
||||
- Getting started: index.md
|
||||
- Installation:
|
||||
- installation/index.md
|
||||
- Docker-compose: installation/docker-compose.md
|
||||
- Helm: installation/helm.md
|
||||
- Proxy Setup: installation/proxy.md
|
||||
- installation/index.md
|
||||
- Docker-compose: installation/docker-compose.md
|
||||
- Helm: installation/helm.md
|
||||
- Proxy Setup: installation/proxy.md
|
||||
- Configuration:
|
||||
- configuration/index.md
|
||||
- Server: configuration/server.md
|
||||
- Agent: configuration/agent.md
|
||||
- Autoscaler: configuration/autoscaler.md
|
||||
- All environment variables: configuration/env-vars.md
|
||||
- configuration/index.md
|
||||
- Server: configuration/server.md
|
||||
- Agent: configuration/agent.md
|
||||
- Autoscaler: configuration/autoscaler.md
|
||||
- All environment variables: configuration/env-vars.md
|
||||
- Development:
|
||||
- development/index.md
|
||||
|
Loading…
x
Reference in New Issue
Block a user