Skip to content

Add artifactory#481

Merged
kuanfandevops merged 3 commits intorelease-0.5.0from
devops/artifactory-0.5.0
Jan 15, 2026
Merged

Add artifactory#481
kuanfandevops merged 3 commits intorelease-0.5.0from
devops/artifactory-0.5.0

Conversation

@kuanfandevops
Copy link
Collaborator

No description provided.

@kuanfandevops kuanfandevops merged commit 6b498c9 into release-0.5.0 Jan 15, 2026
9 of 11 checks passed
Comment on lines +173 to +186
name: Push images to Artifactory (${{ matrix.image_stream }})
needs: [set-version, set-pre-release, deploy]
strategy:
matrix:
image_stream:
- cthub-backend
- cthub-frontend
uses: ./.github/workflows/push-images-to-artifactory.yaml
with:
env: dev
app_name: zeva
image_stream: ${{ matrix.image_stream }}
image_tag: ${{ needs.set-version.outputs.version }}-${{ needs.set-pre-release.outputs.output1 }}
secrets: inherit

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 22 days ago

Generally, the issue is fixed by adding an explicit permissions block either at the workflow root (to apply to all jobs without their own block) or on specific jobs, granting only the minimal read/write scopes necessary. For jobs that do not interact with the repository via the API, permissions: contents: read is usually sufficient; for jobs that create commits, push branches, or otherwise need to write via GITHUB_TOKEN, appropriate write scopes (such as contents: write) are added.

For this workflow, the simplest and safest fix without changing any existing behavior is:

  • Add a root-level permissions section that sets contents: read as the default for all jobs.
  • Override permissions on the deploy job to grant contents: write because it runs git commit/push commands that (if they use GITHUB_TOKEN at any point) require write access to repository contents. The push-to-artifactory job is a reusable workflow invocation; since we cannot see its internals, the conservative step is to let it inherit the root default (contents: read), which is sufficient for typical image-tag reading and logging. If that reusable workflow needs more, it should define its own permissions.

Concretely:

  • In .github/workflows/dev-ci.yaml, add a new permissions: block after the on: block at the top of the file:
permissions:
  contents: read
  • In the same file, under the deploy: job definition (line 137 onward), add a permissions: block:
deploy:
  name: Deploy CTHUB on Dev
  runs-on: ubuntu-latest
  timeout-minutes: 60
  needs: [set-version, set-pre-release, build]
  permissions:
    contents: write

No additional imports or dependencies are required; this is a pure YAML configuration change.

Suggested changeset 1
.github/workflows/dev-ci.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/dev-ci.yaml b/.github/workflows/dev-ci.yaml
--- a/.github/workflows/dev-ci.yaml
+++ b/.github/workflows/dev-ci.yaml
@@ -11,6 +11,9 @@
     #   - backend/**
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 env:
   GIT_URL: https://github.com/bcgov/cthub.git
   TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
@@ -139,6 +142,8 @@
     runs-on: ubuntu-latest
     timeout-minutes: 60
     needs: [set-version, set-pre-release, build]
+    permissions:
+      contents: write
 
     env:
       VERSION: ${{ needs.set-version.outputs.version }}
EOF
@@ -11,6 +11,9 @@
# - backend/**
workflow_dispatch:

permissions:
contents: read

env:
GIT_URL: https://github.com/bcgov/cthub.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
@@ -139,6 +142,8 @@
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [set-version, set-pre-release, build]
permissions:
contents: write

env:
VERSION: ${{ needs.set-version.outputs.version }}
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant