Skip to content

Commit db67074

Browse files
authored
fix: sonar issues (#3073)
* chore: replace Docker login script with docker/login-action@v3 in release workflows - Simplified Docker Hub authentication setup by using the `docker/login-action@v3`. - Updated `setup-buildx-action` to a specific commit reference. - Added `env` for secrets in image deletion step. * chore: update pull request workflow to use Yarn caching and scripts - Switched dependency cache from npm to Yarn for consistent package management. - Updated dependency installation step to ignore scripts. - Replaced npm build command with Yarn build for application build step.
1 parent 1e83897 commit db67074

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

.github/workflows/pull_request_ui.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
uses: actions/setup-node@v4
2828
with:
2929
node-version: ${{ matrix.node-version }}
30-
cache: "npm"
31-
cache-dependency-path: ui/package.json
30+
cache: "yarn"
31+
cache-dependency-path: ui/yarn.lock
3232

3333
- name: "Install dependencies"
34-
run: yarn install --frozen-lockfile
34+
run: yarn install --frozen-lockfile --ignore-scripts
3535

3636
- name: "Check linting"
3737
run: yarn lint:modules:check
@@ -40,6 +40,6 @@ jobs:
4040
run: yarn format:modules:check
4141

4242
- name: "Build application"
43-
run: npm run build --if-present
43+
run: yarn build
4444
env:
4545
CI: false

.github/workflows/release.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ jobs:
3333
with:
3434
node-version: 22
3535

36-
- name: Set up Docker config
37-
run: |
38-
mkdir -p ~/.docker
39-
echo '{"auths":{"https://index.docker.io/v1/":{"auth":"'$(echo -n "${{ secrets.DOCKER_USER }}:${{ secrets.DOCKER_PASSWORD }}" | base64 )'"}}}' > ~/.docker/config.json
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKER_USER }}
40+
password: ${{ secrets.DOCKER_PASSWORD }}
4041

4142
- name: Set environment label for Alpaquita
4243
if: matrix.os == 'alpaquita'
@@ -109,13 +110,14 @@ jobs:
109110
env:
110111
VERSION: ${{ github.event.release.tag_name }}
111112
steps:
112-
- name: Set up Docker config
113-
run: |
114-
mkdir -p ~/.docker
115-
echo '{"auths":{"https://index.docker.io/v1/":{"auth":"'$(echo -n "${{ secrets.DOCKER_USER }}:${{ secrets.DOCKER_PASSWORD }}" | base64 )'"}}}' > ~/.docker/config.json
113+
- name: Login to Docker Hub
114+
uses: docker/login-action@v3
115+
with:
116+
username: ${{ secrets.DOCKER_USER }}
117+
password: ${{ secrets.DOCKER_PASSWORD }}
116118

117119
- name: Set up Docker Buildx
118-
uses: docker/setup-buildx-action@v3
120+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
119121

120122
- name: Create and Push Multi-Platform Images
121123
run: |
@@ -149,8 +151,6 @@ jobs:
149151
150152
- name: Delete ARM Images
151153
run: |
152-
USERNAME="${{ secrets.DOCKER_USER }}"
153-
PASSWORD="${{ secrets.DOCKER_PASSWORD }}"
154154
ORGANIZATION="azbuilder"
155155
IMAGES=("api-server" "open-registry" "executor" "terrakube-ui")
156156
TAG="${{ env.VERSION }}-arm"
@@ -176,4 +176,7 @@ jobs:
176176
else
177177
echo "Failed to delete ${ORGANIZATION}/${IMAGE}:${TAG}. HTTP status code: $DELETE_RESPONSE"
178178
fi
179-
done
179+
done
180+
env:
181+
USERNAME: ${{ secrets.DOCKER_USER }}
182+
PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

0 commit comments

Comments
 (0)