Skip to content

Commit b852cf0

Browse files
authored
Switch PR workflow to pull_request (#429)
* Switch PR workflow to pull_request * Update pull_request.yaml
1 parent 9843e76 commit b852cf0

File tree

1 file changed

+51
-83
lines changed

1 file changed

+51
-83
lines changed

.github/workflows/pull_request.yaml

+51-83
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Pull Request
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- master
77

@@ -46,27 +46,27 @@ jobs:
4646
cd deployments/kubernetes/chart/forecastle
4747
helm lint
4848
49-
- name: Install kubectl
50-
run: |
51-
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
52-
sudo install ./kubectl /usr/local/bin/ && rm kubectl
53-
kubectl version --short --client
54-
kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
55-
56-
- name: Install Kind
57-
run: |
58-
curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
59-
sudo install ./kind /usr/local/bin && rm kind
60-
kind version
61-
kind version | grep -q ${KIND_VERSION}
62-
63-
- name: Create Kind Cluster
64-
run: |
65-
kind create cluster
66-
kubectl cluster-info
49+
# - name: Install kubectl
50+
# run: |
51+
# curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
52+
# sudo install ./kubectl /usr/local/bin/ && rm kubectl
53+
# kubectl version --short --client
54+
# kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
55+
56+
# - name: Install Kind
57+
# run: |
58+
# curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
59+
# sudo install ./kind /usr/local/bin && rm kind
60+
# kind version
61+
# kind version | grep -q ${KIND_VERSION}
62+
63+
# - name: Create Kind Cluster
64+
# run: |
65+
# kind create cluster
66+
# kubectl cluster-info
6767

68-
- name: Test
69-
run: make test
68+
# - name: Test
69+
# run: make test
7070

7171
- name: Generate Tag
7272
id: generate_tag
@@ -81,24 +81,19 @@ jobs:
8181
- name: Set up Docker Buildx
8282
uses: docker/setup-buildx-action@v3
8383

84-
- name: Login to ghcr registry
85-
uses: docker/login-action@v3
86-
with:
87-
registry: ${{env.REGISTRY}}
88-
username: stakater-user
89-
password: ${{secrets.GITHUB_TOKEN}}
90-
9184
- name: Generate image repository path for ghcr registry
9285
run: |
9386
echo GHCR_IMAGE_REPOSITORY=${{env.REGISTRY}}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
9487
95-
- name: Build and Push image to ghcr registry
88+
# To identify any broken changes in dockerfiles or dependencies
89+
90+
- name: Build image
9691
uses: docker/build-push-action@v5
9792
with:
9893
context: .
9994
file: ${{ env.DOCKER_FILE_PATH }}
10095
pull: true
101-
push: true
96+
push: false
10297
cache-to: type=inline
10398
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
10499
platforms: linux/amd64,linux/arm,linux/arm64
@@ -109,56 +104,29 @@ jobs:
109104
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
110105
org.opencontainers.image.revision=${{ github.sha }}
111106
112-
- name: Login to Registry for DockerHub
113-
uses: docker/login-action@v3
114-
with:
115-
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
116-
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
117-
118-
- name: Generate image repository path for DockerHub registry
119-
run: |
120-
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
121-
122-
- name: Build and Push Docker Image to DockerHub registry
123-
uses: docker/build-push-action@v5
124-
with:
125-
context: .
126-
file: ${{ env.DOCKER_FILE_PATH }}
127-
pull: true
128-
push: true
129-
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
130-
cache-to: type=inline
131-
platforms: linux/amd64,linux/arm,linux/arm64
132-
tags: |
133-
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
134-
labels: |
135-
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
136-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
137-
org.opencontainers.image.revision=${{ github.sha }}
138-
139-
- name: Comment on PR
140-
uses: mshick/add-pr-comment@v2
141-
env:
142-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143-
with:
144-
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
145-
allow-repeats: true
146-
147-
- name: Notify Failure
148-
if: failure()
149-
uses: mshick/add-pr-comment@v2
150-
env:
151-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152-
with:
153-
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
154-
allow-repeats: true
155-
156-
- name: Notify Slack
157-
uses: 8398a7/action-slack@v3
158-
if: always() # Pick up events even if the job fails or is canceled.
159-
with:
160-
status: ${{ job.status }}
161-
fields: repo,author,action,eventName,ref,workflow
162-
env:
163-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
164-
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
107+
# - name: Comment on PR
108+
# uses: mshick/add-pr-comment@v2
109+
# env:
110+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
# with:
112+
# message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
113+
# allow-repeats: true
114+
115+
# - name: Notify Failure
116+
# if: failure()
117+
# uses: mshick/add-pr-comment@v2
118+
# env:
119+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
# with:
121+
# message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
122+
# allow-repeats: true
123+
124+
# - name: Notify Slack
125+
# uses: 8398a7/action-slack@v3
126+
# if: always() # Pick up events even if the job fails or is canceled.
127+
# with:
128+
# status: ${{ job.status }}
129+
# fields: repo,author,action,eventName,ref,workflow
130+
# env:
131+
# GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
132+
# SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)