Skip to content

Updated Makefile & Workflow to use .env file #5

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

Merged
merged 1 commit into from
Aug 13, 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
15 changes: 5 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ jobs:
- name: Set up ko
uses: ko-build/[email protected]
env:
KO_DOCKER_REPO: quay.io/avik6028
KO_DOCKER_REPO: quay.io/openshift-console
- name: Lint
run: make lint
- name: Build
env:
auth_token: ${{ secrets.QUAY_AUTH_TOKEN }}
run: |
echo "${auth_token}" | ko login quay.io --username ${{ secrets.QUAY_USER_NAME }} --password-stdin
make container-build
run: make container-build
- name: Test
run: make test
- name: Push
env:
auth_token: ${{ secrets.QUAY_AUTH_TOKEN }}
run: |
echo "${auth_token}" | ko login quay.io --username ${{ secrets.QUAY_USER_NAME }} --password-stdin
make container-push
QUAY_USER_NAME: ${{ secrets.QUAY_USER_NAME }}
QUAY_AUTH_TOKEN: ${{ secrets.QUAY_AUTH_TOKEN }}
run: make container-push
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Load the environment variables from the .env file
# This is useful for local development and testing.
# You can also set the environment variables directly in the CI/CD pipeline.
# To use the .env file, you can create a .env file in the root of the project and define the variables.
ifneq (,$(wildcard ./.env))
include .env
endif


# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
Expand All @@ -35,6 +44,7 @@ IMAGE_NAMESPACE ?= openshift-console
IMAGE_REPO ?= $(IMAGE_HOST)/$(IMAGE_NAMESPACE)
IMAGE_TAG_BASE ?= $(IMAGE_REPO)/console-application-operator


# TAG allows the tag for the operator image to be changed. Defaults to the VERSION
TAG ?= $(VERSION)

Expand Down Expand Up @@ -169,8 +179,14 @@ run: manifests generate fmt vet ## Run a controller from your host.
container-build: test ko ## Build the container image with the operator.
KO_DOCKER_REPO=${IMAGE_REPO} $(KO) build . --push=false ${KO_OPTS}

.PHONY: print-auth
print-auth: ## Print the environment variables.
@echo "Username: ${QUAY_USER_NAME}"
@echo "Password: ${QUAY_AUTH_TOKEN}"

.PHONY: container-push
container-push: ## Push the container image with the operator.
echo "${QUAY_AUTH_TOKEN}" | ko login quay.io --username ${QUAY_USER_NAME} --password-stdin
KO_DOCKER_REPO=${IMAGE_REPO} $(KO) build . ${KO_OPTS}

# If you wish to build the manager image targeting other platforms you can use the --platform flag.
Expand Down
Loading