Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge staging to prod - Create triggerConversion.yml #42

Merged
merged 8 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/triggerConversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Rebuild cloud-hosted guide

# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
push:
branches:
- 'prod'
- 'staging'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "post"
post:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Uses the secrets from the organisation for credentials
- uses: actions/checkout@v2

- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: GuideConverterV4
repo: OpenLiberty/cloud-hosted-guides
token: ${{ secrets.GUIDECONVERSIONTOOL_PASSWORD }}
inputs: '{ "branch": "${{ github.ref }}", "guide_name": "${{ github.event.repository.name }}" }'
ref: "refs/heads/prod"
51 changes: 51 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ Make sure to start your Docker daemon before you proceed.
[role='command']
include::{common-includes}/gitclone.adoc[]

ifdef::cloud-hosted[]
In this IBM Cloud environment, you need to change the user home to ***/home/project*** by running the following command:
```bash
sudo usermod -d /home/project theia
```
endif::[]

// =================================================================================================
// Try what you'll build
// =================================================================================================
Expand All @@ -76,6 +83,7 @@ mvn package

Now, run the `mvn verify` command, which compiles the Java files, starts the containers, runs the tests, and then stops the containers.

ifndef::cloud-hosted[]
[.tab_link.windows_link]
`*WINDOWS*`
[.tab_link.mac_link]
Expand All @@ -97,6 +105,14 @@ export TESTCONTAINERS_RYUK_DISABLED=true
mvn verify
```
--
endif::[]

ifdef::cloud-hosted[]
```bash
export TESTCONTAINERS_RYUK_DISABLED=true
mvn verify
```
endif::[]

You see the following output:

Expand All @@ -123,6 +139,12 @@ Use Testcontainers to write integration tests that run in any environment with m

Navigate to the `postgres` directory.

ifdef::cloud-hosted[]
```bash
cd /home/project/guide-testcontainers/postgres
```
endif::[]

This guide uses Docker to run an instance of the PostgreSQL database for a fast installation and setup. A Dockerfile file is provided for you. Run the following command to use the Dockerfile to build the image:

[role='command']
Expand Down Expand Up @@ -153,8 +175,23 @@ The command returns the PostgreSQL container IP address:

Now, navigate to the `start` directory to begin.

ifdef::cloud-hosted[]
```bash
cd /home/project/guide-testcontainers/start
```
endif::[]

The Liberty Maven plug-in includes a `devc` goal that simplifies developing your application in a container by starting https://openliberty.io/docs/latest/development-mode.html#_container_support_for_dev_mode[dev mode^] with container support. This goal builds a Docker image, mounts the required directories, binds the required ports, and then runs the application inside of a container. Dev mode also listens for any changes in the application source code or configuration and rebuilds the image and restarts the container as necessary.

ifdef::cloud-hosted[]
In this IBM Cloud environment, you need to pre-create the ***logs*** directory by running the following commands:

```bash
mkdir -p /home/project/guide-testcontainers/start/target/liberty/wlp/usr/servers/defaultServer/logs
chmod 777 /home/project/guide-testcontainers/start/target/liberty/wlp/usr/servers/defaultServer/logs
```
endif::[]

Build and run the container by running the `devc` goal with the PostgreSQL container IP address. If your PostgreSQL container IP address is not `172.17.0.2`, replace the command with the right IP address.

[role='command']
Expand All @@ -175,9 +212,23 @@ Wait a moment for dev mode to start. After you see the following message, your L
* ...
----

ifndef::cloud-hosted[]
Dev mode holds your command-line session to listen for file changes. Open another command-line session to continue, or open the project in your editor.

Point your browser to the http://localhost:9080/openapi/ui URL to try out the `inventory` microservice manually. This interface provides a convenient visual way to interact with the APIs and test out their functionalities.
endif::[]

ifdef::cloud-hosted[]
Dev mode holds your command-line session to listen for file changes.

Click the following button to try out the ***inventory*** microservice manually by visiting the ***/openapi/ui*** endpoint. This interface provides a convenient visual way to interact with the APIs and test out their functionalities:

::startApplication{port="9080" display="external" name="Visit OpenAPI UI" route="/openapi/ui"}

Open another command-line session to continue.
endif::[]



=== Building a REST test client

Expand Down
Loading