-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to login on cluster with private certificate (#866)
* fix: unable to login on cluster with private certificate Signed-off-by: Stephane Bouchet <[email protected]> * fix: unable to login on cluster with private certificate Signed-off-by: Stephane Bouchet <[email protected]> --------- Signed-off-by: Stephane Bouchet <[email protected]>
- Loading branch information
Showing
26 changed files
with
626 additions
and
320 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
run: | | ||
echo PR_EXISTS=$(gh pr --repo ${{ github.repository }} list --state open --search "fix: update helm ${{env.LATEST_TOOL_RELEASE}} in:title" --json url | jq length) >> $GITHUB_ENV | ||
- name: Update tools.json with latest helm version | ||
if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_HELM_VERSION) && (env.PR_EXISTS == 0) && (env.LATEST_TOOL_RELEASE != '') }} | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_HELM_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
jq --indent 4 '.tools.helm.version = "${{ env.LATEST_TOOL_RELEASE }}"' src/main/resources/tools.json | jq --indent 4 '.tools.helm.versionMatchRegExpr = "${{ env.LATEST_TOOL_RELEASE }}"' > src/main/resources/tools.json.new | ||
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
|
@@ -37,7 +37,7 @@ jobs: | |
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
done | ||
- name: Create pull request | ||
if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_HELM_VERSION) && (env.PR_EXISTS == 0) && (env.LATEST_TOOL_RELEASE != '') }} | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_HELM_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
|
This file contains 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,47 @@ | ||
name: check-oc | ||
|
||
on: | ||
schedule: | ||
- cron: "0 10 * * *" | ||
workflow_dispatch: | ||
jobs: | ||
check-oc-repo: | ||
runs-on: ubuntu-latest | ||
env: | ||
TOOL_REPO: openshift/oc | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Check Out Code | ||
uses: actions/checkout@v4 | ||
- name: Get latest OC version | ||
run: | | ||
echo "REPO_OC_VERSION=$(cat src/main/resources/tools.json | jq -r .tools.oc.version)" >> $GITHUB_ENV | ||
baseUrl="'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/release.txt" | ||
echo "LATEST_TOOL_URL=$(echo ${baseUrl})" >> $GITHUB_ENV | ||
echo "LATEST_TOOL_RELEASE=$(curl -s -L ${baseUrl} | grep "Name:" | head -n 1 | sed 's|Name:||' | sed 's| ||g')" >> $GITHUB_ENV | ||
- name: Find existing PR for OC version | ||
run: | | ||
echo PR_EXISTS=$(gh pr --repo ${{ github.repository }} list --state open --search "fix: update oc ${{env.LATEST_TOOL_RELEASE}} in:title" --json url | jq length) >> $GITHUB_ENV | ||
- name: Update tools.json with latest oc version | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_OC_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
jq --indent 4 '.tools.oc.version = "${{ env.LATEST_TOOL_RELEASE }}"' src/main/resources/tools.json | jq --indent 4 '.tools.oc.versionMatchRegExpr = "${{ env.LATEST_TOOL_RELEASE }}"' > src/main/resources/tools.json.new | ||
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
for platform in win osx \"osx-aarch64\" lnx \"lnx-arm64\"; do | ||
old_url=`jq -r .tools.oc.platforms.${platform}.url src/main/resources/tools.json` | ||
new_url=`echo ${old_url} | sed "s|${{ env.REPO_OC_VERSION }}|${{ env.LATEST_TOOL_RELEASE }}|"` | ||
checksum_url=`echo "${new_url}.sha256"` | ||
checksum=`curl -s -L ${checksum_url} | sed "s| ||g"` | ||
jq --indent 4 ".tools.oc.platforms.${platform}.url = \"${new_url}\"" src/main/resources/tools.json \ | ||
| jq --indent 4 ".tools.oc.platforms.${platform}.sha256sum = \"${checksum}\"" > src/main/resources/tools.json.new | ||
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
done | ||
- name: Create pull request | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_OC_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
git checkout -b "oc-${{ env.LATEST_TOOL_RELEASE }}" | ||
git commit -am "fix: Update oc to ${{ env.LATEST_TOOL_RELEASE }}" | ||
git push origin "oc-${{ env.LATEST_TOOL_RELEASE }}" | ||
gh pr create --title "fix: Update oc to ${{ env.LATEST_TOOL_RELEASE }}" --body "See ${{ env.LATEST_TOOL_URL }}" |
This file contains 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 |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
run: | | ||
echo PR_EXISTS=$(gh pr --repo ${{ github.repository }} list --state open --search "fix: update odo ${{env.LATEST_TOOL_RELEASE}} in:title" --json url | jq length) >> $GITHUB_ENV | ||
- name: Update tools.json with latest odo version | ||
if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_EXISTS == 0) }} | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
jq --indent 4 '.tools.odo.version = "${{ env.LATEST_TOOL_RELEASE }}"' src/main/resources/tools.json | jq --indent 4 '.tools.odo.versionMatchRegExpr = "${{ env.LATEST_TOOL_RELEASE }}"' > src/main/resources/tools.json.new | ||
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
|
@@ -34,7 +34,7 @@ jobs: | |
mv src/main/resources/tools.json.new src/main/resources/tools.json | ||
done | ||
- name: Create pull request | ||
if: ${{ (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_EXISTS == 0) }} | ||
if: ${{ (env.LATEST_TOOL_RELEASE != '') && (env.LATEST_TOOL_RELEASE != env.REPO_ODO_VERSION) && (env.PR_EXISTS == 0) }} | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
|
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.odo/ | ||
.odo/env | ||
.odo/odo-file-index.json | ||
main | ||
main.exe |
This file contains 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
45 changes: 45 additions & 0 deletions
45
src/main/java/org/jboss/tools/intellij/openshift/actions/OcAction.java
This file contains 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 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package org.jboss.tools.intellij.openshift.actions; | ||
|
||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import org.jboss.tools.intellij.openshift.telemetry.TelemetrySender; | ||
import org.jboss.tools.intellij.openshift.utils.oc.Oc; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.swing.tree.TreePath; | ||
|
||
import static org.jboss.tools.intellij.openshift.telemetry.TelemetryService.PREFIX_ACTION; | ||
|
||
public abstract class OcAction extends TelemetryAction { | ||
|
||
protected OcAction(Class... filters) { | ||
super(filters); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected) { | ||
setTelemetrySender(new TelemetrySender(PREFIX_ACTION + getTelemetryActionName())); | ||
ActionUtils.getApplicationRootNode(anActionEvent).getOcTool().whenComplete( | ||
(ocTool, throwable) -> { | ||
if (ocTool != null) { | ||
Oc oc = ocTool.get(); | ||
if (oc != null) { | ||
this.actionPerformedOnSelectedObject(anActionEvent, getElement(selected), oc); | ||
} | ||
} | ||
} | ||
); | ||
} | ||
|
||
public abstract void actionPerformedOnSelectedObject(AnActionEvent anActionEvent, Object selected, @NotNull Oc oc); | ||
|
||
} |
This file contains 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
Oops, something went wrong.