Skip to content

Commit

Permalink
Add --version command (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Dave O'Connor <[email protected]>
  • Loading branch information
1 parent b7f8aca commit 5c29eb1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ARG RELEASE_VERSION=${RELEASE_VERSION}
ARG QUAY_IMAGE=${QUAY_IMAGE}
ARG EE_IMAGE=${EE_IMAGE}
ARG EE_BASE_IMAGE=${EE_BASE_IMAGE}
Expand All @@ -10,6 +11,7 @@ ARG PAUSE_IMAGE=${PAUSE_IMAGE}
FROM registry.redhat.io/ubi8:latest AS cli

# Need to duplicate these, otherwise they won't be available to the stage
ARG RELEASE_VERSION=${RELEASE_VERSION}
ARG QUAY_IMAGE=${QUAY_IMAGE}
ARG EE_IMAGE=${EE_IMAGE}
ARG POSTGRES_IMAGE=${POSTGRES_IMAGE}
Expand All @@ -28,14 +30,15 @@ COPY . /cli
WORKDIR /cli

# Create CLI
ENV RELEASE_VERSION=${RELEASE_VERSION}
ENV EE_IMAGE=${EE_IMAGE}
ENV QUAY_IMAGE=${QUAY_IMAGE}
ENV REDIS_IMAGE=${REDIS_IMAGE}
ENV POSTGRES_IMAGE=${POSTGRES_IMAGE}
ENV PAUSE_IMAGE=${PAUSE_IMAGE}

RUN go build -v \
-ldflags "-X github.com/quay/mirror-registry/cmd.eeImage=${EE_IMAGE} -X github.com/quay/mirror-registry/cmd.pauseImage=${PAUSE_IMAGE} -X github.com/quay/mirror-registry/cmd.quayImage=${QUAY_IMAGE} -X github.com/quay/mirror-registry/cmd.redisImage=${REDIS_IMAGE} -X github.com/quay/mirror-registry/cmd.postgresImage=${POSTGRES_IMAGE}" \
-ldflags "-X github.com/quay/mirror-registry/cmd.releaseVersion=${RELEASE_VERSION} -X github.com/quay/mirror-registry/cmd.eeImage=${EE_IMAGE} -X github.com/quay/mirror-registry/cmd.pauseImage=${PAUSE_IMAGE} -X github.com/quay/mirror-registry/cmd.quayImage=${QUAY_IMAGE} -X github.com/quay/mirror-registry/cmd.redisImage=${REDIS_IMAGE} -X github.com/quay/mirror-registry/cmd.postgresImage=${POSTGRES_IMAGE}" \
-o mirror-registry

# Create Ansible Execution Environment
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile.online
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
ARG RELEASE_VERSION=${RELEASE_VERSION}
ARG EE_BASE_IMAGE=${EE_BASE_IMAGE}
ARG EE_BUILDER_IMAGE=${EE_BUILDER_IMAGE}

# Create Go CLI
FROM registry.redhat.io/ubi8:latest AS cli

# Need to duplicate these, otherwise they won't be available to the stage
ARG RELEASE_VERSION=${RELEASE_VERSION}
ARG QUAY_IMAGE=${QUAY_IMAGE}
ARG EE_IMAGE=${EE_IMAGE}
ARG POSTGRES_IMAGE=${POSTGRES_IMAGE}
Expand All @@ -23,14 +25,15 @@ COPY . /cli
WORKDIR /cli

# Create CLI
ENV RELEASE_VERSION=${RELEASE_VERSION}
ENV EE_IMAGE=${EE_IMAGE}
ENV QUAY_IMAGE=${QUAY_IMAGE}
ENV REDIS_IMAGE=${REDIS_IMAGE}
ENV POSTGRES_IMAGE=${POSTGRES_IMAGE}
ENV PAUSE_IMAGE=${PAUSE_IMAGE}

RUN go build -v \
-ldflags "-X github.com/quay/mirror-registry/cmd.eeImage=${EE_IMAGE} -X github.com/quay/mirror-registry/cmd.pauseImage=${PAUSE_IMAGE} -X github.com/quay/mirror-registry/cmd.quayImage=${QUAY_IMAGE} -X github.com/quay/mirror-registry/cmd.redisImage=${REDIS_IMAGE} -X github.com/quay/mirror-registry/cmd.postgresImage=${POSTGRES_IMAGE}" \
-ldflags "-X github.com/quay/mirror-registry/cmd.releaseVersion=${RELEASE_VERSION} -X github.com/quay/mirror-registry/cmd.eeImage=${EE_IMAGE} -X github.com/quay/mirror-registry/cmd.pauseImage=${PAUSE_IMAGE} -X github.com/quay/mirror-registry/cmd.quayImage=${QUAY_IMAGE} -X github.com/quay/mirror-registry/cmd.redisImage=${REDIS_IMAGE} -X github.com/quay/mirror-registry/cmd.postgresImage=${POSTGRES_IMAGE}" \
-o mirror-registry

# Create Ansible Execution Environment
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build-golang-executable:
build-online-zip:
sudo podman build \
-t mirror-registry-online:${RELEASE_VERSION} \
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \
--build-arg EE_IMAGE=${EE_IMAGE} \
--build-arg EE_BASE_IMAGE=${EE_BASE_IMAGE} \
Expand All @@ -24,6 +25,7 @@ build-online-zip:
build-offline-zip:
sudo podman build \
-t mirror-registry-offline:${RELEASE_VERSION} \
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \
--build-arg EE_IMAGE=${EE_IMAGE} \
--build-arg EE_BASE_IMAGE=${EE_BASE_IMAGE} \
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ $ podman pull quay:8443/init/busybox:latest --tls-verify=false

Prior to pushing quay:8443/init/busybox, you must create the repository "busybox" in the Quay console. In future versions of mirror registry this will be created automatically.

## Upgrade

To upgrade Quay from localhost, run the following command:

```console
$ sudo ./mirror-registry upgrade -v
```

To upgrade Quay from a remote host, run the following command:

```console
$ ./mirror-registry upgrade -v --targetHostname some.remote.host.com --targetUsername someuser -k ~/.ssh/my_ssh_key
```

## Uninstall

To uninstall Quay from localhost, run the following command:
Expand Down
2 changes: 1 addition & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var quayRoot string
// additionalArgs are arguments that you would like to append to the end of the ansible-playbook call (used mostly for development)
var additionalArgs string

// installCmd represents the validate command
// installCmd represents the install command
var installCmd = &cobra.Command{
Use: "install",
Short: "Install Quay and its required dependencies.",
Expand Down
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ var log = &logrus.Logger{
// verbose is the optional command that will display INFO logs
var verbose bool

// version is an optional command that will display the current release version
var releaseVersion string

func init() {
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Display verbose logs")
}

var (
rootCmd = &cobra.Command{
Use: "mirror-registry",
Use: "mirror-registry",
Version: releaseVersion,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if verbose {
log.SetLevel(logrus.DebugLevel)
Expand Down
2 changes: 1 addition & 1 deletion cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
)

// upgradeCmd represents the validate command
// upgradeCmd represents the upgrade command
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrade all mirror registry images.",
Expand Down

0 comments on commit 5c29eb1

Please sign in to comment.