Skip to content

Commit f012fc2

Browse files
authored
Merge pull request #5 from Openshift-Console/env-update
Updated Makefile & Workflow to use .env file
2 parents 1098d3c + b23cc1e commit f012fc2

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@ jobs:
2121
- name: Set up ko
2222
uses: ko-build/[email protected]
2323
env:
24-
KO_DOCKER_REPO: quay.io/avik6028
24+
KO_DOCKER_REPO: quay.io/openshift-console
2525
- name: Lint
2626
run: make lint
2727
- name: Build
28-
env:
29-
auth_token: ${{ secrets.QUAY_AUTH_TOKEN }}
30-
run: |
31-
echo "${auth_token}" | ko login quay.io --username ${{ secrets.QUAY_USER_NAME }} --password-stdin
32-
make container-build
28+
run: make container-build
3329
- name: Test
3430
run: make test
3531
- name: Push
3632
env:
37-
auth_token: ${{ secrets.QUAY_AUTH_TOKEN }}
38-
run: |
39-
echo "${auth_token}" | ko login quay.io --username ${{ secrets.QUAY_USER_NAME }} --password-stdin
40-
make container-push
33+
QUAY_USER_NAME: ${{ secrets.QUAY_USER_NAME }}
34+
QUAY_AUTH_TOKEN: ${{ secrets.QUAY_AUTH_TOKEN }}
35+
run: make container-push

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
2424
endif
2525
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2626

27+
# Load the environment variables from the .env file
28+
# This is useful for local development and testing.
29+
# You can also set the environment variables directly in the CI/CD pipeline.
30+
# To use the .env file, you can create a .env file in the root of the project and define the variables.
31+
ifneq (,$(wildcard ./.env))
32+
include .env
33+
endif
34+
35+
2736
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
2837
# This variable is used to construct full image tags for bundle and catalog images.
2938
#
@@ -35,6 +44,7 @@ IMAGE_NAMESPACE ?= openshift-console
3544
IMAGE_REPO ?= $(IMAGE_HOST)/$(IMAGE_NAMESPACE)
3645
IMAGE_TAG_BASE ?= $(IMAGE_REPO)/console-application-operator
3746

47+
3848
# TAG allows the tag for the operator image to be changed. Defaults to the VERSION
3949
TAG ?= $(VERSION)
4050

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

182+
.PHONY: print-auth
183+
print-auth: ## Print the environment variables.
184+
@echo "Username: ${QUAY_USER_NAME}"
185+
@echo "Password: ${QUAY_AUTH_TOKEN}"
186+
172187
.PHONY: container-push
173188
container-push: ## Push the container image with the operator.
189+
echo "${QUAY_AUTH_TOKEN}" | ko login quay.io --username ${QUAY_USER_NAME} --password-stdin
174190
KO_DOCKER_REPO=${IMAGE_REPO} $(KO) build . ${KO_OPTS}
175191

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

0 commit comments

Comments
 (0)