-
Notifications
You must be signed in to change notification settings - Fork 15
Tracking pull request to merge release-1.74.0 to master #2575
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
Open
kuanfandevops
wants to merge
9
commits into
master
Choose a base branch
from
release-1.74.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
24cc49f
update pr-build
kuanfandevops 371ca59
Store dev images to artifactory (#2576)
kuanfandevops 7bb3efb
add push-to-artifactory to test-ci.yaml
kuanfandevops 1ba7703
add push-to-artifactory to prod-ci.yaml
kuanfandevops 9e84878
add permissions block
kuanfandevops 822b522
Story: Automated CA and MYR Backdate Flagging #2551 (#2578)
JulianForeman cbed600
2551: address "returned to supplier" reports not being sent to fronte…
tim738745 d7777df
Task 2545 - ICBC Upload User Notification (#2571)
dallascrichmond 9c63020
2545 - transactions (#2581)
tim738745 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| name: Push images to Artifactory | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| env: | ||
| description: Deployment environment (dev, test, prod). | ||
| required: true | ||
| type: string | ||
| app_name: | ||
| description: Application name used in Artifactory paths. | ||
| required: true | ||
| type: string | ||
| image_stream: | ||
| description: Image stream name to copy (e.g. zeva-backend). | ||
| required: true | ||
| type: string | ||
| image_tag: | ||
| description: Image tag to copy to Artifactory. | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| ARTIFACTORY_REGISTRY: | ||
| required: true | ||
| ARTIFACTORY_REPO: | ||
| required: true | ||
| ARTIFACTORY_API_KEY: | ||
| required: true | ||
| ARTIFACTORY_USERNAME: | ||
| required: true | ||
| OPENSHIFT_SERVER: | ||
| required: true | ||
| OPENSHIFT_TOKEN: | ||
| required: true | ||
| OPENSHIFT_NAMESPACE_PLATE: | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| jobs: | ||
| push-images-to-artifactory: | ||
| name: Push images to Artifactory | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| env: | ||
| ARTIFACTORY_REGISTRY: ${{ secrets.ARTIFACTORY_REGISTRY }} | ||
| ARTIFACTORY_REPO: ${{ secrets.ARTIFACTORY_REPO }} | ||
| ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | ||
| ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
| OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }} | ||
| OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }} | ||
| DEPLOY_ENV: ${{ inputs.env }} | ||
| APP_NAME: ${{ inputs.app_name }} | ||
| SOURCE_NAMESPACE: ${{ format('{0}-{1}', secrets.OPENSHIFT_NAMESPACE_PLATE, inputs.env) }} | ||
| IMAGE_STREAM: ${{ inputs.image_stream }} | ||
| IMAGE_TAG: ${{ inputs.image_tag }} | ||
|
|
||
| steps: | ||
| - name: Install skopeo | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y skopeo | ||
|
|
||
| - name: Login to Artifactory | ||
| run: | | ||
| set -euo pipefail | ||
| AUTH_CURL_FLAGS=(-H "X-JFrog-Art-Api: ${ARTIFACTORY_API_KEY}") | ||
| AUTH_PASSWORD="${ARTIFACTORY_API_KEY}" | ||
| PING_URL="https://${ARTIFACTORY_REGISTRY}/artifactory/api/system/ping" | ||
| REPO_URL="https://${ARTIFACTORY_REGISTRY}/artifactory/api/repositories/${ARTIFACTORY_REPO}" | ||
| if ! curl -fsS "${AUTH_CURL_FLAGS[@]}" "${PING_URL}"; then | ||
| echo "Artifactory ping failed: ${PING_URL}" | ||
| exit 1 | ||
| fi | ||
| REPO_HTTP_STATUS="$(curl -sS -o /tmp/artifactory-repo-info.txt -w "%{http_code}" \ | ||
| "${AUTH_CURL_FLAGS[@]}" "${REPO_URL}")" | ||
| if [ "${REPO_HTTP_STATUS}" -ge 200 ] && [ "${REPO_HTTP_STATUS}" -lt 300 ]; then | ||
| REPO_INFO="$(cat /tmp/artifactory-repo-info.txt)" | ||
| else | ||
| echo "Artifactory repo query failed: ${REPO_URL} (HTTP ${REPO_HTTP_STATUS})" | ||
| cat /tmp/artifactory-repo-info.txt | ||
| exit 1 | ||
| fi | ||
| echo "${REPO_INFO}" | tr -d '\n' | grep -Eq '"packageType"[[:space:]]*:[[:space:]]*"docker"' || \ | ||
| { echo "Repo ${ARTIFACTORY_REPO} is not a Docker repo."; exit 1; } | ||
| echo "${REPO_INFO}" | tr -d '\n' | grep -Eq '"rclass"[[:space:]]*:[[:space:]]*"(local|virtual|federated)"' || \ | ||
| { echo "Repo ${ARTIFACTORY_REPO} must be local or virtual or federated."; exit 1; } | ||
| skopeo login --authfile /tmp/artifactory-auth.json \ | ||
| --username "${ARTIFACTORY_USERNAME}" \ | ||
| --password "${AUTH_PASSWORD}" \ | ||
| "${ARTIFACTORY_REGISTRY}" | ||
|
|
||
| - name: Restore oc command from Cache | ||
| uses: actions/[email protected] | ||
| with: | ||
| path: /usr/local/bin/oc | ||
| key: oc-cli-${{ runner.os }} | ||
|
|
||
| - name: Log in to Openshift | ||
| uses: redhat-actions/[email protected] | ||
| with: | ||
| openshift_server_url: ${{ env.OPENSHIFT_SERVER }} | ||
| openshift_token: ${{ env.OPENSHIFT_TOKEN }} | ||
| insecure_skip_tls_verify: true | ||
| namespace: ${{ env.SOURCE_NAMESPACE }} | ||
|
|
||
| - name: Copy OpenShift image to Artifactory | ||
| run: | | ||
| set -euo pipefail | ||
| REPO_REF="docker://${ARTIFACTORY_REGISTRY}/${ARTIFACTORY_REPO}/${APP_NAME}/${DEPLOY_ENV}/${IMAGE_STREAM}" | ||
| echo "Fetching tags for ${APP_NAME}/${DEPLOY_ENV}/${IMAGE_STREAM}..." | ||
| if TAGS_JSON="$(skopeo list-tags --authfile /tmp/artifactory-auth.json "${REPO_REF}")"; then | ||
| export TAGS_JSON | ||
| TAGS="$(python3 - <<'PY' | ||
| import json | ||
| import os | ||
| import sys | ||
|
|
||
| raw = os.environ.get("TAGS_JSON", "") | ||
| try: | ||
| data = json.loads(raw) | ||
| except json.JSONDecodeError: | ||
| print("::error::Failed to parse tag list JSON from skopeo.", file=sys.stderr) | ||
| sys.exit(1) | ||
|
|
||
| tags = data.get("Tags") | ||
| if not isinstance(tags, list): | ||
| print("::error::Tag list response missing Tags array.", file=sys.stderr) | ||
| sys.exit(1) | ||
|
|
||
| print("\n".join(tag for tag in tags if tag)) | ||
| PY | ||
| )" | ||
| if [ -z "${TAGS// }" ]; then | ||
| echo "No tags found for ${APP_NAME}/${DEPLOY_ENV}/${IMAGE_STREAM}." | ||
| else | ||
| echo "Deleting tags for ${APP_NAME}/${DEPLOY_ENV}/${IMAGE_STREAM}..." | ||
| echo "${TAGS}" | while IFS= read -r tag; do | ||
| [ -z "${tag}" ] && continue | ||
| skopeo delete --authfile /tmp/artifactory-auth.json "${REPO_REF}:${tag}" | ||
| done | ||
| fi | ||
| else | ||
| echo "Repository ${APP_NAME}/${DEPLOY_ENV}/${IMAGE_STREAM} not found; skipping tag cleanup." | ||
| fi | ||
|
|
||
| OPENSHIFT_REGISTRY="$(oc registry info --public)" | ||
| oc registry login --registry="${OPENSHIFT_REGISTRY}" --to=/tmp/openshift-auth.json | ||
|
|
||
| skopeo copy --src-tls-verify=false --dest-tls-verify=true \ | ||
| --src-authfile /tmp/openshift-auth.json --dest-authfile /tmp/artifactory-auth.json \ | ||
| "docker://${OPENSHIFT_REGISTRY}/${SOURCE_NAMESPACE}/${IMAGE_STREAM}:${IMAGE_TAG}" \ | ||
| "${REPO_REF}:${IMAGE_TAG}" | ||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Generated by Django 3.2.25 on 2026-01-19 19:48 | ||
|
|
||
| import db_comments.model_mixins | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('api', '0012_auto_20250131_1252'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='IcbcUploadProgress', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)), | ||
| ('create_user', models.CharField(default='SYSTEM', max_length=130)), | ||
| ('update_timestamp', models.DateTimeField(auto_now=True, null=True)), | ||
| ('update_user', models.CharField(max_length=130, null=True)), | ||
| ('progress', models.IntegerField(default=0)), | ||
| ('status_text', models.CharField(default='Starting...', max_length=255)), | ||
| ('current_page', models.IntegerField(default=0)), | ||
| ('total_pages', models.IntegerField(default=0)), | ||
| ('complete', models.BooleanField(default=False)), | ||
| ('error', models.TextField(blank=True, null=True)), | ||
| ('results', models.JSONField(blank=True, null=True)), | ||
| ('upload', models.OneToOneField(db_column='upload_id', on_delete=django.db.models.deletion.CASCADE, related_name='progress', to='api.icbcuploaddate')), | ||
| ], | ||
| options={ | ||
| 'db_table': 'icbc_upload_progress', | ||
| }, | ||
| bases=(models.Model, db_comments.model_mixins.DBComments), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from django.db import models | ||
| from auditable.models import Auditable | ||
| from api.models.icbc_upload_date import IcbcUploadDate | ||
|
|
||
|
|
||
| class IcbcUploadProgress(Auditable): | ||
| """ | ||
| Tracks the progress of ICBC data uploads. | ||
| """ | ||
| upload = models.OneToOneField( | ||
| IcbcUploadDate, | ||
| on_delete=models.CASCADE, | ||
| related_name='progress', | ||
| db_column='upload_id' | ||
| ) | ||
| progress = models.IntegerField( | ||
| default=0 | ||
| ) | ||
| status_text = models.CharField( | ||
| max_length=255, | ||
| default='Starting...' | ||
| ) | ||
| current_page = models.IntegerField( | ||
| default=0 | ||
| ) | ||
| total_pages = models.IntegerField( | ||
| default=0 | ||
| ) | ||
| complete = models.BooleanField( | ||
| default=False | ||
| ) | ||
| error = models.TextField( | ||
| null=True, | ||
| blank=True | ||
| ) | ||
| results = models.JSONField( | ||
| null=True, | ||
| blank=True | ||
| ) | ||
|
|
||
| class Meta: | ||
| db_table = 'icbc_upload_progress' | ||
|
|
||
| def __str__(self): | ||
| return f"Upload {self.upload.id}: {self.progress}% - {self.status_text}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from rest_framework import serializers | ||
| from api.models.icbc_upload_progress import IcbcUploadProgress | ||
|
|
||
|
|
||
| class IcbcUploadProgressSerializer(serializers.ModelSerializer): | ||
| status = serializers.CharField(source='status_text', read_only=True) | ||
| upload_id = serializers.IntegerField(source='upload.id', read_only=True) | ||
|
|
||
| class Meta: | ||
| model = IcbcUploadProgress | ||
| fields = [ | ||
| 'upload_id', | ||
| 'progress', | ||
| 'status', | ||
| 'current_page', | ||
| 'total_pages', | ||
| 'complete', | ||
| 'error', | ||
| 'results', | ||
| 'create_timestamp', | ||
| 'update_timestamp' | ||
| ] | ||
| read_only_fields = ['create_timestamp', 'update_timestamp'] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.