get rid of install.sh

This commit is contained in:
Elio Bischof
2022-08-04 16:48:48 +02:00
parent af03bbd117
commit c677a1808f
9 changed files with 31 additions and 83 deletions

3
.artifacts/zitadel/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*
!.gitignore
!.gitkeep

View File

View File

@@ -28,11 +28,14 @@ jobs:
- name: Install NPM Modules
working-directory: ./console
run: npm ci
- name: Test
run: ./e2e/install.sh
- name: Build and Test Binary
run: GOOS="linux" GOARCH="amd64" goreleaser build --snapshot --single-target --rm-dist --single-target --output .artifacts/zitadel/zitadel
- name: Publish go coverage
uses: codecov/codecov-action@v3.1.0
with:
file: .artifacts/codecov/profile.cov
name: go-codecov
- name: Build Docker Image
run: ./e2e/docker-compose.sh build
- name: Run E2E Tests
run: ./e2e/docker-compose.sh run e2e

3
.gitignore vendored
View File

@@ -61,6 +61,7 @@ openapi/**/*.json
build/local/*.env
migrations/cockroach/migrate_cloud.go
.notifications
.artifacts
/.artifacts/*
!/.artifacts/zitadel
/zitadel

View File

@@ -1,4 +1,5 @@
import { defineConfig } from 'cypress';
import { env } from 'process';
let tokensCache = new Map<string,string>()
let initmfaandpwrequired = true
@@ -17,7 +18,12 @@ export default defineConfig({
trashAssetsBeforeRuns: false,
defaultCommandTimeout: 10000,
env: {
ORGANIZATION: process.env.CYPRESS_ORGANIZATION || 'zitadel'
},
e2e: {
baseUrl: process.env.CYPRESS_BASE_URL || 'http://localhost:8080',
experimentalSessionAndOrigin: true,
setupNodeEvents(on, config) {
require('cypress-terminal-report/src/installLogsPrinter')(on);
@@ -33,18 +39,6 @@ export default defineConfig({
return tokensCache.get(key) || null;
}
})
on('task', {
initmfaandpwrequired(){
if (config.env.noInitMFAAndPWRequired == 'true'){
initmfaandpwrequired = false
}
if (initmfaandpwrequired){
initmfaandpwrequired = false
return true
}
return false
}
})
},
},
});

View File

@@ -7,8 +7,12 @@
"build": "ng build",
"prodbuild": "ng build --configuration production --base-href=/ui/console/",
"lint": "ng lint && stylelint './src/**/*.scss' --syntax scss",
"e2e": "./cypress.sh run ../e2e/dev.env",
"e2e:open": "./cypress.sh open ../e2e/dev.env"
"e2e:build:binary": "cd .. && GOOS=linux GOARCH=amd64 goreleaser build --snapshot --single-target --rm-dist --output .artifacts/zitadel/zitadel",
"e2e:build:image": "../e2e/docker-compose.sh build",
"e2e:build": "npm run e2e:build:binary && npm run e2e:build:image",
"e2e:test": "../e2e/docker-compose.sh run e2e",
"e2e": "npm run e2e:build && npm run e2e:test",
"e2e:open": "npx cypress open"
},
"private": true,
"dependencies": {

View File

@@ -1,6 +1,9 @@
services:
zitadel:
image: '${ZITADEL_IMAGE}'
image: ${ZITADEL_IMAGE:-zitadel:latest}
build:
context: ../.artifacts/zitadel
dockerfile: ../../build/Dockerfile
environment:
# TODO: localhost?
ZITADEL_EXTERNALDOMAIN: zitadel
@@ -16,6 +19,6 @@ services:
- zitadel
working_dir: /e2e
volumes:
- ${PWD}/console:/e2e
- ../console:/e2e
networks:
- zitadel

View File

@@ -1,3 +1,5 @@
#!/bin/bash
COMPOSE_DOCKER_CLI_BUILD=1 docker compose --file ${projectRoot}/e2e/docker-compose-workdir.yaml --file ${projectRoot}/docs/docs/guides/deploy/docker-compose.yaml --file ${projectRoot}/e2e/docker-compose-overwrite.yaml "$@"
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
COMPOSE_DOCKER_CLI_BUILD=1 docker compose --file ${SCRIPTPATH}/docker-compose-workdir.yaml --file ${SCRIPTPATH}/../docs/docs/guides/deploy/docker-compose.yaml --file ${SCRIPTPATH}/docker-compose-overwrite.yaml "$@"

View File

@@ -1,62 +0,0 @@
#!/bin/bash
# TODO: ONLY BUILD HERE AND PRINT BUILT IMAGE TO STDOUT?
set -e
export projectRoot="."
DO_BUILD=1
DO_DEPLOY=1
while getopts 'bd:' OPTION; do
case "$OPTION" in
b)
echo "skipping build"
DO_BUILD=0
;;
d)
echo "skipping deployment"
DO_DEPLOY=0
;;
?)
echo "script usage: $(basename \$0) [-b] [-d] [-t]" >&2
echo "-b skip build"
echo "-d skip deployment"
exit 1
;;
esac
done
shift "$(($OPTIND -1))"
if [ "$DO_BUILD" -eq "1" ]; then
# build the zitadel binary
GOOS="linux" GOARCH="amd64" goreleaser build --snapshot --single-target --rm-dist
fi
# extract some metadata for building and tagging the docker image
function extract_metadata ()
{
cat .artifacts/goreleaser/$1 | jq -r $2
}
BUILD_DATE="$(extract_metadata metadata.json '.date')"
# Use simple local date
BUILD_DATE="${BUILD_DATE%.*}"
# Replace colons and plus signs
export BUILD_DATE="${BUILD_DATE//:/_}"
export ZITADEL_IMAGE="${ZITADEL_IMAGE:-zitadel:${BUILD_DATE}}"
if [ "$DO_BUILD" -eq "1" ]; then
BUILD_PATH="$(dirname $(extract_metadata artifacts.json '.[0].path'))"
BUILD_VERSION="$(extract_metadata metadata.json '.version')"
# build the docker image
DOCKER_BUILDKIT=1 docker build --file ./build/Dockerfile --tag zitadel:latest --tag zitadel:$BUILD_VERSION --tag zitadel:$BUILD_DATE $BUILD_PATH
fi
if [ "$DO_DEPLOY" -eq "1" ]; then
echo "Testing ZITADEL image $ZITADEL_IMAGE"
# run cockroach and zitadel
./e2e/docker-compose.sh run e2e
fi