Skip to content

Commit

Permalink
Merge branch 'main' into iss1921-runs-get-performance
Browse files Browse the repository at this point in the history
  • Loading branch information
eamansour authored Aug 22, 2024
2 parents be5133a + 9f4368b commit 39621f4
Show file tree
Hide file tree
Showing 16 changed files with 749 additions and 31 deletions.
51 changes: 41 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
name: Main build

on:
workflow_dispatch:
push:
branches: [main]

env:
REGISTRY: ghcr.io
NAMESPACE: galasa-dev
IMAGE_TAG: main
BRANCH: ${{ github.ref_name }}
ARGO_APP_BRANCH: gh # TODO: remove this parameter and just use env.BRANCH once we update development.galasa.dev/main with these workflows.


jobs:
log-github-ref:
name: Log the GitHub ref this workflow is running on (Branch or tag that received dispatch)
runs-on: ubuntu-latest
steps:
- name: Log GitHub ref of workflow
run: |
echo "This workflow is running on GitHub ref ${{ env.BRANCH }}"
build-cli:
name: Build the Galasa CLI
runs-on: ubuntu-latest
Expand All @@ -21,15 +32,24 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
gradle-version: 8.9

# Pull down dependencies with Gradle and put them in the right places.
- name: Gather dependencies using Gradle
run : |
set -o pipefail
gradle -b build.gradle installJarsIntoTemplates --info \
-PsourceMaven=https://development.galasa.dev/gh/maven-repo/maven \
-PsourceMaven=https://development.galasa.dev/${{ env.ARGO_APP_BRANCH }}/maven-repo/maven \
-PcentralMaven=https://repo.maven.apache.org/maven2/ \
-PtargetMaven=${{ github.workspace }}/repo \
-PtargetMaven=${{ github.workspace }}/repo 2>&1 | tee build.log
- name: Upload Gradle installJarsIntoTemplates log
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-installJarsIntoTemplates-log
path: build.log
retention-days: 7

# Generate client code so galasactl can communicate with the API server.
- name: Generate Go client code using openapi.yaml
Expand Down Expand Up @@ -63,7 +83,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'semeru'
cache: maven

Expand All @@ -78,7 +98,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
gradle-version: 8.9

- name: Run local test script with Gradle
run : |
Expand Down Expand Up @@ -135,7 +155,7 @@ jobs:
labels: ${{ steps.metadata-galasactl-ibm.outputs.labels }}
build-args: |
dockerRepository=ghcr.io
tag=main
tag=${{ env.BRANCH }}
- name: Extract metadata for galasactl-executables image
id: metadata-galasactl-executables
Expand All @@ -157,11 +177,22 @@ jobs:
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app actions run gh-cli restart --kind Deployment --resource-name cli-gh --server argocd.galasa.dev
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app actions run ${{ env.ARGO_APP_BRANCH }}-cli restart --kind Deployment --resource-name cli-${{ env.ARGO_APP_BRANCH }} --server argocd.galasa.dev
- name: Wait for application health in ArgoCD
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait gh-cli --resource apps:Deployment:cli-gh --health --server argocd.galasa.dev
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait ${{ env.ARGO_APP_BRANCH }}-cli --resource apps:Deployment:cli-${{ env.ARGO_APP_BRANCH }} --health --server argocd.galasa.dev
trigger-isolated-workflow:
name: Trigger Isolated workflow
runs-on: ubuntu-latest
needs: build-cli

steps:
- name: Trigger Isolated workflow dispatch event with GitHub CLI
env:
GH_TOKEN: ${{ secrets.GALASA_TEAM_GITHUB_TOKEN }}
run: |
gh workflow run build.yaml --repo https://github.com/galasa-dev/isolated --ref ${{ env.BRANCH }}
38 changes: 23 additions & 15 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
gradle-version: 8.9

# Pull down dependencies with Gradle and put them in the right places.
- name: Gather dependencies using Gradle
run : |
set -o pipefail
gradle -b build.gradle installJarsIntoTemplates --info \
-PsourceMaven=https://development.galasa.dev/gh/maven-repo/maven \
-PcentralMaven=https://repo.maven.apache.org/maven2/ \
-PtargetMaven=${{ github.workspace }}/repo \
-PtargetMaven=${{ github.workspace }}/repo 2>&1 | tee build.log
- name: Upload Gradle installJarsIntoTemplates log
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-installJarsIntoTemplates-log
path: build.log
retention-days: 7

# Generate client code so galasactl can communicate with the API server.
- name: Generate Go client code using openapi.yaml
Expand Down Expand Up @@ -63,7 +72,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'semeru'
cache: maven

Expand All @@ -78,7 +87,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 6.9.2
gradle-version: 8.9

