Skip to content

Commit

Permalink
feat(ci): sync build_number envar (#1481)
Browse files Browse the repository at this point in the history
Co-authored-by: ronrobb <ron.robb@cgi.com>
  • Loading branch information
DerekRoberts and ronrobb authored Aug 6, 2024
1 parent 9332655 commit 7dda7f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- uses: bcgov-nr/action-builder-ghcr@v2.2.0
id: build
with:
build_args: |
"BUILDKIT_INLINE_CACHE=1"
--build-arg BUILD_NUMBER=${{ github.event.number }}
package: ${{ matrix.package }}
tag: ${{ github.event.number }}
tag_fallback: latest
Expand Down
4 changes: 4 additions & 0 deletions sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM python:3.12-slim

# Receive build number as argument, retain as environment variable
ARG BUILD_NUMBER=0
ENV BUILD_NUMBER=${BUILD_NUMBER}

# Packages and nonroot user
RUN apt update && \
apt install -y --no-install-recommends gcc libpq-dev python3-dev && \
Expand Down
9 changes: 9 additions & 0 deletions sync/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def generate_db_config(type_,schema_,settings):
}
return dbconfig

def get_build_number():
return os.environ.get("BUILD_NUMBER")

def required_variables_exists():
ret = True

Expand Down Expand Up @@ -110,6 +113,12 @@ def read_settings():

def main() -> None:
definition_of_yes = ["Y","YES","1","T","TRUE","t","true"]

build_number = get_build_number()
print("<------------------ b.u.i.l.d n.u.m.b.e.r ----------------->")
print(f"Running Sync BUILD NUMBER: {build_number}")
print("<------------------ b.u.i.l.d n.u.m.b.e.r ----------------->")

# print(os.environ.get("TEST_MODE"))
if os.environ.get("TEST_MODE") is None:
print("Error: test mode variable is None")
Expand Down

0 comments on commit 7dda7f7

Please sign in to comment.