Skip to content

Commit

Permalink
Merge pull request #101 from kim-tsao/update-scripts
Browse files Browse the repository at this point in the history
Update scripts to work with podman
  • Loading branch information
kim-tsao authored Feb 22, 2022
2 parents 723fa9c + cb0e729 commit dbd6c68
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Issue tracking repo: https://github.com/devfile/api with label area/registry

## Build

If you want to run the build scripts with Podman, set the environment variable
`export USE_PODMAN=true`

To build all of the components together (recommended) for dev/test, run `./build_registry.sh` to build a Devfile Registry index image that is populated with the mock devfile registry data under `tests/registry/`.

Once the container has been pushed, you can push it to a container registry of your choosing with the following commands:
Expand Down
2 changes: 1 addition & 1 deletion TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Troubelshooting the Devfile Registry
# Troubleshooting the Devfile Registry

## Collecting Logs

Expand Down
7 changes: 2 additions & 5 deletions build-tools/build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/bin/bash
#
# Copyright (c) 2020 Red Hat, Inc.
# Copyright (c) 2020-2022 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

#!/bin/bash

# Enable extended globbing in the shell
shopt -s extglob

buildToolsFolder="$(dirname "$0")"
generatorFolder=$buildToolsFolder/../index/generator
Expand Down
8 changes: 5 additions & 3 deletions build_registry.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/sh
#!/bin/bash

# This script builds a devfile registry index container image based on the mock devfile registry data under tests/registry
# This can be useful if developing components within this repository (such as the index server or build tools)
# and want to test all of the components together

shopt -s expand_aliases
set -eux
#set the docker alias if necessary
. ./setenv.sh

# Build the index server base image
./index/server/build.sh
. ./index/server/build.sh

# Build the test devfile registry image
docker build -t devfile-index:latest -f .ci/Dockerfile .
4 changes: 2 additions & 2 deletions index/server/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash

# Build the index container for the registry
buildfolder="$(realpath $(dirname $0))"
buildfolder="$(realpath $(dirname ${BASH_SOURCE[0]}))"

# Clone the registry-support repo
if [ -d $buildfolder/registry-viewer ]; then
Expand Down
10 changes: 10 additions & 0 deletions setenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script aliases the docker cli if the environment variable USE_PODMAN is set to true.

# default value is false if USE_PODMAN is unset or null
podman=${USE_PODMAN:-false}
if [ ${podman} == true ]; then
alias docker=podman
echo "setting alias docker=podman"
fi
2 changes: 2 additions & 0 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This folder contains the integration tests for the OCI-based Devfile Registry. The tests can be run against either a remote devfile registry (such as https://registry.stage.devfile.io), or a local devfile registry running your machine (such as in Minikube, or Docker Desktop).

## Build
If you want to run the build scripts with Podman, set the environment variable
`export USE_PODMAN=true`

The integration tests can be built to either run in a Docker container, or locally on your machine.

Expand Down
2 changes: 2 additions & 0 deletions tests/integration/docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

#set the docker alias if necessary
. ../../setenv.sh
# Get the registry-library
cp -rf ../../registry-library ./

Expand Down
4 changes: 4 additions & 0 deletions tests/integration/docker-push.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh

#set the docker alias if necessary
. ../../setenv.sh

IMAGE_TAG=$1
docker tag devfile-registry-integration $IMAGE_TAG
docker push $IMAGE_TAG

0 comments on commit dbd6c68

Please sign in to comment.