- name: Run local test script with Gradle
run : |
Expand All @@ -103,17 +112,16 @@ jobs:
build-args: |
platform=linux-x86_64
# Commenting for now as the image is not yet available on GHCR.
# - name: Build Docker image with galasactl executable and IBM certificates
# uses: docker/build-push-action@v5
# with:
# context: dockerfiles/certs
# file: dockerfiles/dockerfile.galasactl-ibm
# load: true
# tags: galasactl-ibm-x86_64:test
# build-args: |
# dockerRepository=ghcr.io
# tag=main
- name: Build Docker image with galasactl executable and IBM certificates
uses: docker/build-push-action@v5
with:
context: dockerfiles/certs
file: dockerfiles/dockerfile.galasactl-ibm
load: true
tags: galasactl-ibm-x86_64:test
build-args: |
dockerRepository=ghcr.io
tag=main
- name: Build Docker image for development download site
uses: docker/build-push-action@v5
Expand Down
2 changes: 2 additions & 0 deletions docs/generated/errors-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ The `galasactl` tool can generate the following errors:
- GAL1152E: Programming logic error: Too much data passed to the encryption process. Please contact your Galasa systems administrator.
- GAL1153E: Failed to revoke the token with ID '{}'. Reason: '{}'.
- GAL1154E: The provided token ID, '{}', does not match formatting requirements. The token ID can contain any character in the 'a'-'z', 'A'-'Z', '0'-'9', '-' (dash), or '_' (underscore) ranges only.
- GAL1155E: The id provided by the --id field cannot be an empty string.
- GAL1156E: '{}' is not supported as a valid value. Valid values are 'me'.
- GAL1225E: Failed to open file '{}' cause: {}. Check that this file exists, and that you have read permissions.
- GAL1226E: Internal failure. Contents of gzip could be read, but not decoded. New gzip reader failed: file: {} error: {}
- GAL1227E: Internal failure. Contents of gzip could not be decoded. {} error: {}
Expand Down
1 change: 1 addition & 0 deletions docs/generated/galasactl.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ A tool for controlling Galasa resources using the command-line.
* [galasactl properties](galasactl_properties.md) - Manages properties in an ecosystem
* [galasactl resources](galasactl_resources.md) - Manages resources in an ecosystem
* [galasactl runs](galasactl_runs.md) - Manage test runs in the ecosystem
* [galasactl users](galasactl_users.md) - Manages users in an ecosystem

27 changes: 27 additions & 0 deletions docs/generated/galasactl_users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## galasactl users

Manages users in an ecosystem

### Synopsis

Allows interaction with the user servlet to return information about users.

### Options

```
-b, --bootstrap string Bootstrap URL. Should start with 'http://' or 'file://'. If it starts with neither, it is assumed to be a fully-qualified path. If missing, it defaults to use the 'bootstrap.properties' file in your GALASA_HOME. Example: http://example.com/bootstrap, file:///user/myuserid/.galasa/bootstrap.properties , file://C:/Users/myuserid/.galasa/bootstrap.properties
-h, --help Displays the options for the 'users' command.
```

### Options inherited from parent commands

```
--galasahome string Path to a folder where Galasa will read and write files and configuration settings. The default is '${HOME}/.galasa'. This overrides the GALASA_HOME environment variable which may be set instead.
-l, --log string File to which log information will be sent. Any folder referred to must exist. An existing file will be overwritten. Specify "-" to log to stderr. Defaults to not logging.
```

### SEE ALSO

* [galasactl](galasactl.md) - CLI for Galasa
* [galasactl users get](galasactl_users_get.md) - Get a list of users

31 changes: 31 additions & 0 deletions docs/generated/galasactl_users_get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## galasactl users get

Get a list of users

### Synopsis

Get a list of users stored in the Galasa API server

```
galasactl users get [flags]
```

### Options

```
-h, --help Displays the options for the 'users get' command.
-i, --id string A mandatory flag that is required to return the currently logged in user.The input must be a string
```

### Options inherited from parent commands

```
-b, --bootstrap string Bootstrap URL. Should start with 'http://' or 'file://'. If it starts with neither, it is assumed to be a fully-qualified path. If missing, it defaults to use the 'bootstrap.properties' file in your GALASA_HOME. Example: http://example.com/bootstrap, file:///user/myuserid/.galasa/bootstrap.properties , file://C:/Users/myuserid/.galasa/bootstrap.properties
--galasahome string Path to a folder where Galasa will read and write files and configuration settings. The default is '${HOME}/.galasa'. This overrides the GALASA_HOME environment variable which may be set instead.
-l, --log string File to which log information will be sent. Any folder referred to must exist. An existing file will be overwritten. Specify "-" to log to stderr. Defaults to not logging.
```

### SEE ALSO

* [galasactl users](galasactl_users.md) - Manages users in an ecosystem

26 changes: 26 additions & 0 deletions pkg/cmd/commandCollection.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const (
COMMAND_NAME_RESOURCES_CREATE = "resources create"
COMMAND_NAME_RESOURCES_UPDATE = "resources update"
COMMAND_NAME_RESOURCES_DELETE = "resources delete"
COMMAND_NAME_USERS = "users"
COMMAND_NAME_USERS_GET = "users get"
)

// -----------------------------------------------------------------
Expand Down Expand Up @@ -139,6 +141,10 @@ func (commands *commandCollectionImpl) init(factory spi.Factory) error {
err = commands.addResourcesCommands(factory, rootCommand)
}

if err == nil {
err = commands.addUsersCommands(factory, rootCommand)
}

if err == nil {
commands.setHelpFlags()
}
Expand Down Expand Up @@ -363,6 +369,26 @@ func (commands *commandCollectionImpl) addResourcesCommands(factory spi.Factory,
return err
}

func (commands *commandCollectionImpl) addUsersCommands(factory spi.Factory, rootCommand spi.GalasaCommand) error {

var err error
var usersCommand spi.GalasaCommand
var usersGetCommand spi.GalasaCommand

usersCommand, err = NewUsersCommand(rootCommand)

if err == nil {
usersGetCommand, err = NewUsersGetCommand(factory, usersCommand, rootCommand)
}

if err == nil {
commands.commandMap[usersCommand.Name()] = usersCommand
commands.commandMap[usersGetCommand.Name()] = usersGetCommand
}

return err
}

func (commands *commandCollectionImpl) setHelpFlags() {
for _, command := range commands.commandMap {
command.CobraCommand().Flags().BoolP("help", "h", false, "Displays the options for the '"+command.Name()+"' command.")
Expand Down
Loading

0 comments on commit 39621f4

Please sign in to comment.