Skip to content

Commit

Permalink
Merge branch 'main' into feature/update_contributing_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
thepetk authored Sep 22, 2023
2 parents 6acd5c0 + 3d1aca2 commit 18cadc6
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 63 deletions.
48 changes: 48 additions & 0 deletions .ci/Dockerfile.offline
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright 2020-2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM registry.access.redhat.com/ubi8/go-toolset:1.18 AS builder

# Set user as root
USER root

# Install yq
RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq

COPY . /registry

# Download the registry build tools
RUN git clone https://github.com/devfile/registry-support.git /registry-support

# Download all the offline parent devfiles
RUN bash /registry-support/build-tools/dl_parent_devfiles.sh

# Download all the offline starter projects
RUN bash /registry-support/build-tools/dl_starter_projects.sh

# Update all devfiles to use offline starter projects
RUN bash /registry-support/build-tools/update_devfiles_offline.sh

# Run the registry build tools
RUN bash /registry-support/build-tools/build.sh /registry /build

# Extract archived resources
RUN bash /registry-support/build-tools/extract_resources.sh

FROM quay.io/devfile/devfile-index-base:next

# Set user as non-root
USER 1001

COPY --from=builder /build /registry
7 changes: 6 additions & 1 deletion .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@

ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
if [ $# -eq 1 ] && [ $1 == "offline" ]
then
docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile.offline $ABSOLUTE_PATH/..
else
docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
fi
8 changes: 4 additions & 4 deletions .github/workflows/check-architectures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install yq command
uses: redhat-actions/openshift-tools-installer@v1
with:
Expand All @@ -38,7 +38,7 @@ jobs:
yq: 'latest'
- name: Get git diff
id: diff
uses: technote-space/get-diff-action@v4
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.4.1
with:
PATTERNS: |
+(stacks)/**/devfile.yaml
Expand All @@ -53,7 +53,7 @@ jobs:
continue-on-error: true
run: bash tests/check_architectures.sh "${{ env.GIT_DIFF }}" yq >> ./pr/output
- name: Find Comment in PR
uses: peter-evans/find-comment@v1
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2.4.0
id: find
with:
issue-number: ${{ github.event.number }}
Expand All @@ -62,7 +62,7 @@ jobs:
- name: Save Comment ID
if: ${{ steps.find.outputs.comment-id != '' }}
run: echo ${{ steps.find.outputs.comment-id }} > ./pr/commentid
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: pr
path: pr/
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: registry-repo
- name: Setup Go environment
uses: actions/setup-go@v2
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.18

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/comment-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download PR artifact
uses: actions/github-script@v3.1.0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
Expand All @@ -52,7 +52,7 @@ jobs:
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip
- name: Comment on PR if there is output
uses: actions/github-script@v3
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pushimge-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout registry build tools
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: devfile/registry-support
persist-credentials: false
path: registry-support
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: registry-repo
- name: Setup Go environment
uses: actions/setup-go@v2
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.13
- name: Login to Quay
uses: docker/login-action@v1
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger-redeploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/validate-stacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: "1.19"

Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

Expand All @@ -87,7 +87,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

Expand All @@ -134,7 +134,7 @@ jobs:
start args: "--addons=ingress"

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: "1.19"

Expand Down
35 changes: 20 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ The following are required to build the devfile index container image containing
- Docker 17.06 or later
- Git

## Stacks
## Instructions

### Contributing
1. Open an issue in the [devfile/api](https://github.com/devfile/api) repo to track adding a new stack or sample
2. Avoid using container images (check for references in the Devfile and Dockerfile) from registries (like DockerHub) that impose rate limiting. To workaround this, you can mirror the images to quay.io by using a similar approach to what the Devfile team has: https://github.com/devfile-samples/image-mirror/

### Stacks

#### Contributing

1) Verify your Devfile stack functions with odo.

- Core odo v2 functions such as `odo create --devfile <devfile.yaml>`, `odo push`, `odo url create` should work with the devfile.
- Core odo v3 functions such as `odo init`, `odo dev`, `odo deploy` should work with the devfile.
- Core odo v3 functions such as `odo init`, `odo dev`, `odo deploy` should work with the devfile.
- PR tests on this repository will verify this functionality as well.

2) Verify your Devfile stack functions with Che.

- Opening the URL `https://workspaces.openshift.com/#<devfile_url>` in your browser should start a workspace where `exec` commands run successfully. Type `task+<space>` in the IDE command palette to see the list of available commands.

