From eba8279b468d8cf33f918ee3b82fa8c445895c5e Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 16:34:24 +0800 Subject: [PATCH 01/14] wip: integration tests --- .github/workflows/integration_test.yml | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/integration_test.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml new file mode 100644 index 00000000..fa7261f9 --- /dev/null +++ b/.github/workflows/integration_test.yml @@ -0,0 +1,66 @@ +name: Integration test + +env: + GO_VERSION: 1.23.4 + NODEJS_VERSION: 20.18.2 + PNPM_VERSION: 'latest' + +on: + pull_request: + +jobs: + integration_test: + runs-on: ubuntu-latest + + steps: + - name: Checkout current repository + uses: actions/checkout@v4 + + - name: Checkout framework repository + uses: actions/checkout@v4 + with: + repository: infinilabs/framework + path: framework + + - name: Checkout framework-vendor + uses: actions/checkout@v4 + with: + ref: main + repository: infinilabs/framework-vendor + path: vendor + + - name: Set up nodejs toolchain + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODEJS_VERSION }} + + - name: Check nodejs toolchain + run: | + if ! command -v pnpm >/dev/null 2>&1; then + npm install -g pnpm + fi + node -v && npm -v && pnpm -v + + - name: Set up go toolchain + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + check-latest: false + cache: true + + - name: Set up Easysearch + run: | + mkdir ~/es_install_dir + curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir + # Set initial Easysearch password for the admin account + echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=for_tests_only" >> $GITHUB_ENV + # Run it silently + cd ~/es_install_dir && nohup ./easysearch & + # Verify that it functions normally + curl -u admin:for_tests_only https://127.0.0.1:9200 + + - name: Build Coco server + + + + \ No newline at end of file From 431af0a980e6c08cf8455df7b21bf219380c8061 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 16:36:20 +0800 Subject: [PATCH 02/14] Remove other CI pipelines --- .github/workflows/build-docs.yml | 119 ------- .github/workflows/commit-message-check.yml | 35 --- .github/workflows/integration_test.yml | 3 - .github/workflows/osv-scanner.yml | 34 -- .github/workflows/unit_test.yml | 342 --------------------- 5 files changed, 533 deletions(-) delete mode 100644 .github/workflows/build-docs.yml delete mode 100644 .github/workflows/commit-message-check.yml delete mode 100644 .github/workflows/osv-scanner.yml delete mode 100644 .github/workflows/unit_test.yml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml deleted file mode 100644 index 9e3f1ce6..00000000 --- a/.github/workflows/build-docs.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Build and Deploy Docs - -on: - push: - branches: - - main - - 'v*' - tags: - - 'v*' - -jobs: - build-deploy-docs: - runs-on: ubuntu-latest - - steps: - - name: Checkout Product Repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set Variables Based on Ref - id: vars - run: | - PRODUCT_NAME=$(basename $(pwd)) # Get the directory name as the product name - echo "PRODUCT_NAME=$PRODUCT_NAME" >> $GITHUB_ENV - CURRENT_REF=${GITHUB_REF##*/} - IS_SEMVER=false - SEMVER_REGEX="^v([0-9]+)\.([0-9]+)\.([0-9]+)$" - - if [[ "${GITHUB_REF_TYPE}" == "branch" ]]; then - if [[ "$CURRENT_REF" == "main" ]]; then - echo "VERSION=main" >> $GITHUB_ENV - echo "BRANCH=main" >> $GITHUB_ENV - elif [[ "$CURRENT_REF" =~ $SEMVER_REGEX ]]; then - IS_SEMVER=true - echo "VERSION=$CURRENT_REF" >> $GITHUB_ENV - echo "BRANCH=$CURRENT_REF" >> $GITHUB_ENV - else - echo "Branch '$CURRENT_REF' is not a valid semantic version. Skipping build." - exit 0 - fi - elif [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then - if [[ "$CURRENT_REF" =~ $SEMVER_REGEX ]]; then - IS_SEMVER=true - echo "VERSION=$CURRENT_REF" >> $GITHUB_ENV - echo "BRANCH=main" >> $GITHUB_ENV # Set BRANCH to 'main' for tags - else - echo "Tag '$CURRENT_REF' is not a valid semantic version. Skipping build." - exit 0 - fi - fi - - # Gather branches and tags, filter for semantic versions, sort, remove duplicates - VERSIONS=$(git for-each-ref refs/remotes/origin refs/tags --format="%(refname:short)" | \ - grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -Vr | uniq | tr '\n' ',' | sed 's/,$//') - echo "VERSIONS=main,$VERSIONS" >> $GITHUB_ENV - - - name: Install Hugo - run: | - wget https://github.com/gohugoio/hugo/releases/download/v0.79.1/hugo_extended_0.79.1_Linux-64bit.tar.gz - tar -xzvf hugo_extended_0.79.1_Linux-64bit.tar.gz - sudo mv hugo /usr/local/bin/ - - - name: Checkout Docs Repo - uses: actions/checkout@v2 - with: - repository: infinilabs/docs - path: docs-output - token: ${{ secrets.DOCS_DEPLOYMENT_TOKEN }} - - - name: Build Documentation - run: | - (cd docs && OUTPUT=$(pwd)/../docs-output make docs-build docs-place-redirect) - - - name: Commit and Push Changes to Docs Repo - working-directory: docs-output - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - if [[ -n $(git status --porcelain) ]]; then - git add . - git commit -m "Rebuild $PRODUCT_NAME docs for version $VERSION" - git push origin main - else - echo "No changes to commit." - fi - - - name: Rebuild Docs for Latest Version (main), if not already on main - run: | - # Only rebuild the main branch docs if the current ref is not "main" - if [[ "$CURRENT_REF" != "main" ]]; then - echo "Switching to main branch and rebuilding docs for 'latest'" - - # Checkout the main branch of the product repo to rebuild docs for "latest" - git checkout main - - # Ensure the latest changes are pulled - git pull origin main - - # Build Docs for Main Branch (latest) - (cd docs && OUTPUT=$(pwd)/../docs-output VERSION="main" BRANCH="main" make docs-build docs-place-redirect) - - # Commit and Push Latest Docs to Main - cd docs-output - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - if [[ -n $(git status --porcelain) ]]; then - git add . - git commit -m "Rebuild $PRODUCT_NAME docs for main branch with latest version" - git push origin main - else - echo "No changes to commit for main." - fi - else - echo "Current ref is 'main', skipping rebuild for 'latest'." - fi - working-directory: ./ # Working in the product repo diff --git a/.github/workflows/commit-message-check.yml b/.github/workflows/commit-message-check.yml deleted file mode 100644 index 98cf2279..00000000 --- a/.github/workflows/commit-message-check.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 'commit-message-check' -on: - pull_request: - -jobs: - check-commit-message: - name: check-subject - runs-on: ubuntu-latest - steps: - - name: check-subject-type - uses: gsactions/commit-message-checker@v2 - with: - checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request - excludeDescription: 'true' # optional: this excludes the description body of a pull request - accessToken: ${{ secrets.GITHUB_TOKEN }} - pattern: '^(change:|feat:|improve:|perf:|dep:|docs:|test:|ci:|style:|refactor:|fix:|fixdoc:|fixup:|merge|Merge|update|Update|bumpver:|chore:|build:) .+$' - flags: 'gm' - error: | - Subject line has to contain a commit type, e.g.: "chore: blabla" or a merge commit e.g.: "merge xxx". - Valid types are: - change - API breaking change - feat - API compatible new feature - improve - Become better without functional changes - perf - Performance improvement - dep - dependency update - docs - docs update - test - test udpate - ci - CI workflow update - refactor - refactor without function change. - fix - fix bug - fixdoc - fix doc - fixup - minor change: e.g., fix sth mentioned in a review. - bumpver - Bump to a new version. - chore - Nothing important. - build - bot: dependabot. \ No newline at end of file diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index fa7261f9..b78bd67d 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -59,8 +59,5 @@ jobs: # Verify that it functions normally curl -u admin:for_tests_only https://127.0.0.1:9200 - - name: Build Coco server - - \ No newline at end of file diff --git a/.github/workflows/osv-scanner.yml b/.github/workflows/osv-scanner.yml deleted file mode 100644 index a0b639b7..00000000 --- a/.github/workflows/osv-scanner.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# A sample workflow which sets up periodic OSV-Scanner scanning for vulnerabilities, -# in addition to a PR check which fails if new vulnerabilities are introduced. -# -# For more examples and options, including how to ignore specific vulnerabilities, -# see https://google.github.io/osv-scanner/github-action/ - -name: OSV-Scanner - -on: - pull_request: - branches: [ "main" ] - -permissions: - # Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 - actions: read - # Require writing security events to upload SARIF file to security tab - security-events: write - # Only need to read contents - contents: read - -jobs: - scan-pr: - uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v2.0.2" - with: - fail-on-vuln: false - scan-args: |- - --recursive - --skip-git - /github/workspace diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml deleted file mode 100644 index aa9ec80c..00000000 --- a/.github/workflows/unit_test.yml +++ /dev/null @@ -1,342 +0,0 @@ -name: Unit Test - -on: - pull_request: - branches: [ "main" ] - -defaults: - run: - shell: bash - -env: - PNAME: coco - GO_VERSION: 1.23.4 - NODEJS_VERSION: 20.18.2 - PNPM_VERSION: 'latest' - -jobs: - format_check: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - with: - path: ${{ env.PNAME }} - - - name: Checkout framework repository - uses: actions/checkout@v4 - with: - repository: infinilabs/framework - path: framework - - - name: Checkout framework-vendor - uses: actions/checkout@v4 - with: - ref: main - repository: infinilabs/framework-vendor - path: vendor - - - name: Set up nodejs toolchain - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEJS_VERSION }} - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Check nodejs toolchain - run: | - if ! command -v pnpm >/dev/null 2>&1; then - npm install -g pnpm - fi - node -v && npm -v && pnpm -v - - - name: Set up go toolchain - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: false - cache: true - - - name: Check go toolchain - run: go version - - - name: Cache Build Output - uses: actions/cache@v4 - with: - path: | - .public - key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}- - ${{ runner.os }}-build- - - - name: Code format - env: - GOFLAGS: -tags=ci - run: | - echo Home path is $HOME - export WORKBASE=$HOME/go/src/infini.sh - export WORK=$WORKBASE/$PNAME - - # for test workspace - mkdir -p $HOME/go/src/ - ln -s $GITHUB_WORKSPACE $WORKBASE - - # for web build - cd $WORK/web && sed -i '/prepare/d' package.json - pnpm install --registry=https://registry.npmjs.com --quiet && pnpm build -- --silent - - # check work folder - ls -lrt $WORKBASE/ - ls -alrt $WORK - - # for code format - cd $WORK - echo Formating code at $PWD ... - make format - if [ $? -ne 0 ]; then - echo "make format failed, please check make output" - exit 1 - fi - - - name: Check for changes after format - id: check-changes - shell: bash - run: | - export WORKBASE=$HOME/go/src/infini.sh - export WORK=$WORKBASE/$PNAME - - # for foramt check - cd $WORK - if [[ $(git status --porcelain | grep -c " M .*\.go$") -gt 0 ]]; then - echo "go format detected formatting changes" - echo "changes=true" >> $GITHUB_OUTPUT - else - echo "go format no changes found" - echo "changes=false" >> $GITHUB_OUTPUT - fi - - - name: Fail workflow if changes after format - if: steps.check-changes.outputs.changes == 'true' - run: | - export WORKBASE=$HOME/go/src/infini.sh - export WORK=$WORKBASE/$PNAME - - # for foramt check - cd $WORK && echo - git status --porcelain | grep " M .*\.go$" - echo "----------------------------------------------------------------------------------" - echo "IMPORTANT: Above files are not formatted, please run 'make format' to format them." - echo "----------------------------------------------------------------------------------" - exit 1 - - unit_test: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - with: - path: ${{ env.PNAME }} - - - name: Checkout framework repository - uses: actions/checkout@v4 - with: - repository: infinilabs/framework - path: framework - - - name: Checkout framework-vendor - uses: actions/checkout@v4 - with: - ref: main - repository: infinilabs/framework-vendor - path: vendor - - - name: Set up nodejs toolchain - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEJS_VERSION }} - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Check nodejs toolchain - run: | - if ! command -v pnpm >/dev/null 2>&1; then - npm install -g pnpm - fi - node -v && npm -v && pnpm -v - - - name: Set up go toolchain - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: false - cache: true - - - name: Check go toolchain - run: go version - - - name: Cache Build Output - uses: actions/cache@v4 - with: - path: | - .public - key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}- - ${{ runner.os }}-build- - - - name: Unit test - env: - GOFLAGS: -tags=ci - run: | - echo Home path is $HOME - export WORKBASE=$HOME/go/src/infini.sh - export WORK=$WORKBASE/$PNAME - - # for test workspace - mkdir -p $HOME/go/src/ - ln -s $GITHUB_WORKSPACE $WORKBASE - - # for web build - echo "Build $PNAME web start..." - cd $WORK/web && sed -i '/prepare/d' package.json - pnpm install --registry=https://registry.npmjs.com --quiet && pnpm build -- --silent - - # check work folder - ls -lrt $WORKBASE/ - ls -alrt $WORK - - # for unit test - cd $WORK - echo Testing code at $PWD ... - OFFLINE_BUILD=true CI=true make test - - code_lint: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - with: - path: ${{ env.PNAME }} - - - name: Checkout framework repository - uses: actions/checkout@v4 - with: - repository: infinilabs/framework - path: framework - - - name: Checkout framework-vendor - uses: actions/checkout@v4 - with: - ref: main - repository: infinilabs/framework-vendor - path: vendor - - - name: Set up nodejs toolchain - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEJS_VERSION }} - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Check nodejs toolchain - run: | - if ! command -v pnpm >/dev/null 2>&1; then - npm install -g pnpm - fi - node -v && npm -v && pnpm -v - - - name: Set up go toolchain - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: false - cache: true - - - name: Check go toolchain - run: go version - - - name: Cache Build Output - uses: actions/cache@v4 - with: - path: | - .public - key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}- - ${{ runner.os }}-build- - - - name: Code lint - env: - GOFLAGS: -tags=ci - run: | - echo Home path is $HOME - export WORKBASE=$HOME/go/src/infini.sh - export WORK=$WORKBASE/$PNAME - - # for test workspace - mkdir -p $HOME/go/src/ - ln -s $GITHUB_WORKSPACE $WORKBASE - - # for web build - echo "Build $PNAME web start..." - cd $WORK/web && sed -i '/prepare/d' package.json - pnpm install --registry=https://registry.npmjs.com --quiet && pnpm build -- --silent - - # check work folder - ls -lrt $WORKBASE/ - ls -alrt $WORK - - # for code lint - cd $WORK - echo Linting code at $PWD ... - # make lint - - web_test: - runs-on: ubuntu-latest - steps: - - name: Checkout current repository - uses: actions/checkout@v4 - with: - path: ${{ env.PNAME }} - - - name: Set up nodejs toolchain - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEJS_VERSION }} - cache: 'npm' - cache-dependency-path: "**/package.json" - - - name: Check nodejs toolchain - run: | - if ! command -v pnpm >/dev/null 2>&1; then - npm install -g pnpm - fi - node -v && npm -v && pnpm -v - - - name: Check web build - run: | - echo Home path is $HOME - cd $GITHUB_WORKSPACE/$PNAME/web - pnpm install --registry=https://registry.npmjs.com --quiet && pnpm build -- --silent From b7f7aa438b85278dfac409809a9d9538057cd19b Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 16:39:02 +0800 Subject: [PATCH 03/14] Correct commands to start Easysearch --- .github/workflows/integration_test.yml | 72 +++++++++++++------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index b78bd67d..cdb492f9 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -13,40 +13,40 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout current repository - uses: actions/checkout@v4 - - - name: Checkout framework repository - uses: actions/checkout@v4 - with: - repository: infinilabs/framework - path: framework - - - name: Checkout framework-vendor - uses: actions/checkout@v4 - with: - ref: main - repository: infinilabs/framework-vendor - path: vendor - - - name: Set up nodejs toolchain - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODEJS_VERSION }} - - - name: Check nodejs toolchain - run: | - if ! command -v pnpm >/dev/null 2>&1; then - npm install -g pnpm - fi - node -v && npm -v && pnpm -v - - - name: Set up go toolchain - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: false - cache: true + # - name: Checkout current repository + # uses: actions/checkout@v4 + + # - name: Checkout framework repository + # uses: actions/checkout@v4 + # with: + # repository: infinilabs/framework + # path: framework + + # - name: Checkout framework-vendor + # uses: actions/checkout@v4 + # with: + # ref: main + # repository: infinilabs/framework-vendor + # path: vendor + + # - name: Set up nodejs toolchain + # uses: actions/setup-node@v4 + # with: + # node-version: ${{ env.NODEJS_VERSION }} + + # - name: Check nodejs toolchain + # run: | + # if ! command -v pnpm >/dev/null 2>&1; then + # npm install -g pnpm + # fi + # node -v && npm -v && pnpm -v + + # - name: Set up go toolchain + # uses: actions/setup-go@v5 + # with: + # go-version: ${{ env.GO_VERSION }} + # check-latest: false + # cache: true - name: Set up Easysearch run: | @@ -54,8 +54,8 @@ jobs: curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir # Set initial Easysearch password for the admin account echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=for_tests_only" >> $GITHUB_ENV - # Run it silently - cd ~/es_install_dir && nohup ./easysearch & + cd ~/es_install_dir && ./bin/initialize.sh + cd ~/es_install_dir && nohup ./bin/easysearch & # Verify that it functions normally curl -u admin:for_tests_only https://127.0.0.1:9200 From 7a9357add1344ae1d96cb5145976edb778a75e13 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 16:56:51 +0800 Subject: [PATCH 04/14] Correct scripts --- .github/workflows/integration_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index cdb492f9..5b0c8d39 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -54,10 +54,10 @@ jobs: curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir # Set initial Easysearch password for the admin account echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=for_tests_only" >> $GITHUB_ENV - cd ~/es_install_dir && ./bin/initialize.sh + cd ~/es_install_dir && yes | ./bin/initialize.sh cd ~/es_install_dir && nohup ./bin/easysearch & # Verify that it functions normally - curl -u admin:for_tests_only https://127.0.0.1:9200 + curl -k -u admin:for_tests_only https://127.0.0.1:9200 \ No newline at end of file From 43856b971c623b39383c4c7049dff205ceed641b Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:01:14 +0800 Subject: [PATCH 05/14] Try setting the password directly --- .github/workflows/integration_test.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 5b0c8d39..dc68cdff 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -4,6 +4,7 @@ env: GO_VERSION: 1.23.4 NODEJS_VERSION: 20.18.2 PNPM_VERSION: 'latest' + ES_ADMIN_PASSWORD: 'for_tests_only' on: pull_request: @@ -52,12 +53,9 @@ jobs: run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - # Set initial Easysearch password for the admin account - echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=for_tests_only" >> $GITHUB_ENV - cd ~/es_install_dir && yes | ./bin/initialize.sh + EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{env.ES_ADMIN_PASSWORD}} cd ~/es_install_dir && yes | ./bin/initialize.sh cd ~/es_install_dir && nohup ./bin/easysearch & - # Verify that it functions normally - curl -k -u admin:for_tests_only https://127.0.0.1:9200 + curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From fafffbaafa8c0ca4f29c83e6bd1646c5cb544d9a Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:07:25 +0800 Subject: [PATCH 06/14] Debug the reason why EASYSEARCH_INITIAL_ADMIN_PASSWORD is not set --- .github/workflows/integration_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index dc68cdff..53419e79 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -53,7 +53,11 @@ jobs: run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{env.ES_ADMIN_PASSWORD}} cd ~/es_install_dir && yes | ./bin/initialize.sh + echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV + echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD + echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD + echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD + cd ~/es_install_dir && yes | ./bin/initialize.sh cd ~/es_install_dir && nohup ./bin/easysearch & curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 From 5141c2f7ea133e31441a92b0f09cdf90033962d3 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:15:22 +0800 Subject: [PATCH 07/14] Set env var for cd dir | ./initialize.sh --- .github/workflows/integration_test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 53419e79..3212cb5d 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -50,14 +50,11 @@ jobs: # cache: true - name: Set up Easysearch + shell: bash run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV - echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD - echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD - echo $EASYSEARCH_INITIAL_ADMIN_PASSWORD - cd ~/es_install_dir && yes | ./bin/initialize.sh + cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} yes | ./bin/initialize.sh cd ~/es_install_dir && nohup ./bin/easysearch & curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 From 2619f8da5b2a06982b6ea34ae87d5dcb5a169622 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:22:56 +0800 Subject: [PATCH 08/14] Format yaml file --- .github/workflows/integration_test.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 3212cb5d..0a3d16ad 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -49,14 +49,11 @@ jobs: # check-latest: false # cache: true - - name: Set up Easysearch - shell: bash - run: | - mkdir ~/es_install_dir - curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} yes | ./bin/initialize.sh - cd ~/es_install_dir && nohup ./bin/easysearch & - curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 - - - \ No newline at end of file + - name: Set up Easysearch + shell: bash + run: | + mkdir ~/es_install_dir + curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir + cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} yes | ./bin/initialize.sh + cd ~/es_install_dir && nohup ./bin/easysearch & + curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From ec507d4dc5931bb37625cf794c37619f366aedc5 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:30:36 +0800 Subject: [PATCH 09/14] Set EASYSEARCH_INITIAL_ADMIN_PASSWORD in a separate step --- .github/workflows/integration_test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 0a3d16ad..70265e6a 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -4,7 +4,7 @@ env: GO_VERSION: 1.23.4 NODEJS_VERSION: 20.18.2 PNPM_VERSION: 'latest' - ES_ADMIN_PASSWORD: 'for_tests_only' + ES_ADMIN_PASSWORD: 'F0r_test_ci' on: pull_request: @@ -48,12 +48,15 @@ jobs: # go-version: ${{ env.GO_VERSION }} # check-latest: false # cache: true + + - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD + run: echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV - name: Set up Easysearch shell: bash run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} yes | ./bin/initialize.sh + cd ~/es_install_dir && yes | ./bin/initialize.sh cd ~/es_install_dir && nohup ./bin/easysearch & curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From 4ddd60abaacba5957d8f182ba0d1764634b846d1 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:39:53 +0800 Subject: [PATCH 10/14] use -s option to confirm installation --- .github/workflows/integration_test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 70265e6a..cdf5fc60 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -48,15 +48,12 @@ jobs: # go-version: ${{ env.GO_VERSION }} # check-latest: false # cache: true - - - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD - run: echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV - name: Set up Easysearch shell: bash run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - cd ~/es_install_dir && yes | ./bin/initialize.sh + cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{env.EASYSEARCH_INITIAL_ADMIN_PASSWORD}} ./bin/initialize.sh -s cd ~/es_install_dir && nohup ./bin/easysearch & curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From 4af8e23340f697ab37739ebb4c79468e9b4142cb Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:42:27 +0800 Subject: [PATCH 11/14] Set EASYSEARCH_INITIAL_ADMIN_PASSWORD in a separate step --- .github/workflows/integration_test.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index cdf5fc60..0fe47927 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -48,12 +48,21 @@ jobs: # go-version: ${{ env.GO_VERSION }} # check-latest: false # cache: true + + # I have no idea why ./bin/initialize.sh does not accept this var when + # I set it via + # + # $ EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" ./bin/initialize.sh + # + # So I have to set it here, in a separate step + - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD + run: echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV - name: Set up Easysearch shell: bash run: | mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - cd ~/es_install_dir && EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{env.EASYSEARCH_INITIAL_ADMIN_PASSWORD}} ./bin/initialize.sh -s + cd ~/es_install_dir && ./bin/initialize.sh -s cd ~/es_install_dir && nohup ./bin/easysearch & curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From d9dc10f40179a259ba788a47069ccffea35d730d Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 17:55:26 +0800 Subject: [PATCH 12/14] Wait for Easysearch to start --- .github/workflows/integration_test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 0fe47927..cc2a52cf 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -52,7 +52,7 @@ jobs: # I have no idea why ./bin/initialize.sh does not accept this var when # I set it via # - # $ EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" ./bin/initialize.sh + # $ EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} ./bin/initialize.sh # # So I have to set it here, in a separate step - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD @@ -64,5 +64,9 @@ jobs: mkdir ~/es_install_dir curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir cd ~/es_install_dir && ./bin/initialize.sh -s - cd ~/es_install_dir && nohup ./bin/easysearch & + cd ~/es_install_dir && nohup ./bin/easysearch > easysearch.log 2>&1 & + while ! nc -z 127.0.0.1 9200; do + echo "Easysearch is not up. Will re-check in 5 seconds..." + sleep 5 + done curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file From dbde402946e97e693783341b361547c9e4e9df7f Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 18:02:56 +0800 Subject: [PATCH 13/14] Install loadgen and ensure it is in PATH --- .github/workflows/integration_test.yml | 45 +++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index cc2a52cf..d01eb957 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -49,24 +49,31 @@ jobs: # check-latest: false # cache: true - # I have no idea why ./bin/initialize.sh does not accept this var when - # I set it via - # - # $ EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} ./bin/initialize.sh - # - # So I have to set it here, in a separate step - - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD - run: echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV + # # I have no idea why ./bin/initialize.sh does not accept this var when + # # I set it via + # # + # # $ EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }} ./bin/initialize.sh + # # + # # So I have to set it here, in a separate step + # - name: Set env var EASYSEARCH_INITIAL_ADMIN_PASSWORD + # run: echo "EASYSEARCH_INITIAL_ADMIN_PASSWORD=${{ env.ES_ADMIN_PASSWORD }}" >> $GITHUB_ENV - - name: Set up Easysearch - shell: bash + # - name: Set up Easysearch + # run: | + # mkdir ~/es_install_dir + # curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir + # cd ~/es_install_dir && ./bin/initialize.sh -s + # cd ~/es_install_dir && nohup ./bin/easysearch > easysearch.log 2>&1 & + # while ! nc -z 127.0.0.1 9200; do + # echo "Easysearch is not up. Will re-check in 5 seconds..." + # sleep 5 + # done + # curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 + + - name: Install Loadgen run: | - mkdir ~/es_install_dir - curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d ~/es_install_dir - cd ~/es_install_dir && ./bin/initialize.sh -s - cd ~/es_install_dir && nohup ./bin/easysearch > easysearch.log 2>&1 & - while ! nc -z 127.0.0.1 9200; do - echo "Easysearch is not up. Will re-check in 5 seconds..." - sleep 5 - done - curl -k -u admin:${{env.ES_ADMIN_PASSWORD}} https://127.0.0.1:9200 \ No newline at end of file + mkdir ~/loadgen_install_dir + curl -sSL http://get.infini.cloud | bash -s -- -p ~/loadgen_install_dir + sudo mv ~/loadgen_install_dir/loadgen /usr/bin + sudo chmod +x /usr/bin/loadgen + loadgen From ec0b549f622f9b731cc4ffaa6e164312317fcc20 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Fri, 7 Nov 2025 18:09:48 +0800 Subject: [PATCH 14/14] Install loadgen, 2nd try --- .github/workflows/integration_test.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index d01eb957..4404e51d 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -73,7 +73,12 @@ jobs: - name: Install Loadgen run: | mkdir ~/loadgen_install_dir - curl -sSL http://get.infini.cloud | bash -s -- -p ~/loadgen_install_dir - sudo mv ~/loadgen_install_dir/loadgen /usr/bin - sudo chmod +x /usr/bin/loadgen - loadgen + curl -sSL http://get.infini.cloud | bash -s -- -p loadgen -d ~/loadgen_install_dir + # Move to binary to /usr/bin so that it is in $PATH + sudo mv ~/loadgen_install_dir/loadgen-linux-* /usr/bin/loadgen + # Make sure it is executable, just in case. + chmod +x /usr/bin/loadgen + # Run it to verify it is installed + loadgen + # Clear the log directory created by Loadgen + rm -r log