Merge pull request #58 from IBM/security_fixes #257
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v1* | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| - name: Check basic CLI function | |
| run: ibmcloud --version | |
| test-version-output: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| id: ibmcloud | |
| uses: ./ | |
| - name: Check version output is set correctly | |
| env: | |
| IBMCLOUD_CLI_VERSION: ${{ steps.ibmcloud.outputs.version }} | |
| run: | | |
| actual_version="$(ibmcloud --version)" | |
| expected_version="ibmcloud $IBMCLOUD_CLI_VERSION (" | |
| echo "Actual version: $actual_version" | |
| echo "Expected version: $expected_version*" | |
| [[ "$actual_version" == "$expected_version"* ]] | |
| test-single-plugin: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: container-service | |
| - name: Check plugin is installed | |
| run: ibmcloud plugin list | grep -q '^container-service\b' | |
| test-single-plugin-with-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: [email protected] | |
| - name: Check plugin is installed | |
| run: ibmcloud plugin list | grep -q '^container-service.\+0\.4\.102\b' | |
| test-multiple-plugins-with-commas: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: container-service,secrets-manager,cr | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b' | |
| test-multiple-plugins-with-comma-space: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: container-service, secrets-manager, cr | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b' | |
| test-multiple-plugins-with-newlines: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: | | |
| container-service | |
| secrets-manager | |
| cr | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b' | |
| test-multiple-plugins-with-spaces: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: container-service secrets-manager cr | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b' | |
| test-multiple-plugins-with-versions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: [email protected], secrets-manager, [email protected] | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b.\+0\.4\.102\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b.\+1\.3\.\b' | |
| test-multiple-plugins-with-versions-and-newlines: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| plugins: | | |
| [email protected] | |
| secrets-manager | |
| [email protected] | |
| - name: Check plugins are installed | |
| run: | | |
| ibmcloud plugin list | grep -q '^container-service\b.\+0\.4\.102\b' && | |
| ibmcloud plugin list | grep -q '^secrets-manager\b' && | |
| ibmcloud plugin list | grep -q '^container-registry\b.\+1\.3\.\b' | |
| test-login: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q 'User:\s\+${{ secrets.IBMCLOUD_USER }}' && | |
| ibmcloud target | grep -q '^Region:\s\+us-south$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+default$' | |
| test-login-with-region: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| region: us-east | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' && | |
| ibmcloud target | grep -q '^Region:\s\+us-east$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+default$' | |
| test-login-with-region-and-group: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| region: us-east | |
| group: manageiq | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' && | |
| ibmcloud target | grep -q '^Region:\s\+us-east$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+manageiq$' | |
| test-login-with-region-and-blank-group: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| region: us-east | |
| group: '' | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' && | |
| ibmcloud target | grep -q '^Region:\s\+us-east$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+default$' | |
| test-login-with-region-and-false-group: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| region: us-east | |
| group: false | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q '^User:\s\+${{ secrets.IBMCLOUD_USER }}$' && | |
| ibmcloud target | grep -q '^Region:\s\+us-east$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+No resource group targeted' | |
| test-login-failure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| id: ibmcloud | |
| uses: ./ | |
| with: | |
| api_key: invalid-xxx | |
| continue-on-error: true | |
| - name: Check failed login | |
| run: '[[ ${{ steps.ibmcloud.outcome }} == failure ]]' | |
| test-login-manual: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| - name: Manually log in | |
| env: | |
| IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} | |
| run: ibmcloud login -r us-south -g default >/dev/null | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q 'User:\s\+${{ secrets.IBMCLOUD_USER }}' && | |
| ibmcloud target | grep -q '^Region:\s\+us-south$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+default$' | |
| test-already-installed: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| - windows-latest | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| - name: Set up ibmcloud CLI (again) | |
| uses: ./ | |
| - name: Check basic CLI function | |
| run: ibmcloud --version | |
| test-os: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - ubuntu-24.04-ppc64le | |
| - ubuntu-24.04-s390x | |
| - ubuntu-22.04 | |
| - ubuntu-22.04-arm | |
| - macos-latest | |
| - macos-26 | |
| - macos-15 | |
| - macos-14 | |
| - windows-latest | |
| - windows-2025 | |
| - windows-2022 | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up ibmcloud CLI | |
| uses: ./ | |
| with: | |
| api_key: ${{ secrets.IBMCLOUD_API_KEY }} | |
| plugins: secrets-manager | |
| - name: Check logged in | |
| run: | | |
| ibmcloud target | grep -q 'User:\s\+${{ secrets.IBMCLOUD_USER }}' && | |
| ibmcloud target | grep -q '^Region:\s\+us-south$' && | |
| ibmcloud target | grep -q '^Resource group:\s\+default$' | |
| check-dist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| package-manager-cache: false | |
| - run: npm ci | |
| - run: npm run package | |
| - name: Check dist directory is up to date | |
| run: git diff --exit-code |