Skip to content

Commit ab86a54

Browse files
Merge pull request #10 from stakater/fix-pipeline
Fix pipeline push back step
2 parents 6bf63cc + 584073b commit ab86a54

File tree

1 file changed

+131
-130
lines changed

1 file changed

+131
-130
lines changed

.github/workflows/push.yml

Lines changed: 131 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -18,134 +18,135 @@ jobs:
1818
name: Build
1919
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
2020
runs-on: ubuntu-latest
21-
21+
2222
steps:
23-
- name: Check out code
24-
uses: actions/checkout@v2
25-
with:
26-
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
27-
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
28-
29-
- name: Set up Go
30-
id: go
31-
uses: actions/setup-go@v2
32-
with:
33-
go-version: ${{ env.GOLANG_VERSION }}
34-
35-
- name: Lint
36-
run: |
37-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0
38-
golangci-lint run --timeout=10m ./...
39-
40-
- name: Install kubectl
41-
run: |
42-
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
43-
sudo install ./kubectl /usr/local/bin/ && rm kubectl
44-
kubectl version --short --client
45-
kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
46-
47-
- name: Install Kind
48-
run: |
49-
curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
50-
sudo install ./kind /usr/local/bin && rm kind
51-
kind version
52-
kind version | grep -q ${KIND_VERSION}
53-
54-
- name: Create Kind Cluster
55-
run: |
56-
kind create cluster
57-
58-
- name: Set up Cluster
59-
run: |
60-
kubectl cluster-info
61-
kubectl create namespace test
62-
63-
- name: Test
64-
run: make test OPERATOR_NAMESPACE=test USE_EXISTING_CLUSTER=true
65-
66-
- name: Generate Tag
67-
id: generate_tag
68-
uses: anothrNick/[email protected]
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
71-
WITH_V: true
72-
DEFAULT_BUMP: patch
73-
DRY_RUN: true
74-
75-
- name: Build and push Docker images
76-
uses: docker/build-push-action@v1
77-
with:
78-
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
79-
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
80-
repository: ${{ env.GITHUB_REPOSITORY }}
81-
add_git_labels: true
82-
dockerfile: ${{ env.DOCKER_FILE_PATH }}
83-
tags: ${{ steps.generate_tag.outputs.new_tag }}
84-
85-
86-
##############################
87-
## Add steps to generate required artifacts for a release here(helm chart, operator manifest etc.)
88-
##############################
89-
90-
# Generate tag for operator without "v"
91-
- name: Generate Operator Tag
92-
id: generate_operator_tag
93-
uses: anothrNick/[email protected]
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
96-
WITH_V: false
97-
DEFAULT_BUMP: patch
98-
DRY_RUN: true
99-
100-
# Install operator-sdk
101-
- name: Install operator-sdk
102-
env:
103-
OPERATOR_SDK_VERSION: ${{ env.OPERATOR_SDK_VERSION }}
104-
run: |
105-
curl -fL -o /tmp/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk-v${OPERATOR_SDK_VERSION}-x86_64-linux-gnu"
106-
sudo install /tmp/operator-sdk /usr/local/bin && rm -f /tmp/operator-sdk
107-
operator-sdk version
108-
operator-sdk version | grep -q "${OPERATOR_SDK_VERSION}"
109-
110-
# Install kustomize
111-
- uses: imranismail/setup-kustomize@v1
112-
with:
113-
kustomize-version: ${{ env.KUSTOMIZE_VERSION }}
114-
115-
- name: Generate Bundle
116-
env:
117-
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
118-
run: make bundle
119-
120-
- name: Generate Package Manifests
121-
env:
122-
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
123-
run: make packagemanifests
124-
125-
# Commit back changes
126-
- name: Commit files
127-
run: |
128-
git config --local user.email "[email protected]"
129-
git config --local user.name "stakater-user"
130-
git commit -m "[skip-ci] Update artifacts" -a
131-
- name: Push changes
132-
uses: ad-m/github-push-action@master
133-
with:
134-
github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
135-
136-
- name: Push Latest Tag
137-
uses: anothrNick/[email protected]
138-
env:
139-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
140-
WITH_V: true
141-
DEFAULT_BUMP: patch
142-
143-
- name: Notify Slack
144-
uses: 8398a7/action-slack@v3
145-
if: always() # Pick up events even if the job fails or is canceled.
146-
with:
147-
status: ${{ job.status }}
148-
fields: repo,author,action,eventName,ref,workflow
149-
env:
150-
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
151-
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
23+
- name: Check out code
24+
uses: actions/checkout@v2
25+
with:
26+
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
27+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
28+
29+
- name: Set up Go
30+
id: go
31+
uses: actions/setup-go@v2
32+
with:
33+
go-version: ${{ env.GOLANG_VERSION }}
34+
35+
- name: Lint
36+
run: |
37+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0
38+
golangci-lint run --timeout=10m ./...
39+
40+
- name: Install kubectl
41+
run: |
42+
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
43+
sudo install ./kubectl /usr/local/bin/ && rm kubectl
44+
kubectl version --short --client
45+
kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
46+
47+
- name: Install Kind
48+
run: |
49+
curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
50+
sudo install ./kind /usr/local/bin && rm kind
51+
kind version
52+
kind version | grep -q ${KIND_VERSION}
53+
54+
- name: Create Kind Cluster
55+
run: |
56+
kind create cluster
57+
58+
- name: Set up Cluster
59+
run: |
60+
kubectl cluster-info
61+
kubectl create namespace test
62+
63+
- name: Test
64+
run: make test OPERATOR_NAMESPACE=test USE_EXISTING_CLUSTER=true
65+
66+
- name: Generate Tag
67+
id: generate_tag
68+
uses: anothrNick/[email protected]
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
71+
WITH_V: true
72+
DEFAULT_BUMP: patch
73+
DRY_RUN: true
74+
75+
- name: Build and push Docker images
76+
uses: docker/build-push-action@v1
77+
with:
78+
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
79+
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
80+
repository: ${{ env.GITHUB_REPOSITORY }}
81+
add_git_labels: true
82+
dockerfile: ${{ env.DOCKER_FILE_PATH }}
83+
tags: ${{ steps.generate_tag.outputs.new_tag }}
84+
85+
##############################
86+
## Add steps to generate required artifacts for a release here(helm chart, operator manifest etc.)
87+
##############################
88+
89+
# Generate tag for operator without "v"
90+
- name: Generate Operator Tag
91+
id: generate_operator_tag
92+
uses: anothrNick/[email protected]
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
95+
WITH_V: false
96+
DEFAULT_BUMP: patch
97+
DRY_RUN: true
98+
99+
# Install operator-sdk
100+
- name: Install operator-sdk
101+
env:
102+
OPERATOR_SDK_VERSION: ${{ env.OPERATOR_SDK_VERSION }}
103+
run: |
104+
curl -fL -o /tmp/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk-v${OPERATOR_SDK_VERSION}-x86_64-linux-gnu"
105+
sudo install /tmp/operator-sdk /usr/local/bin && rm -f /tmp/operator-sdk
106+
operator-sdk version
107+
operator-sdk version | grep -q "${OPERATOR_SDK_VERSION}"
108+
109+
# Install kustomize
110+
- uses: imranismail/setup-kustomize@v1
111+
with:
112+
kustomize-version: ${{ env.KUSTOMIZE_VERSION }}
113+
114+
- name: Generate Bundle
115+
env:
116+
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
117+
run: make bundle
118+
119+
- name: Generate Package Manifests
120+
env:
121+
VERSION: ${{ steps.generate_operator_tag.outputs.new_tag }}
122+
run: make packagemanifests
123+
124+
# Commit back changes
125+
- name: Commit files
126+
run: |
127+
git config --local user.email "[email protected]"
128+
git config --local user.name "stakater-user"
129+
git status
130+
git add .
131+
git commit -m "[skip-ci] Update artifacts" -a
132+
- name: Push changes
133+
uses: ad-m/github-push-action@master
134+
with:
135+
github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
136+
137+
- name: Push Latest Tag
138+
uses: anothrNick/[email protected]
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
141+
WITH_V: true
142+
DEFAULT_BUMP: patch
143+
144+
- name: Notify Slack
145+
uses: 8398a7/action-slack@v3
146+
if: always() # Pick up events even if the job fails or is canceled.
147+
with:
148+
status: ${{ job.status }}
149+
fields: repo,author,action,eventName,ref,workflow
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }}
152+
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)