Skip to content

Commit

Permalink
test 7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
DarylTodosichuk committed Oct 25, 2024
1 parent 6f61665 commit bdad21c
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 67 deletions.
49 changes: 25 additions & 24 deletions .github/workflows/docker-build-dev.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: "Development 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: dev
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,29 +62,35 @@ 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" >> $GITHUB_OUTPUT
fi
echo "MERGED_BRANCH=$MERGED_BRANCH" >> $GITHUB_OUTPUT
outputs:
SHA_SHORT: ${{steps.get_commit.outputs.SHA_SHORT}}
MERGED_BRANCH: ${{steps.get_branch.outputs.MERGED_BRANCH}}
PushVariables:
needs: [Setup,Branch]
runs-on: ubuntu-latest
environment: dev
steps:
- name: Set repository version variables
id: setversion
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_REVISION --env ${{env.TARGET_ENV}} --body "${{needs.Branch.outputs.SHA_SHORT}}}"
gh variable list --env ${{env.TARGET_ENV}}
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]
runs-on: ubuntu-latest
Expand All @@ -96,18 +103,12 @@ 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
Expand Down
91 changes: 49 additions & 42 deletions .github/workflows/docker-build-test.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: "Test 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: 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,15 +88,8 @@ 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]+')
Expand All @@ -103,28 +98,46 @@ jobs:
# Increment version elements
echo "${{env.UGM_RELEASE_PREFIX}}$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH"
MINOR_VERSION=$((MINOR_VERSION + 1))
#
# If test patch is not 0 and from branch is dev set to 0
# If test patch is not 0 and from branch is hotfix increment patch
#
VERSION_PATCH=0
#
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
echo "tagmsg=${{env.UGM_RELEASE_MESSAGE}} ${{steps.date-selector.outputs.date}}" >> $GITHUB_OUTPUT
echo "tagversion=$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH" >> $GITHUB_OUTPUT
echo "TAGNAME=${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT
echo "TAGMSG=${{env.UGM_RELEASE_MESSAGE}} ${{needs.Setup.outputs.DATE}}" >> $GITHUB_OUTPUT
echo "TAGVERSION=$MAJOR_VERSION.$MINOR_VERSION.$VERSION_PATCH" >> $GITHUB_OUTPUT
- name: Create Git Tag
id: tag_create
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: Set repository version variable
id: setversion
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}}"
# Update other environments version elements
gh variable set UGM_BUILD_VERSION --env dev --body "${{needs.GenerateTag.outputs.TAGVERSION}}"
gh variable get UGM_BUILD_VERSION --env dev
gh variable set UGM_BUILD_VERSION --env main --body "${{needs.GenerateTag.outputs.TAGVERSION}}"
gh variable get UGM_BUILD_VERSION --env main
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]
runs-on: ubuntu-latest
Expand All @@ -137,18 +150,12 @@ 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
Expand Down
3 changes: 2 additions & 1 deletion applications/scripts/datafix-ab#007.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test 1
test 2
test 3
test 4
test 4
test 5

0 comments on commit bdad21c

Please sign in to comment.