Skip to content

Commit

Permalink
test 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DarylTodosichuk committed Oct 25, 2024
1 parent 0a57287 commit 837f85d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 45 deletions.
92 changes: 47 additions & 45 deletions .github/workflows/docker-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,24 @@ env:
UGM_RELEASE_PREFIX: API_v
UGM_RELEASE_MESSAGE: "Production deployment"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Setup:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
environment: main
environment: test
steps:
# Runs commands using the runners shell
- name: Get variables
run: |
echo "target=$TARGET_ENV"
echo "base=$GITHUB_REF_NAME"
echo "Target: $TARGET_ENV"
echo "BaseRef: $GITHUB_REF_NAME"
echo "Environment: $TARGET_ENV OC_TARGET_PROJECT=$OC_TARGET_PROJECT"
echo "Environment: $TARGET_ENV JFROG_REPO_PATH=$JFROG_REPO_PATH"
echo "..."
env | sort
- name: Get current date
id: date_selector
run: echo "DATE=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
outputs:
DATE: ${{steps.date_selector.outputs.DATE}}
Branch:
needs: [Setup]
runs-on: ubuntu-latest
Expand All @@ -61,22 +62,23 @@ jobs:
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
id: get_commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: List merged branch
id: get-branch
id: get_branch
run: |
MERGED_BRANCH=$(git log --merges --pretty=format:"%s" -1 | grep -oE 'from bcgov/[^ ]+' | sed 's/from bcgov\///')
if [ -z "$MERGED_BRANCH" ]; then
echo "direct push not a PR from bcgov/branch"
echo "direct push not a pull request from bcgov/branch"
echo "MERGED_BRANCH='push'" >> $GITHUB_OUTPUT
else
echo "Merged branch: $MERGED_BRANCH"
echo "Merged branch: $MERGED_BRANCH"
echo "MERGED_BRANCH=$MERGED_BRANCH" >> $GITHUB_OUTPUT
fi
echo "mergedbranch=$MERGED_BRANCH" >> $GITHUB_OUTPUT
outputs:
SHA_SHORT: ${{steps.get_commit.outputs.SHA_SHORT}}
MERGED_BRANCH: ${{steps.get_branch.outputs.MERGED_BRANCH}}
GenerateTag:
needs: [Setup,Branch]
runs-on: ubuntu-latest
Expand All @@ -86,24 +88,20 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get short commitId
id: get-commit
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get current date
id: date-selector
run: echo "date=$(date +'%B %e, %Y')" >> $GITHUB_OUTPUT
- name: Generate Next Git Tag
id: tag-selector
id: tag_selector
run: |
# Extract the major.minor.patch version parts using grep
MAJOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '^[0-9]+')
MINOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '\.[0-9]+\.' | grep -oE '[0-9]+')
VERSION_PATCH=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '[0-9]+$')
# Increment version elements
echo ${{steps.get-branch.outputs.mergedbranch}}
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
VERSION_PATCH=$((VERSION_PATCH + 1))
#
# If main patch is from test use test versions
# If main patch is from hotfix branch/tag increment patch
#
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
# Prepare tags
echo "gittag=${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT
Expand All @@ -113,21 +111,31 @@ jobs:
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
git tag -a "${{steps.tag-selector.outputs.gittag}}" -m "${{steps.tag-selector.outputs.tagmsg}}"
git push origin "${{steps.tag-selector.outputs.gittag}}"
git tag -a "${{steps.tag_selector.outputs.TAGNAME}}" -m "${{steps.tag_selector.outputs.TAGMSG}}"
git push origin "${{steps.tag_selector.outputs.TAGNAME}}"
outputs:
TAGNAME: ${{steps.tag_selector.outputs.TAGNAME}}
TAGMSG: ${{steps.tag_selector.outputs.TAGMSG}}
TAGVERSION: ${{steps.tag_selector.outputs.TAGVERSION}}
PushVariables:
needs: [Setup,Branch,GenerateTag]
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set repository version variable
id: setversion
run: |
id: set_version
run: |
gh variable list --env ${{env.TARGET_ENV}}
gh variable set UGM_BUILD_REVISION --env ${{env.TARGET_ENV}} --body "${{steps.get-commit.outputs.sha_short}}"
gh variable set UGM_BUILD_VERSION --env ${{env.TARGET_ENV}} --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable set UGM_BUILD_REVISION --env ${{env.TARGET_ENV}} --body "${{needs.Branch.outputs.SHA_SHORT}}"
gh variable set UGM_BUILD_VERSION --env ${{env.TARGET_ENV}} --body "${{needs.GenerateTag.outputs.TAGVERSION}}"
gh variable list --env ${{env.TARGET_ENV}}
# Update lower environment version elements
gh variable set UGM_BUILD_VERSION --env dev --body "${{steps.tag-selector.outputs.tagversion}}"
gh variable list --env dev
echo "buildArgs --env ${{env.TARGET_ENV}} UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}, Merged Branch: ${{steps.get-branch.outputs.MERGED_BRANCH}}"
echo "buildArgs --env ${{env.TARGET_ENV}} UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}, Merged Branch: ${{needs.Branch.outputs.MERGED_BRANCH}}"
Build:
needs: [Setup,Branch,GenerateTag]
needs: [Setup,Branch,GenerateTag,PushVariables]
runs-on: ubuntu-latest
environment: main
steps:
Expand All @@ -138,23 +146,17 @@ jobs:
- name: Build aspnetapp docker images
run: docker compose build
working-directory: ./applications/aspnetapp
- name: Get BuildId
id: commit
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set buildArgs
run: |
echo "buildArgs UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}"
- name: Build Docker images
run: |
rm -f ./docker-compose.override.yml
echo "buildArgs UNITY_BUILD_VERSION: ${{env.UGM_BUILD_VERSION}}, UNITY_BUILD_REVISION: ${{env.UGM_BUILD_REVISION}}"
docker compose build --build-arg UNITY_BUILD_VERSION=${{env.UGM_BUILD_VERSION}} --build-arg UNITY_BUILD_REVISION=${{env.UGM_BUILD_REVISION}}
working-directory: ./applications/Unity.GrantManager

- name: Connect to JFrog Artifactory non-interactive login using --password-stdin
run: |
echo "$JFROG_PASSWORD" | docker login -u "$JFROG_USERNAME" --password-stdin $JFROG_SERVICE
- name: Push application images to Artifactory container registry
run: |
run: |
docker tag dotnetapp $JFROG_SERVICE/$JFROG_REPO_PATH/dotnetapp:stable
docker push $JFROG_SERVICE/$JFROG_REPO_PATH/dotnetapp:stable
docker tag aspnetapp $JFROG_SERVICE/$JFROG_REPO_PATH/aspnetapp:stable
Expand All @@ -172,7 +174,7 @@ jobs:
oc registry login
docker login -u unused -p $(oc whoami -t) $OC_REGISTRY
- name: Push application images to OpenShift container registry
run: |
run: |
docker tag dotnetapp $OC_REGISTRY/$OC_TARGET_PROJECT/dotnetapp:stable
docker push $OC_REGISTRY/$OC_TARGET_PROJECT/dotnetapp:stable
docker tag aspnetapp $OC_REGISTRY/$OC_TARGET_PROJECT/aspnetapp:stable
Expand Down
1 change: 1 addition & 0 deletions applications/scripts/datafix-ab#008.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test

0 comments on commit 837f85d

Please sign in to comment.