mirror of https://github.com/portainer/portainer
chore(build): remove grunt and add makefile [EE-4824] (#8125)
parent
731f3959c7
commit
f20d3e72b9
@ -1,44 +0,0 @@
|
|||||||
version: "2"
|
|
||||||
checks:
|
|
||||||
argument-count:
|
|
||||||
enabled: false
|
|
||||||
complex-logic:
|
|
||||||
enabled: false
|
|
||||||
file-lines:
|
|
||||||
enabled: false
|
|
||||||
method-complexity:
|
|
||||||
enabled: false
|
|
||||||
method-count:
|
|
||||||
enabled: false
|
|
||||||
method-lines:
|
|
||||||
enabled: false
|
|
||||||
nested-control-flow:
|
|
||||||
enabled: false
|
|
||||||
return-statements:
|
|
||||||
enabled: false
|
|
||||||
similar-code:
|
|
||||||
enabled: false
|
|
||||||
identical-code:
|
|
||||||
enabled: false
|
|
||||||
plugins:
|
|
||||||
gofmt:
|
|
||||||
enabled: true
|
|
||||||
eslint:
|
|
||||||
enabled: true
|
|
||||||
channel: "eslint-5"
|
|
||||||
config:
|
|
||||||
config: .eslintrc.yml
|
|
||||||
exclude_patterns:
|
|
||||||
- assets/
|
|
||||||
- build/
|
|
||||||
- dist/
|
|
||||||
- distribution/
|
|
||||||
- node_modules
|
|
||||||
- test/
|
|
||||||
- webpack/
|
|
||||||
- gruntfile.js
|
|
||||||
- webpack.config.js
|
|
||||||
- api/
|
|
||||||
- "!app/kubernetes/**"
|
|
||||||
- .github/
|
|
||||||
- .tmp/
|
|
@ -0,0 +1,29 @@
|
|||||||
|
name: Validate OpenAPI specs
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- 'release/*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
openapi-spec:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
|
||||||
|
- name: Download golang modules
|
||||||
|
run: cd ./api && go get -t -v -d ./...
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Validate OpenAPI Spec
|
||||||
|
run: make docs-validate
|
@ -1,53 +0,0 @@
|
|||||||
name: Validate
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- 'release/*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
openapi-spec:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Node v14
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 14
|
|
||||||
|
|
||||||
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Setup Go v1.17.3
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '^1.17.3'
|
|
||||||
|
|
||||||
- name: Prebuild docs
|
|
||||||
run: yarn prebuild:docs
|
|
||||||
|
|
||||||
- name: Build OpenAPI 2.0 Spec
|
|
||||||
run: yarn build:docs
|
|
||||||
|
|
||||||
# Install dependencies globally to bypass installing all frontend deps
|
|
||||||
- name: Install swagger2openapi and swagger-cli
|
|
||||||
run: yarn global add swagger2openapi @apidevtools/swagger-cli
|
|
||||||
|
|
||||||
# OpenAPI2.0 does not support multiple body params (which we utilise in some of our handlers).
|
|
||||||
# OAS3.0 however does support multiple body params - hence its best to convert the generated OAS 2.0
|
|
||||||
# to OAS 3.0 and validate the output of generated OAS 3.0 instead.
|
|
||||||
- name: Convert OpenAPI 2.0 to OpenAPI 3.0 and validate spec
|
|
||||||
run: yarn validate:docs
|
|
@ -0,0 +1,118 @@
|
|||||||
|
# See: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63
|
||||||
|
# For a list of valid GOOS and GOARCH values
|
||||||
|
# Note: these can be overriden on the command line e.g. `make PLATFORM=<platform> ARCH=<arch>`
|
||||||
|
PLATFORM=$(shell go env GOOS)
|
||||||
|
ARCH=$(shell go env GOARCH)
|
||||||
|
|
||||||
|
TAG=latest
|
||||||
|
|
||||||
|
# build target, can be one of "production", "testing", "development"
|
||||||
|
ENV=development
|
||||||
|
WEBPACK_CONFIG=webpack/webpack.$(ENV).js
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
.PHONY: help build-storybook build-client devops download-binaries tidy clean client-deps
|
||||||
|
|
||||||
|
##@ Building
|
||||||
|
|
||||||
|
init-dist:
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
build-storybook:
|
||||||
|
yarn storybook:build
|
||||||
|
|
||||||
|
build-client: init-dist ## Build the client
|
||||||
|
@export NODE_ENV=$(ENV) && yarn build --config $(WEBPACK_CONFIG)
|
||||||
|
|
||||||
|
build-server: init-dist ## Build the server binary
|
||||||
|
@./build/build_binary.sh "$(PLATFORM)" "$(ARCH)"
|
||||||
|
|
||||||
|
build: build-server build-client ## Build the server and client
|
||||||
|
|
||||||
|
build-image: build ## Build the Portainer image
|
||||||
|
docker build -t portainerci/portainer:$(TAG) -f build/linux/Dockerfile .
|
||||||
|
|
||||||
|
devops: clean init-dist download-binaries build-client ## Build the server binary for CI
|
||||||
|
echo "Building the devops binary..."
|
||||||
|
@./build/build_binary_azuredevops.sh "$(PLATFORM)" "$(ARCH)"
|
||||||
|
|
||||||
|
##@ Dependencies
|
||||||
|
|
||||||
|
download-binaries: ## Download dependant binaries
|
||||||
|
@./build/download_binaries.sh $(PLATFORM) $(ARCH)
|
||||||
|
|
||||||
|
tidy: ## Tidy up the go.mod file
|
||||||
|
cd api && go mod tidy
|
||||||
|
|
||||||
|
client-deps: ## Install client dependencies
|
||||||
|
yarn
|
||||||
|
|
||||||
|
##@ Cleanup
|
||||||
|
|
||||||
|
clean: ## Remove all build and download artifacts
|
||||||
|
@echo "Clearing the dist directory..."
|
||||||
|
@rm -rf dist/*
|
||||||
|
|
||||||
|
##@ Testing
|
||||||
|
|
||||||
|
test-client: ## Run client tests
|
||||||
|
yarn test
|
||||||
|
|
||||||
|
test-server: ## Run server tests
|
||||||
|
cd api && go test -v ./...
|
||||||
|
|
||||||
|
test: test-client test-server ## Run all tests
|
||||||
|
|
||||||
|
##@ Dev
|
||||||
|
|
||||||
|
dev-server: build-image ## Run the server in development mode
|
||||||
|
@./dev/run_container.sh
|
||||||
|
|
||||||
|
|
||||||
|
##@ Format
|
||||||
|
|
||||||
|
format-client: ## Format client code
|
||||||
|
yarn format
|
||||||
|
|
||||||
|
format-server: ## Format server code
|
||||||
|
cd api && go fmt ./...
|
||||||
|
|
||||||
|
format: format-client format-server ## Format all code
|
||||||
|
|
||||||
|
##@ Lint
|
||||||
|
|
||||||
|
lint-client: ## Lint client code
|
||||||
|
yarn lint
|
||||||
|
|
||||||
|
lint-server: ## Lint server code
|
||||||
|
cd api && go vet ./...
|
||||||
|
|
||||||
|
lint: lint-client lint-server ## Lint all code
|
||||||
|
|
||||||
|
##@ Extension
|
||||||
|
|
||||||
|
dev-extension: build-server build-client ## Run the extension in development mode
|
||||||
|
make local -f build/docker-extension/Makefile
|
||||||
|
|
||||||
|
##@ Docs
|
||||||
|
|
||||||
|
docs-deps: ## Install docs dependencies
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@v1.8.11
|
||||||
|
|
||||||
|
docs-build: docs-deps ## Build docs
|
||||||
|
cd api && swag init -g ./http/handler/handler.go --parseDependency --parseInternal --parseDepth 2 --markdownFiles ./
|
||||||
|
|
||||||
|
docs-validate: docs-build ## Validate docs
|
||||||
|
yarn swagger2openapi --warnOnly api/docs/swagger.yaml -o api/docs/openapi.yaml
|
||||||
|
yarn swagger-cli validate api/docs/openapi.yaml
|
||||||
|
|
||||||
|
docs-clean: ## Clean docs
|
||||||
|
rm -rf api/docs
|
||||||
|
|
||||||
|
docs-validate-clean: docs-validate docs-clean ## Validate and clean docs
|
||||||
|
|
||||||
|
##@ Helpers
|
||||||
|
|
||||||
|
help: ## Display this help
|
||||||
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"docker": "v20.10.21",
|
||||||
|
"dockerCompose": "v2.17.2",
|
||||||
|
"helm": "v3.11.3",
|
||||||
|
"kubectl": "v1.26.3"
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ARCHIVE_BUILD_FOLDER="/tmp/portainer-builds"
|
|
||||||
|
|
||||||
# parameter: "platform-architecture"
|
|
||||||
function build_and_push_images() {
|
|
||||||
docker build -t "portainer/portainer:$1-${VERSION}" -f build/linux/Dockerfile .
|
|
||||||
docker tag "portainer/portainer:$1-${VERSION}" "portainer/portainer:$1"
|
|
||||||
docker push "portainer/portainer:$1-${VERSION}"
|
|
||||||
docker push "portainer/portainer:$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# parameter: "platform-architecture"
|
|
||||||
function build_archive() {
|
|
||||||
BUILD_FOLDER="${ARCHIVE_BUILD_FOLDER}/$1"
|
|
||||||
rm -rf ${BUILD_FOLDER} && mkdir -pv ${BUILD_FOLDER}/portainer
|
|
||||||
cp -r dist/* ${BUILD_FOLDER}/portainer/
|
|
||||||
cd ${BUILD_FOLDER}
|
|
||||||
tar cvpfz "portainer-${VERSION}-$1.tar.gz" portainer
|
|
||||||
mv "portainer-${VERSION}-$1.tar.gz" ${ARCHIVE_BUILD_FOLDER}/
|
|
||||||
cd -
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_all() {
|
|
||||||
mkdir -pv "${ARCHIVE_BUILD_FOLDER}"
|
|
||||||
for tag in $@; do
|
|
||||||
yarn grunt "release:`echo "$tag" | tr '-' ':'`"
|
|
||||||
name="portainer"; if [ "$(echo "$tag" | cut -c1)" = "w" ]; then name="${name}.exe"; fi
|
|
||||||
mv dist/portainer-$tag* dist/$name
|
|
||||||
if [ `echo $tag | cut -d \- -f 1` == 'linux' ]; then build_and_push_images "$tag"; fi
|
|
||||||
build_archive "$tag"
|
|
||||||
done
|
|
||||||
docker rmi $(docker images -q -f dangling=true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $# -ne 1 ]] ; then
|
|
||||||
echo "Usage: $(basename $0) <VERSION>"
|
|
||||||
echo " $(basename $0) \"echo 'Custom' && <BASH COMMANDS>\""
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
VERSION="$1"
|
|
||||||
if [ `echo "$@" | cut -c1-4` == 'echo' ]; then
|
|
||||||
bash -c "$@";
|
|
||||||
else
|
|
||||||
build_all 'linux-amd64 linux-arm linux-arm64 linux-ppc64le linux-s390x darwin-amd64 windows-amd64'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
PLATFORM=${1:-"linux"}
|
||||||
|
ARCH=${2:-"amd64"}
|
||||||
|
|
||||||
|
BINARY_VERSION_FILE="./binary-version.json"
|
||||||
|
|
||||||
|
dockerVersion=$(jq -r '.docker' < "${BINARY_VERSION_FILE}")
|
||||||
|
dockerComposeVersion=$(jq -r '.dockerCompose' < "${BINARY_VERSION_FILE}")
|
||||||
|
helmVersion=$(jq -r '.helm' < "${BINARY_VERSION_FILE}")
|
||||||
|
kubectlVersion=$(jq -r '.kubectl' < "${BINARY_VERSION_FILE}")
|
||||||
|
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
echo "Downloading binaries for docker ${dockerVersion}, docker-compose ${dockerComposeVersion}, helm ${helmVersion}, kubectl ${kubectlVersion}"
|
||||||
|
|
||||||
|
./build/download_docker_binary.sh "$PLATFORM" "$ARCH" "$dockerVersion" &
|
||||||
|
./build/download_docker_compose_binary.sh "$PLATFORM" "$ARCH" "$dockerComposeVersion" &
|
||||||
|
./build/download_helm_binary.sh "$PLATFORM" "$ARCH" "$helmVersion" &
|
||||||
|
./build/download_kubectl_binary.sh "$PLATFORM" "$ARCH" "$kubectlVersion" &
|
||||||
|
wait
|
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
|
||||||
|
PORTAINER_DATA=${PORTAINER_DATA:-/tmp/portainer};
|
||||||
|
PORTAINER_PROJECT=${PORTAINER_PROJECT:-$(pwd)};
|
||||||
|
PORTAINER_FLAGS=${PORTAINER_FLAGS:-};
|
||||||
|
|
||||||
|
docker rm -f portainer
|
||||||
|
|
||||||
|
docker run -d \
|
||||||
|
-p 8000:8000 \
|
||||||
|
-p 9000:9000 \
|
||||||
|
-p 9443:9443 \
|
||||||
|
-v "$PORTAINER_PROJECT/dist:/app" \
|
||||||
|
-v "$PORTAINER_DATA:/data" \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock:z \
|
||||||
|
-v /var/run/docker.sock:/var/run/alternative.sock:z \
|
||||||
|
-v /tmp:/tmp \
|
||||||
|
--name portainer \
|
||||||
|
portainer/base \
|
||||||
|
/app/portainer "${@:PORTAINER_FLAGS}"
|
@ -0,0 +1,2 @@
|
|||||||
|
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||||
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
@ -1,238 +0,0 @@
|
|||||||
const os = require('os');
|
|
||||||
const loadGruntTasks = require('load-grunt-tasks');
|
|
||||||
const webpackDevConfig = require('./webpack/webpack.develop');
|
|
||||||
const webpackProdConfig = require('./webpack/webpack.production');
|
|
||||||
const webpackTestingConfig = require('./webpack/webpack.testing');
|
|
||||||
|
|
||||||
let arch = os.arch();
|
|
||||||
if (arch === 'x64') {
|
|
||||||
arch = 'amd64';
|
|
||||||
}
|
|
||||||
let platform = os.platform();
|
|
||||||
switch (platform) {
|
|
||||||
case 'windows':
|
|
||||||
case 'darwin':
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
platform = 'linux';
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
|
||||||
loadGruntTasks(grunt, {
|
|
||||||
pattern: ['grunt-*', 'gruntify-*'],
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.initConfig({
|
|
||||||
root: 'dist',
|
|
||||||
distdir: 'dist/public',
|
|
||||||
binaries: {
|
|
||||||
dockerVersion: 'v20.10.21',
|
|
||||||
dockerComposePluginVersion: 'v2.17.2',
|
|
||||||
helmVersion: 'v3.11.3',
|
|
||||||
kubectlVersion: 'v1.26.3',
|
|
||||||
},
|
|
||||||
env: gruntConfig.env,
|
|
||||||
clean: gruntConfig.clean,
|
|
||||||
shell: gruntConfig.shell,
|
|
||||||
webpack: gruntConfig.webpack,
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask('lint', ['eslint']);
|
|
||||||
|
|
||||||
grunt.task.registerTask('build:server', 'build:server:<platform>:<arch>', function (p = platform, a = arch) {
|
|
||||||
grunt.task.run([`shell:build_binary:${p}:${a}`, `download_binaries:${p}:${a}`]);
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask('build:client', ['webpack:dev']);
|
|
||||||
|
|
||||||
grunt.registerTask('build', ['build:server', 'build:client']);
|
|
||||||
|
|
||||||
grunt.registerTask('start:server', ['build:server:linux', 'shell:run_container']);
|
|
||||||
|
|
||||||
grunt.registerTask('start:localserver', [`shell:build_binary:${platform}:${arch}`, 'shell:run_localserver']);
|
|
||||||
|
|
||||||
grunt.registerTask('start:client', ['shell:install_yarndeps', 'webpack:devWatch']);
|
|
||||||
|
|
||||||
grunt.registerTask('start', ['start:server', 'start:client']);
|
|
||||||
|
|
||||||
grunt.registerTask('start:toolkit', ['start:localserver', 'start:client']);
|
|
||||||
|
|
||||||
grunt.task.registerTask('release', 'release:<platform>:<arch>', function (platform = 'linux', a = arch) {
|
|
||||||
grunt.task.run(['env:prod', 'clean:all', `shell:build_binary:${platform}:${a}`, `download_binaries:${platform}:${a}`, 'webpack:prod']);
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.task.registerTask('devopsbuild', 'devopsbuild:<platform>:<arch>:<env>', function (platform, a = arch, env = 'prod') {
|
|
||||||
grunt.task.run([
|
|
||||||
`env:${env}`,
|
|
||||||
'clean:all',
|
|
||||||
`shell:build_binary_azuredevops:${platform}:${a}`,
|
|
||||||
`download_binaries:${platform}:${a}`,
|
|
||||||
`webpack:${env}`,
|
|
||||||
`shell:storybook:${env}`,
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.task.registerTask('download_binaries', 'download_binaries:<platform>:<arch>', function (platform = 'linux', a = arch) {
|
|
||||||
grunt.task.run([
|
|
||||||
`shell:download_docker_binary:${platform}:${a}`,
|
|
||||||
`shell:download_docker_compose_binary:${platform}:${a}`,
|
|
||||||
`shell:download_helm_binary:${platform}:${a}`,
|
|
||||||
`shell:download_kubectl_binary:${platform}:${a}`,
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/***/
|
|
||||||
const gruntConfig = {};
|
|
||||||
|
|
||||||
gruntConfig.env = {
|
|
||||||
dev: {
|
|
||||||
NODE_ENV: 'development',
|
|
||||||
},
|
|
||||||
prod: {
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
},
|
|
||||||
testing: {
|
|
||||||
NODE_ENV: 'testing',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
gruntConfig.webpack = {
|
|
||||||
dev: webpackDevConfig,
|
|
||||||
devWatch: Object.assign({ watch: true }, webpackDevConfig),
|
|
||||||
prod: webpackProdConfig,
|
|
||||||
testing: webpackTestingConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
gruntConfig.clean = {
|
|
||||||
server: ['<%= root %>/portainer'],
|
|
||||||
client: ['<%= distdir %>/*'],
|
|
||||||
all: ['<%= root %>/*'],
|
|
||||||
};
|
|
||||||
|
|
||||||
gruntConfig.shell = {
|
|
||||||
build_binary: { command: shell_build_binary },
|
|
||||||
build_binary_azuredevops: { command: shell_build_binary_azuredevops },
|
|
||||||
download_docker_binary: { command: shell_download_docker_binary },
|
|
||||||
download_helm_binary: { command: shell_download_helm_binary },
|
|
||||||
download_kubectl_binary: { command: shell_download_kubectl_binary },
|
|
||||||
download_docker_compose_binary: { command: shell_download_docker_compose_binary },
|
|
||||||
run_container: { command: shell_run_container },
|
|
||||||
run_localserver: { command: shell_run_localserver, options: { async: true } },
|
|
||||||
install_yarndeps: { command: shell_install_yarndeps },
|
|
||||||
storybook: { command: shell_storybook },
|
|
||||||
};
|
|
||||||
|
|
||||||
function shell_storybook(env) {
|
|
||||||
if (env === 'prod') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return `
|
|
||||||
yarn build-storybook
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_build_binary(platform, arch) {
|
|
||||||
const binfile = 'dist/portainer';
|
|
||||||
if (platform === 'linux' || platform === 'darwin') {
|
|
||||||
return `
|
|
||||||
if [ -f ${binfile} ]; then
|
|
||||||
echo "Portainer binary exists";
|
|
||||||
else
|
|
||||||
build/build_binary.sh ${platform} ${arch};
|
|
||||||
fi
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// windows
|
|
||||||
return `
|
|
||||||
powershell -Command "& {if (Get-Item -Path ${binfile}.exe -ErrorAction:SilentlyContinue) {
|
|
||||||
Write-Host "Portainer binary exists"
|
|
||||||
} else {
|
|
||||||
& ".\\build\\build_binary.ps1" -platform ${platform} -arch ${arch}
|
|
||||||
}}"
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_build_binary_azuredevops(platform, arch) {
|
|
||||||
return `build/build_binary_azuredevops.sh ${platform} ${arch};`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_run_container() {
|
|
||||||
const portainerData = '${PORTAINER_DATA:-/tmp/portainer}';
|
|
||||||
const portainerRoot = process.env.PORTAINER_PROJECT ? process.env.PORTAINER_PROJECT : process.env.PWD;
|
|
||||||
const portainerFlags = '${PORTAINER_FLAGS:-}';
|
|
||||||
|
|
||||||
return `
|
|
||||||
docker rm -f portainer
|
|
||||||
docker run -d \
|
|
||||||
-p 8000:8000 \
|
|
||||||
-p 9000:9000 \
|
|
||||||
-p 9443:9443 \
|
|
||||||
-v ${portainerRoot}/dist:/app \
|
|
||||||
-v ${portainerData}:/data \
|
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock:z \
|
|
||||||
-v /var/run/docker.sock:/var/run/alternative.sock:z \
|
|
||||||
-v /tmp:/tmp \
|
|
||||||
--name portainer \
|
|
||||||
portainer/base \
|
|
||||||
/app/portainer ${portainerFlags}
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_run_localserver() {
|
|
||||||
return './dist/portainer';
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_install_yarndeps() {
|
|
||||||
return 'yarn';
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_download_docker_binary(platform, arch) {
|
|
||||||
const binaryVersion = '<%= binaries.dockerVersion %>';
|
|
||||||
|
|
||||||
return `
|
|
||||||
if [ -f dist/docker ] || [ -f dist/docker.exe ]; then
|
|
||||||
echo "docker binary exists";
|
|
||||||
else
|
|
||||||
build/download_docker_binary.sh ${platform} ${arch} ${binaryVersion};
|
|
||||||
fi
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_download_docker_compose_binary(platform, arch) {
|
|
||||||
var binaryVersion = '<%= binaries.dockerComposePluginVersion %>';
|
|
||||||
|
|
||||||
return `
|
|
||||||
if [ -f dist/docker-compose ] || [ -f dist/docker-compose.exe ]; then
|
|
||||||
echo "docker compose binary exists";
|
|
||||||
else
|
|
||||||
build/download_docker_compose_binary.sh ${platform} ${arch} ${binaryVersion};
|
|
||||||
fi
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_download_helm_binary(platform, arch) {
|
|
||||||
var binaryVersion = '<%= binaries.helmVersion %>';
|
|
||||||
|
|
||||||
return `
|
|
||||||
if [ -f dist/helm ] || [ -f dist/helm.exe ]; then
|
|
||||||
echo "helm binary exists";
|
|
||||||
else
|
|
||||||
build/download_helm_binary.sh ${platform} ${arch} ${binaryVersion};
|
|
||||||
fi
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shell_download_kubectl_binary(platform, arch) {
|
|
||||||
var binaryVersion = '<%= binaries.kubectlVersion %>';
|
|
||||||
|
|
||||||
return `
|
|
||||||
if [ -f dist/kubectl ] || [ -f dist/kubectl.exe ]; then
|
|
||||||
echo "kubectl binary exists";
|
|
||||||
else
|
|
||||||
build/download_kubectl_binary.sh ${platform} ${arch} ${binaryVersion};
|
|
||||||
fi
|
|
||||||
`;
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "This file contains current tool versions",
|
|
||||||
"go_version": "v1.17.6",
|
|
||||||
"node_version": "12.x",
|
|
||||||
"yarn_version": "1.x"
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
module.exports = require('./webpack/webpack.develop');
|
module.exports = require('./webpack/webpack.development');
|
||||||
|
Loading…
Reference in new issue