build: tidy up packages by removing unused scripts and files (#207)

release/2.25
Anthony Lapenna 2024-12-05 11:18:49 +13:00 committed by GitHub
parent 3c3dc547b2
commit a8147b9713
5 changed files with 0 additions and 239 deletions

1
.godir
View File

@ -1 +0,0 @@
portainer

View File

@ -1,34 +0,0 @@
#!/usr/bin/env bash
set -x
PLATFORM=$1
ARCH=$2
export GOPATH="/tmp/go"
binary="portainer"
mkdir -p dist
mkdir -p ${GOPATH}/src/github.com/portainer/portainer
cp -R api ${GOPATH}/src/github.com/portainer/portainer/api
cp -r "./mustache-templates" "./dist"
cd 'api/cmd/portainer'
go get -t -d -v ./...
GOOS=${PLATFORM} GOARCH=${ARCH} CGO_ENABLED=0 go build -a -trimpath --installsuffix cgo --ldflags "-s \
-X 'github.com/portainer/portainer/api/build.BuildNumber=${BUILDNUMBER}' \
-X 'github.com/portainer/portainer/api/build.ImageTag=${CONTAINER_IMAGE_TAG}' \
-X 'github.com/portainer/portainer/api/build.NodejsVersion=${NODE_VERSION}' \
-X 'github.com/portainer/portainer/api/build.YarnVersion=${YARN_VERSION}' \
-X 'github.com/portainer/portainer/api/build.WebpackVersion=${WEBPACK_VERSION}' \
-X 'github.com/portainer/portainer/api/build.GoVersion=${GO_VERSION}'"
if [ "${PLATFORM}" == 'windows' ]; then
mv "$BUILD_SOURCESDIRECTORY/api/cmd/portainer/${binary}.exe" "$BUILD_SOURCESDIRECTORY/dist/portainer.exe"
else
mv "$BUILD_SOURCESDIRECTORY/api/cmd/portainer/$binary" "$BUILD_SOURCESDIRECTORY/dist/portainer"
fi

View File

@ -1,139 +0,0 @@
#!/bin/bash
# For reference see: https://portainer.atlassian.net/wiki/spaces/TECH/pages/570589194/Code+Freeze+Preparation
# Portainer (CE + EE)
# Change version in package.json
# Change APIVersion in portainer.go
# Change @version in handler/handler.go
# This script requires jq
# sudo apt-get install jq
if ! [ -x "$(command -v sed)" ]; then
echo 'Error: sed is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed. Get it here: https://stedolan.github.io/jq/download/' >&2
exit 1
fi
CURRENT_VERSION=$(jq -r '.version' package.json)
PROMPT=true
# Parse the major, minor and patch versions
# out.
# You use it like this:
# semver="3.4.5+xyz"
# a=($(ParseSemVer "$semver"))
# major=${a[0]}
# minor=${a[1]}
# patch=${a[2]}
# printf "%-32s %4d %4d %4d\n" "$semver" $major $minor $patch
function ParseSemVer() {
local token="$1"
local major=0
local minor=0
local patch=0
if [[ "$token" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
fi
echo "$major $minor $patch"
}
Help()
{
echo "*** Bump Portainer version ***"
echo
echo "The Portainer version is in the semantic version format:"
echo " X.Y.Z (Major.Minor.Patch)"
echo
echo "The current version is defined in multiple files."
echo "This script will update the version in the following files:"
echo " package.json"
echo " api/portainer.go"
echo " api/http/handler/handler.go"
echo
echo "Usage: bump-version.sh [-s|-h]"
echo "options:"
echo " -h Print this Help."
echo " -s Silently bump minor version without prompting."
echo
}
case "$1" in
-s)
# automatically bump minor version with no prompting
PROMPT=false
;;
-h | --help) # display Help
Help
exit
esac
[ $PROMPT == true ] && {
echo "Current Portainer version: ${CURRENT_VERSION}"
}
a=($(ParseSemVer "$CURRENT_VERSION"))
major=${a[0]}
minor=${a[1]}
patch=${a[2]}
minor=$(($minor+1))
NEW_VERSION="${major}.${minor}.${patch}"
[ $PROMPT == true ] && {
echo -n "New Portainer version: [${NEW_VERSION}]: "
read -r inp
[[ ! -z "$inp" ]] && NEW_VERSION="$inp"
a=($(ParseSemVer "$NEW_VERSION"))
major=${a[0]}
minor=${a[1]}
patch=${a[2]}
if [ "$major" == 0 ] && [ "$minor" == 0 ] && [ "$patch" = 0 ]; then
echo "Invalid version format, must be major.minor.patch"
exit 1
fi
echo "Version will be changed to: ${NEW_VERSION}"
echo -n "Continue? [y/N]: "
read -r inp
if [ "$inp" != "y" ]; then
echo "Version left unchanged"
exit 1
fi
}
tmp=$(mktemp)
# Change version in package.json
filename="package.json"
jq --arg a "$NEW_VERSION" '.version = $a' package.json > "$tmp" && mv "$tmp" "$filename"
echo "Updated $filename."
# Update portainer.go
filename="api/portainer.go"
sed -E "s/^([[:blank:]]*APIVersion[[:blank:]]*=[[:blank:]]*).*/\1\"$NEW_VERSION\"/" "$filename" > "$tmp" && mv "$tmp" "$filename"
echo "Updated $filename."
# Change @version in handler/handler.go
filename="api/http/handler/handler.go"
sed -E "s|// @version .*|// @version $NEW_VERSION|" "$filename" > "$tmp" && mv "$tmp" "$filename"
echo "Updated $filename."
echo
echo "IMPORTANT! Before committing, please ensure the files have updated correctly with 'git diff'"

View File

@ -1,59 +0,0 @@
version: '3'
services:
portainer:
image: portainerci/portainer:$PORTAINER_TAG
command: -H unix:///var/run/docker.sock --admin-password $$2y$$05$$cQ4zB2SEdP4U3kkNhUV.Gu/xPdE4wSKEo1ncBFfKeERMI6IiXbg8y
restart: always
ports:
- 8999:9000
- 8000:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
swarm:
image: docker:dind
privileged: true
restart: always
volumes:
- /tmp/manager_run:/var/run
swarm-init:
image: docker:dind
privileged: true
command:
- /bin/sh
- -c
- |
apk add curl
curl -L https://raw.githubusercontent.com/eficode/wait-for/master/wait-for -o /bin/wait-for
chmod +x /bin/wait-for
wait-for swarm:2376 -- docker -H unix://swarm/run/docker.sock swarm init
docker -H unix://swarm/run/docker.sock swarm init
docker -H unix://swarm/run/docker.sock network create --driver overlay portainer_agent_network
docker -H unix://swarm/run/docker.sock service create -q --name portainer_agent --network portainer_agent_network --publish mode=host,target=9001,published=9001 -e AGENT_CLUSTER_ADDR=tasks.portainer_agent --mode global --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock --mount type=bind,src=//var/lib/docker/volumes,dst=/var/lib/docker/volumes --mount type=bind,src=/,dst=/host portainer/agent
depends_on:
- swarm
volumes:
- /tmp/manager_run:/swarm/run
kube:
image: portainer/kube-tools:latest
privileged: true
command:
- /bin/bash
- -c
- |
service docker start
sleep 3
kind create cluster --config=/kind.yaml
curl -L https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/agent/portainer-agent-k8s-nodeport.yaml -o portainer-agent.yaml
kubectl apply -f portainer-agent.yaml
tail -f /dev/null
volumes:
- docker_data:/var/lib/docker
volumes:
docker_data:
portainer_data:

View File

@ -1,6 +0,0 @@
{
"dockerComposeYmlFilePaths": ["docker-compose.pull-dog.yml"],
"isLazy": true,
"expiry": "1.00:00:00",
"label": "test-instance-available"
}