3) Verify your Devfile stack has the following metadata fields at a minimum:
Expand All @@ -33,19 +38,19 @@ The following are required to build the devfile index container image containing
- Version: The version of your stack, in semnatic version format, e.g. `1.0.0`.

4) Add a folder for the stack to `stacks/` in this repository.

- Make sure the name matches the devfile stack's name and be in the format `<language>-<framework>`. E.g. `java-quarkus`, `python-django`, etc.

5) Add the devfile.yaml and any other necessary files for the stack under the stack folder.

6) Run the `.ci/build.sh` to build the registry into a container image.

- This will also validate the devfiles in this repository, making sure they conform to a minimum standard.
- This step will also be run in the PR build for the repository.

7) Open a pull request against this repository with a brief description of the change.

### Updating
#### Updating

Updating an existing devfile stack is relatively straightforward:

Expand All @@ -59,9 +64,9 @@ Updating an existing devfile stack is relatively straightforward:
- Minimally, testing with odo v2 (`odo create`, `odo push`, etc) and odo v3 (`odo init`, `odo dev`, etc) is recommended, however if your Devfile is used with other tools, it's recommended to test there as well.
5) Open a pull request against this repository with your changes.

## Samples
### Samples

### Contributing
#### Contributing

The devfile samples used in this devfile registry are stored in the `extraDevfileEntries.yaml` file in the root of the repository. To add a devfile sample:

Expand Down Expand Up @@ -137,7 +142,7 @@ In case you want to add another version to a new devfile sample you can update t
5) Fill in the fields in the angle brackets based on your sample. Note that there must be only one git remote for the devfile sample.
6) Open a pull request against this repository with your changes.

### Updating
#### Updating

To update a sample:

Expand All @@ -146,19 +151,19 @@ To update a sample:
3) Make the necessary changes.
4) Open a pull request against this repository with your changes.

## How to Test Changes
### How to Test Changes

### Odo
#### Odo

odo v2: `odo create` and `odo push` to test devfile changes. See [odo v2 Doc](https://odo.dev/docs/2.5.0/using-odo/create-component) for more details.

odo V3: `odo init` and `odo dev` to test devfile changes. See [odo v3 Doc](https://odo.dev/docs/command-reference/init) for more details.

### Che
#### Che

Opening the URL `https://workspaces.openshift.com/#<repository_url>` in your browser should start a workspace where `exec` commands run successfully. Type `task+<space>` in the IDE command palette to see the list of available commands.

### Console
#### Console

In developer view, create an application via `Import from Git`. Provide git repository Url and verify if the application can be built and ran successfully.
Note: Currently Console only works with devfile v2.2.0 samples with outer loop support.
14 changes: 4 additions & 10 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

approvers:
- elsony
- johnmcollier
- kim-tsao
- maysunfaisal
- michael-valdron
- mike-hoang
- thepetk
- yangcao77
- feloy
- rm3l

reviewers:
- elsony
- johnmcollier
- kim-tsao
- maysunfaisal
- michael-valdron
- mike-hoang
- thepetk
- yangcao77
- feloy
- rm3l
6 changes: 3 additions & 3 deletions stacks/java-wildfly/2.0.0/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ metadata:
name: wildfly-numberguess
version: 2.0.0
website: https://wildfly.org
displayName: WildFly Numberguess
description: Upstream WildFly Numberguess Quickstart
displayName: WildFly Numberguess Quickstart
description: WildFly JakartaEE 10 application
icon: https://design.jboss.org/wildfly/logo/final/wildfly_logomark.svg
tags: ['Java', 'WildFly']
tags: ["Community", "Java", "WildFly", "OpenJDK", "Maven", "JakartaEE"]
projectType: 'wildfly'
language: 'java'
starterProjects:
Expand Down
11 changes: 9 additions & 2 deletions tests/check_rhtap_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

set -x

samplesFile="$(pwd)/extraDevfileEntries.yaml"
ROOT_REPO_DIR=$(pwd)
samplesFile="$ROOT_REPO_DIR/extraDevfileEntries.yaml"

ginkgo run --procs 2 \
# Install golang modules
cd "$ROOT_REPO_DIR"/tests/rhtap && \
go mod tidy && \
go mod vendor && \
cd "$ROOT_REPO_DIR"

ginkgo run -p \
--timeout 2h \
tests/rhtap -- -samplesFile "$samplesFile"
Loading

0 comments on commit 18cadc6

Please sign in to comment.